@@ -76,7 +76,7 @@ extern "C" void ble_store_config_init(void);
7676/* *
7777 * Singletons for the NimBLEDevice.
7878 */
79- NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
79+ NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
8080NimBLEDeviceCallbacks* NimBLEDevice::m_pDeviceCallbacks = &defaultDeviceCallbacks;
8181
8282# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
@@ -476,14 +476,14 @@ bool NimBLEDevice::setPower(int8_t dbm, NimBLETxPowerType type) {
476476 dbm++; // round up to the next multiple of 3 to be able to target 20dbm
477477 }
478478
479- bool success = false ;
480- esp_power_level_t espPwr = static_cast <esp_power_level_t >(dbm / 3 + ESP_PWR_LVL_N0);
479+ bool success = false ;
480+ esp_power_level_t espPwr = static_cast <esp_power_level_t >(dbm / 3 + ESP_PWR_LVL_N0);
481481 if (type == NimBLETxPowerType::All) {
482482 success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
483483 success &= setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_SCAN);
484484 success &= setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_DEFAULT);
485485 } else if (type == NimBLETxPowerType::Advertise) {
486- success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
486+ success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
487487 } else if (type == NimBLETxPowerType::Scan) {
488488 success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_SCAN);
489489 } else if (type == NimBLETxPowerType::Connection) {
@@ -495,15 +495,13 @@ bool NimBLEDevice::setPower(int8_t dbm, NimBLETxPowerType type) {
495495# else
496496 (void )type; // unused
497497 NIMBLE_LOGD (LOG_TAG, " >> setPower: %d" , dbm);
498- ble_hci_vs_set_tx_pwr_cp cmd{dbm};
499- ble_hci_vs_set_tx_pwr_rp rsp{0 };
500- int rc = ble_hs_hci_send_vs_cmd (BLE_HCI_OCF_VS_SET_TX_PWR, &cmd, sizeof (cmd), &rsp, sizeof (rsp));
498+ int rc = ble_phy_tx_power_set (dbm);
501499 if (rc) {
502500 NIMBLE_LOGE (LOG_TAG, " failed to set TX power, rc: %04x\n " , rc);
503501 return false ;
504502 }
505503
506- NIMBLE_LOGD (LOG_TAG, " TX power set to %d dBm\n " , rsp. tx_power );
504+ NIMBLE_LOGD (LOG_TAG, " TX power set to %d dBm\n " , dbm );
507505 return true ;
508506# endif
509507} // setPower
@@ -539,7 +537,7 @@ int NimBLEDevice::getPower(NimBLETxPowerType type) {
539537# endif
540538# else
541539 (void )type; // unused
542- return ble_phy_txpwr_get ();
540+ return ble_phy_tx_power_get ();
543541# endif
544542} // getPower
545543
@@ -844,7 +842,7 @@ bool NimBLEDevice::init(const std::string& deviceName) {
844842 if (!m_initialized) {
845843# ifdef ESP_PLATFORM
846844
847- # if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
845+ # if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
848846 // make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
849847 btStarted ();
850848# endif
0 commit comments