Hieromon / AutoConnect

An Arduino library for ESP8266/ESP32 WLAN configuration at runtime with the Web interface
https://hieromon.github.io/AutoConnect/
MIT License
889 stars 185 forks source link

Watchdog or similar approach to crash or freeze with ESP32? #571

Closed askiin35 closed 1 year ago

askiin35 commented 1 year ago

How should I proceed to keep the device running continuously in case of freezing or crashing? When I use watchdog, my device is constantly reset in the portal section. I am using the latest autoconnect version.

Hieromon commented 1 year ago

If you have set a WDT to detect freezes at the application layer, but the timer cannot be reset when the application enters the AutoConnect::begin captive portal loop. You can use the whileCaptiveportal exit according to such a scene. Also, like the captive portal loop, AutoConnect::begin waits for a WiFi connection after WiFi.begin, so the timer must be reset at this time as well. You can use the techniques discussed here for that.

These techniques are limited to cases involving while loops with waiting for a WiFi connection. But there are other normal situations in which the timer cannot be reset. In situations where the WiFi signal is weak, it may take hundreds of milliseconds for lwIP to fully receive the packet, and several seconds for the HTTP response to complete. In this case, the application layer cannot reset the timer. Maybe you'll have to find a way to make full use of the WebServer library to reset the timer.

This topic will be continued in Discussions.