legoino icon indicating copy to clipboard operation
legoino copied to clipboard

Add configurable option to set BLE Power level

Open corneliusmunz opened this issue 5 years ago • 1 comments

It would be good to enable the user to set the BLE Power level without calling NimBLE-Arduino functions. Maybe the default levels could be changed from -3dB to +9dB

The power levels for scan, advertisment and default could be changed with the static NimBLE-Arduino function void NimBLEDevice::setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType)

With esp_power_level_t

/*
ESP_PWR_LVL_N12 = 0, Corresponding to -12dbm
ESP_PWR_LVL_N9  = 1, Corresponding to  -9dbm
ESP_PWR_LVL_N6  = 2, Corresponding to  -6dbm
ESP_PWR_LVL_N3  = 3, Corresponding to  -3dbm
ESP_PWR_LVL_N0  = 4, Corresponding to   0dbm
ESP_PWR_LVL_P3  = 5, Corresponding to  +3dbm
ESP_PWR_LVL_P6  = 6, Corresponding to  +6dbm
ESP_PWR_LVL_P9  = 7, Corresponding to  +9dbm
*/

and esp_ble_power_type_t

/*
ESP_BLE_PWR_TYPE_ADV        = 9,  For advertising
ESP_BLE_PWR_TYPE_SCAN       = 10, For scan
ESP_BLE_PWR_TYPE_DEFAULT    = 11, For default, if not set other, it will use default value
 */

@fvanroie : I've seen this in your code and thought that this would be a good way to increase the usable distance of the BLE connections to the hubs. Do you have faced any issues about remarkable lower battery lifetimes?

corneliusmunz avatar Dec 23 '20 23:12 corneliusmunz

Good idea!

I don't have much data I'm afraid, I only included that line because the HubRemote Led was sometimes blinking when bad reception. This annoyed/distracted me, so I upped the power level of the ESP32 😄 .

fvanroie avatar Dec 24 '20 19:12 fvanroie