nimble 2.x deinit workaround

This commit is contained in:
Jonathan Bennett
2025-09-19 18:54:41 -05:00
parent 9b6a7ed3bb
commit 0fecbbf86b
2 changed files with 6 additions and 0 deletions

View File

@@ -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

View File

@@ -15,6 +15,7 @@ class NimbleBluetooth : BluetoothApi
#if defined(NIMBLE_TWO)
void startAdvertising();
#endif
bool isDeInit = false;
private:
void setupService();