@@ -76,7 +76,7 @@ extern "C" void ble_store_config_init(void);
76
76
/* *
77
77
* Singletons for the NimBLEDevice.
78
78
*/
79
- NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
79
+ NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
80
80
NimBLEDeviceCallbacks* NimBLEDevice::m_pDeviceCallbacks = &defaultDeviceCallbacks;
81
81
82
82
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
@@ -476,14 +476,14 @@ bool NimBLEDevice::setPower(int8_t dbm, NimBLETxPowerType type) {
476
476
dbm++; // round up to the next multiple of 3 to be able to target 20dbm
477
477
}
478
478
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);
481
481
if (type == NimBLETxPowerType::All) {
482
482
success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
483
483
success &= setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_SCAN);
484
484
success &= setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_DEFAULT);
485
485
} else if (type == NimBLETxPowerType::Advertise) {
486
- success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
486
+ success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_ADV);
487
487
} else if (type == NimBLETxPowerType::Scan) {
488
488
success = setPowerLevel (espPwr, ESP_BLE_PWR_TYPE_SCAN);
489
489
} else if (type == NimBLETxPowerType::Connection) {
@@ -495,15 +495,13 @@ bool NimBLEDevice::setPower(int8_t dbm, NimBLETxPowerType type) {
495
495
# else
496
496
(void )type; // unused
497
497
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);
501
499
if (rc) {
502
500
NIMBLE_LOGE (LOG_TAG, " failed to set TX power, rc: %04x\n " , rc);
503
501
return false ;
504
502
}
505
503
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 );
507
505
return true ;
508
506
# endif
509
507
} // setPower
@@ -539,7 +537,7 @@ int NimBLEDevice::getPower(NimBLETxPowerType type) {
539
537
# endif
540
538
# else
541
539
(void )type; // unused
542
- return ble_phy_txpwr_get ();
540
+ return ble_phy_tx_power_get ();
543
541
# endif
544
542
} // getPower
545
543
@@ -844,7 +842,7 @@ bool NimBLEDevice::init(const std::string& deviceName) {
844
842
if (!m_initialized) {
845
843
# ifdef ESP_PLATFORM
846
844
847
- # if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
845
+ # if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
848
846
// make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
849
847
btStarted ();
850
848
# endif
0 commit comments