8000 esp32: Deinitialize Bluetooth on soft reset. · larsks/micropython@bd746a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd746a4

Browse files
friebeldpgeorge
authored andcommitted
esp32: Deinitialize Bluetooth on soft reset.
This fixes a crash, caused by NimBLE continuing to call the Python BLE interrupt handler after soft reboot.
1 parent 41a9f1d commit bd746a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ports/esp32/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
#include "modnetwork.h"
5959
#include "mpthreadport.h"
6060

61+
#if MICROPY_BLUETOOTH_NIMBLE
62+
#include "extmod/modbluetooth.h"
63+
#endif
64+
6165
// MicroPython runs as a task under FreeRTOS
6266
#define MP_TASK_PRIORITY (ESP_TASK_PRIO_MIN + 1)
6367
#define MP_TASK_STACK_SIZE (16 * 1024)
@@ -136,6 +140,10 @@ void mp_task(void *pvParameter) {
136140
}
137141
}
138142

143+
#if MICROPY_BLUETOOTH_NIMBLE
144+
mp_bluetooth_deinit();
145+
#endif
146+
139147
machine_timer_deinit_all();
140148

141149
#if MICROPY_PY_THREAD

0 commit comments

Comments
 (0)
0