From 89b6c9577d58726c58c61cf9a6fb074dc0393b38 Mon Sep 17 00:00:00 2001 From: Chris Lee Date: Sat, 29 Nov 2025 08:43:17 -0500 Subject: [PATCH] Disable watchdog timer during OTA firmware update --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4ccf1b8..0e4ca03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. #include +#include #include #include #include @@ -476,6 +477,11 @@ void setup() { // Initialize Watchdog Timer with 5 second timeout esp_task_wdt_init(5, true); esp_task_wdt_add(NULL); // Add current thread (loopTask) to WDT + + // Disable WDT during OTA + ArduinoOTA.onStart([]() { esp_task_wdt_delete(NULL); }); + ArduinoOTA.onEnd([]() { esp_task_wdt_add(NULL); }); + ArduinoOTA.onError([](ota_error_t error) { esp_task_wdt_add(NULL); }); } // This is called repeaedly when code is running.