arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.73k stars 4.72k forks source link

Enabled watchdog for ESP32 and variants #21422

Closed s-hadinger closed 1 month ago

s-hadinger commented 1 month ago

Description:

Enable watchdog for ESP32x variants. The watchdog automatically resets the CPU if the main loop is not called for over 5 seconds. It is meant to detect situations when the CPU is stuck and frozen.

We tried the watchdog years ago, but it had some serious issues. They seem all solved now. It is however possible that the watchdog fires during normal long operations. Please report any such circumstances.

In C code, any call to yield() resets the watchdog. Similarly, in Berry, any call to tasmota.yields() resets both the Berry-specific watchdog (4 seconds) and the main watchdog (5 seconds)

Restart -3 was changed on ESP32 otherwise the device is stuck forever, there is no OSWATCH_RESET_TIME after 120s on ESP32

Note: watchdog is already enabled on ESP8266.

This is a second try after #21414 reverted

Checklist:

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass