diff options
| author | Thomas Friebel | 2020-03-07 22:27:32 +0100 |
|---|---|---|
| committer | Damien George | 2020-03-11 13:02:00 +1100 |
| commit | bd746a46309efc261d6124b546b5bf6775d47460 (patch) | |
| tree | b6d7bde4d807ab9d1d3f57b5e91da50f142c52be | |
| parent | 41a9f1dec8558f5272ebc090135d6d101f686fb9 (diff) | |
esp32: Deinitialize Bluetooth on soft reset.
This fixes a crash, caused by NimBLE continuing to call the Python BLE
interrupt handler after soft reboot.
| -rw-r--r-- | ports/esp32/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ports/esp32/main.c b/ports/esp32/main.c index 8c416d0b8..81e4a6434 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -58,6 +58,10 @@ #include "modnetwork.h" #include "mpthreadport.h" +#if MICROPY_BLUETOOTH_NIMBLE +#include "extmod/modbluetooth.h" +#endif + // MicroPython runs as a task under FreeRTOS #define MP_TASK_PRIORITY (ESP_TASK_PRIO_MIN + 1) #define MP_TASK_STACK_SIZE (16 * 1024) @@ -136,6 +140,10 @@ soft_reset: } } + #if MICROPY_BLUETOOTH_NIMBLE + mp_bluetooth_deinit(); + #endif + machine_timer_deinit_all(); #if MICROPY_PY_THREAD |
