NRF52 bluetooth cleanup and fix (#3328)

* NRF52 bluetooth cleanup. Fixes BLE not returning after serial PhoneAPI connection

* Use new var name in esp32 arch
This commit is contained in:
Ben Meadors
2024-03-03 13:56:55 -06:00
committed by GitHub
parent e5bf07d4fb
commit 72050530f1
9 changed files with 39 additions and 27 deletions

View File

@@ -20,21 +20,21 @@
#if !defined(CONFIG_IDF_TARGET_ESP32S2)
void setBluetoothEnable(bool on)
void setBluetoothEnable(bool enable)
{
if (!isWifiAvailable() && config.bluetooth.enabled == true) {
if (!nimbleBluetooth) {
nimbleBluetooth = new NimbleBluetooth();
}
if (on && !nimbleBluetooth->isActive()) {
if (enable && !nimbleBluetooth->isActive()) {
nimbleBluetooth->setup();
} else if (!on) {
} else if (!enable) {
nimbleBluetooth->shutdown();
}
}
}
#else
void setBluetoothEnable(bool on) {}
void setBluetoothEnable(bool enable) {}
void updateBatteryLevel(uint8_t level) {}
#endif