From f50278307657847f488c09c359b7512fb172e3cf Mon Sep 17 00:00:00 2001 From: netscout2001 <4687675+netscout2001@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:56:09 +0100 Subject: [PATCH] fix: increase WiFi shutdown delay before restart to fix MQTT reconnect after OTA --- src/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3e74529b..a6ed223f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -154,10 +154,9 @@ void loop() LOGI("OTA", "restarting now (main loop)"); esp_wifi_stop(); lvgl_port_prepare_restart(); - delay(50); - // Delegate restart to a dedicated Core 0 task so Core 0 is the initiator. - // This avoids using the small IPC task stack and reduces restart races. - // This eliminates the RUNSTALL timing race that caused "Cache disabled" panics. + delay(250); // increased from 50ms — gives WiFi/TCP stack time to + // fully shut down so the MQTT broker cleanly closes the + // old session before the device reconnects after reboot safe_restart_via_core0(); }