File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -482,14 +482,21 @@ bool NimBLEDevice::setPower(int8_t dbm) {
482482/* *
483483 * @brief Get the transmission power.
484484 * @return The power level currently used in dbm.
485- * @note ESP32S3 only returns 0xFF as of IDF 5, so this function will return 20dbm.
486485 */
487486int NimBLEDevice::getPower () {
488487# ifdef ESP_PLATFORM
489488# ifdef CONFIG_IDF_TARGET_ESP32P4
490489 return 0xFF ; // CONFIG_IDF_TARGET_ESP32P4 does not support esp_ble_tx_power_get
491490# else
492491 int pwr = esp_ble_tx_power_get (ESP_BLE_PWR_TYPE_DEFAULT);
492+
493+ # if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
494+ // workaround for bug when "enhanced tx power" was added
495+ if (pwr == 0xFF ) {
496+ pwr = esp_ble_tx_power_get (ESP_BLE_PWR_TYPE_CONN_HDL3);
497+ }
498+ # endif
499+
493500 if (pwr < ESP_PWR_LVL_N0) {
494501 return -3 * (ESP_PWR_LVL_N0 - pwr);
495502 }
You can’t perform that action at this time.
0 commit comments