mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 17:52:35 +00:00
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:
@@ -63,28 +63,29 @@ static void initBrownout()
|
||||
// We don't bother with setting up brownout if soft device is disabled - because during production we always use softdevice
|
||||
}
|
||||
|
||||
static bool bleOn = false;
|
||||
static const bool useSoftDevice = true; // Set to false for easier debugging
|
||||
|
||||
void setBluetoothEnable(bool on)
|
||||
void setBluetoothEnable(bool enable)
|
||||
{
|
||||
if (on != bleOn && config.bluetooth.enabled == true) {
|
||||
if (on) {
|
||||
if (enable && config.bluetooth.enabled) {
|
||||
if (!useSoftDevice) {
|
||||
LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n");
|
||||
} else {
|
||||
if (!nrf52Bluetooth) {
|
||||
if (!useSoftDevice)
|
||||
LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n");
|
||||
else {
|
||||
nrf52Bluetooth = new NRF52Bluetooth();
|
||||
nrf52Bluetooth->setup();
|
||||
LOG_DEBUG("Initializing NRF52 Bluetooth\n");
|
||||
nrf52Bluetooth = new NRF52Bluetooth();
|
||||
nrf52Bluetooth->setup();
|
||||
|
||||
// We delay brownout init until after BLE because BLE starts soft device
|
||||
initBrownout();
|
||||
}
|
||||
// We delay brownout init until after BLE because BLE starts soft device
|
||||
initBrownout();
|
||||
} else {
|
||||
nrf52Bluetooth->resumeAdverising();
|
||||
}
|
||||
} else if (nrf52Bluetooth) {
|
||||
}
|
||||
} else {
|
||||
if (nrf52Bluetooth) {
|
||||
nrf52Bluetooth->shutdown();
|
||||
}
|
||||
bleOn = on;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user