Repository navigation
Commit cbdf2b2
fix(esp32): deinit BLE before esp_restart() to stop reboot boot-loop (#114)
* fix(esp32): deinit BLE before esp_restart() to stop reboot boot-loop
reboot() (0x000F) and enterDFUMode() called esp_restart() while NimBLE was
still initialized. esp_restart() resets the CPU but NOT the BT controller
hardware, so on the next (software-reset) boot BLEDevice::init()
(ble_init.cpp:255) tries to enable an already-enabled controller and aborts
-> PANIC. The panic is itself a software reset, so the device boot-loops and
only recovers on a physical power cycle (POWERON fully resets the controller).
Observed on esp32-s3-N16R8 (Seeed reTerminal E1003) after Home Assistant sent
0x000F following a config write: crash logged consistently just after "Device
name will be:" and before "Setting BLE MTU", looping until power-cycled.
Pre-existing latent bug (old main had the identical reboot()); triggered by
issuing a reboot command. Unrelated to the config-read ring-drain change.
Fix: add esp32_ble_deinit_before_restart(), mirroring the deep-sleep teardown
in enterDeepSleep() (main.cpp) -- stop advertising, delay, BLEDevice::deinit(true)
(clearAll disables + releases the controller), esp32_ble_clear_handles() -- and
call it before both esp_restart() sites. That clean controller shutdown is why
sleep->wake already re-inits fine; reboot now does the same. NRF paths untouched
(all new code is under #ifdef TARGET_ESP32).
Builds: esp32-s3-N16R8, esp32-c3-N16, nrf52840custom.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(esp32): drop duplicate READ MSD banner in handleReadMSD
CMD_READ_MSD logged "=== READ MSD COMMAND (0x0044) ===" twice per command:
once at the dispatch case (communication.cpp) and again as the first line of
handleReadMSD(). Remove the one inside the handler; the dispatch case still
logs it exactly once. Cosmetic (serial log only), no behavior change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f29eab2 commit cbdf2b2
2 files changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | 262 | | |
264 | 263 | | |
265 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
111 | 132 | | |
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
115 | 136 | | |
116 | 137 | | |
117 | 138 | | |
| 139 | + | |
118 | 140 | | |
119 | 141 | | |
120 | 142 | | |
| |||
702 | 724 | | |
703 | 725 | | |
704 | 726 | | |
| 727 | + | |
705 | 728 | | |
706 | 729 | | |
707 | 730 | | |
| |||
0 commit comments