mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-14 06:42:34 +00:00
nimble 2.x deinit workaround
This commit is contained in:
@@ -231,6 +231,8 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
|
||||
{
|
||||
LOG_INFO("BLE disconnect");
|
||||
#endif
|
||||
if (ble->isDeInit)
|
||||
return;
|
||||
|
||||
meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED);
|
||||
bluetoothStatus->updateStatus(&newStatus);
|
||||
@@ -270,6 +272,7 @@ void NimbleBluetooth::deinit()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
LOG_INFO("Disable bluetooth until reboot");
|
||||
isDeInit = true;
|
||||
|
||||
#ifdef BLE_LED
|
||||
#ifdef BLE_LED_INVERTED
|
||||
@@ -278,8 +281,10 @@ void NimbleBluetooth::deinit()
|
||||
digitalWrite(BLE_LED, LOW);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NIMBLE_TWO
|
||||
NimBLEDevice::deinit();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Has initial setup been completed
|
||||
|
||||
@@ -15,6 +15,7 @@ class NimbleBluetooth : BluetoothApi
|
||||
#if defined(NIMBLE_TWO)
|
||||
void startAdvertising();
|
||||
#endif
|
||||
bool isDeInit = false;
|
||||
|
||||
private:
|
||||
void setupService();
|
||||
|
||||
Reference in New Issue
Block a user