don't shutdown bluetooth if we didn't start it

This commit is contained in:
Kevin Hester 2021-08-17 20:40:13 -07:00
parent 52d7a6b8e4
commit 0e91d39b27
2 changed files with 20 additions and 15 deletions

View File

@ -2,11 +2,7 @@
You probably don't care about this section - skip to the next one. You probably don't care about this section - skip to the next one.
* disable bluetooth while wifi is active
* failed adding https service
* fix wifi connections for mqtt
* send debug info 'in-band' * send debug info 'in-band'
* usb lora dongle from pine64 * usb lora dongle from pine64
* turn on watchdog reset if app hangs on nrf52 or esp32 * turn on watchdog reset if app hangs on nrf52 or esp32
* list portduino on platformio * list portduino on platformio

View File

@ -21,6 +21,8 @@
static bool pinShowing; static bool pinShowing;
static uint32_t doublepressed; static uint32_t doublepressed;
static bool bluetoothActive;
static void startCb(uint32_t pin) static void startCb(uint32_t pin)
{ {
pinShowing = true; pinShowing = true;
@ -52,6 +54,9 @@ void updateBatteryLevel(uint8_t level)
void deinitBLE() void deinitBLE()
{ {
if (bluetoothActive) {
bluetoothActive = false;
// DEBUG_MSG("Shutting down bluetooth\n"); // DEBUG_MSG("Shutting down bluetooth\n");
// ble_gatts_show_local(); // ble_gatts_show_local();
@ -69,6 +74,7 @@ void deinitBLE()
// DEBUG_MSG("BLE task exiting\n"); // DEBUG_MSG("BLE task exiting\n");
DEBUG_MSG("Done shutting down bluetooth\n"); DEBUG_MSG("Done shutting down bluetooth\n");
}
} }
void loopBLE() void loopBLE()
@ -479,6 +485,8 @@ void disablePin()
doublepressed = millis(); doublepressed = millis();
} }
// This routine is called multiple times, once each time we come back from sleep // This routine is called multiple times, once each time we come back from sleep
void reinitBluetooth() void reinitBluetooth()
{ {
@ -536,6 +544,7 @@ void reinitBluetooth()
ble_store_config_init(); ble_store_config_init();
nimble_port_freertos_init(ble_host_task); nimble_port_freertos_init(ble_host_task);
bluetoothActive = true;
} }
bool bluetoothOn; bool bluetoothOn;