esp_bt.h enums the available esp_ble_power_type_t and esp_power_level_t to use when calling:
Code: Select all
esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_t power_level)
BLEDevice.cpp shows that the BLEDevice::setPower method calls the above function and sets the default power (ESP_BLE_PWR_TYPE_DEFAULT) to whatever power level is passed in with the call.
I've tried calling BLEDevice::setPower in many places (immediately after my call to BLEDevice::init, in my server callbacks after a successful connection, etc.). But, I always end up with +3dB of transmit power according the the nRF connect app (range and RSSI values also remain unchanged).
Digging through the IDF documentation, I found the following function:
Code: Select all
esp_bredr_tx_power_set(esp_power_level_tmin_power_level, esp_power_level_tmax_power_level)
Since esp_bt_controller_enable is called in BLEDevice::init, I tried the following:
Code: Select all
BLEDevice::init()
esp_bredr_tx_power_set(ESP_PWR_LVL_N12, ESP_PWR_LVL_P9)
BLEDevice::setPower(ESP_PWR_LVL_P9).
I cannot find a call to esp_bredr_tx_power_set anywhere within the arduino IDE BLE source files (1.0.4/libraries/BLE/src), so I do not know where the default esp_power_level_tmax_power_level is being set.
Does anyone have any suggestions of what I am doing wrong?
If not, can anyone tell me where the +3 dB default value is set so I could at least hack something ugly together to test with +9 dB?