From ca0ee31e951efbcdcd49c748f793380504197454 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Wed, 14 Feb 2024 16:32:49 +0700 Subject: [PATCH] watchdog timer --- ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaRecovery.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaRecovery.cpp b/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaRecovery.cpp index f9343a3..863b194 100644 --- a/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaRecovery.cpp +++ b/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/ESPMegaRecovery.cpp @@ -28,6 +28,15 @@ void ESPMegaRecovery::loop() { delay(1000); } } + // Watchdog timer + static bool booted = false; + static uint32_t boot_time = millis(); + if(!booted) { + if(millis() - boot_time > RECOVERY_WATCHDOG_TIMEOUT * 1000) { + this->resetBootloopCounter(); + booted = true; + } + } } void ESPMegaRecovery::enterRecoveryMode() { // Set the recovery mode flag