Make BLE TX power configurable for nRF52 variants (#9232)
* Make BLE TX power configurable for nRF52 variants * Include BLE TX power setting in T114 variant.h as tested --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -240,6 +240,14 @@ int NRF52Bluetooth::getRssi()
|
|||||||
{
|
{
|
||||||
return 0; // FIXME figure out where to source this
|
return 0; // FIXME figure out where to source this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Valid BLE TX power levels as per nRF52840 Product Specification are: "-20 to +8 dBm TX power, configurable in 4 dB steps".
|
||||||
|
// See https://docs.nordicsemi.com/bundle/ps_nrf52840/page/keyfeatures_html5.html
|
||||||
|
#define VALID_BLE_TX_POWER(x) \
|
||||||
|
((x) == -20 || (x) == -16 || (x) == -12 || \
|
||||||
|
(x) == -8 || (x) == -4 || (x) == 0 || \
|
||||||
|
(x) == 4 || (x) == 8)
|
||||||
|
|
||||||
void NRF52Bluetooth::setup()
|
void NRF52Bluetooth::setup()
|
||||||
{
|
{
|
||||||
// Initialise the Bluefruit module
|
// Initialise the Bluefruit module
|
||||||
@@ -251,6 +259,9 @@ void NRF52Bluetooth::setup()
|
|||||||
Bluefruit.Advertising.stop();
|
Bluefruit.Advertising.stop();
|
||||||
Bluefruit.Advertising.clearData();
|
Bluefruit.Advertising.clearData();
|
||||||
Bluefruit.ScanResponse.clearData();
|
Bluefruit.ScanResponse.clearData();
|
||||||
|
#if defined(NRF52_BLE_TX_POWER) && VALID_BLE_TX_POWER(NRF52_BLE_TX_POWER)
|
||||||
|
Bluefruit.setTxPower(NRF52_BLE_TX_POWER);
|
||||||
|
#endif
|
||||||
if (config.bluetooth.mode != meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) {
|
if (config.bluetooth.mode != meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) {
|
||||||
configuredPasskey = config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN
|
configuredPasskey = config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN
|
||||||
? config.bluetooth.fixed_pin
|
? config.bluetooth.fixed_pin
|
||||||
|
|||||||
@@ -150,6 +150,14 @@ No longer populated on PCB
|
|||||||
#define PIN_SPI1_MOSI ST7789_SDA
|
#define PIN_SPI1_MOSI ST7789_SDA
|
||||||
#define PIN_SPI1_SCK ST7789_SCK
|
#define PIN_SPI1_SCK ST7789_SCK
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bluetooth
|
||||||
|
*/
|
||||||
|
|
||||||
|
// The bluetooth transmit power on the nRF52840 is adjustable from -20dB to +8dB in steps of 4dB
|
||||||
|
// so NRF52_BLE_TX_POWER can be set to -20, -16, -12, -8, -4, 0 (default), 4, and 8.
|
||||||
|
//#define NRF52_BLE_TX_POWER 8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPS pins
|
* GPS pins
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user