Skip to content

Commit cb809d9

Browse files
committed
Fix build with non-esp devices
1 parent e300b9b commit cb809d9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/NimBLEDevice.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)