mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 18:35:41 +00:00
don't shutdown bluetooth if we didn't start it
This commit is contained in:
parent
52d7a6b8e4
commit
0e91d39b27
@ -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
|
||||||
|
@ -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,23 +54,27 @@ void updateBatteryLevel(uint8_t level)
|
|||||||
|
|
||||||
void deinitBLE()
|
void deinitBLE()
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("Shutting down bluetooth\n");
|
if (bluetoothActive) {
|
||||||
// ble_gatts_show_local();
|
bluetoothActive = false;
|
||||||
|
|
||||||
// FIXME - do we need to dealloc things? - what needs to stay alive across light sleep?
|
// DEBUG_MSG("Shutting down bluetooth\n");
|
||||||
auto ret = nimble_port_stop();
|
// ble_gatts_show_local();
|
||||||
assert(ret == ESP_OK);
|
|
||||||
|
|
||||||
nimble_port_deinit(); // teardown nimble datastructures
|
// FIXME - do we need to dealloc things? - what needs to stay alive across light sleep?
|
||||||
|
auto ret = nimble_port_stop();
|
||||||
|
assert(ret == ESP_OK);
|
||||||
|
|
||||||
// DEBUG_MSG("BLE port_deinit done\n");
|
nimble_port_deinit(); // teardown nimble datastructures
|
||||||
|
|
||||||
ret = esp_nimble_hci_and_controller_deinit();
|
// DEBUG_MSG("BLE port_deinit done\n");
|
||||||
assert(ret == ESP_OK);
|
|
||||||
|
|
||||||
// DEBUG_MSG("BLE task exiting\n");
|
ret = esp_nimble_hci_and_controller_deinit();
|
||||||
|
assert(ret == ESP_OK);
|
||||||
|
|
||||||
DEBUG_MSG("Done shutting down bluetooth\n");
|
// DEBUG_MSG("BLE task exiting\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;
|
||||||
|
Loading…
Reference in New Issue
Block a user