Page 1 of 1

[SOLVED] I'm wondering if the ESP32 can call a method right before it crashes

Posted: Wed Jun 12, 2019 10:32 am
by GeorgeFlorian1
Hello !

I am playing around with me-no-dev's ESPAsyncWebServer library and it doesn't work all the time.
If the ESP crashes for some reason, there's a chance that the WebServer will not work on the next boot, so I have to manually reset by pressing the EN Button.

That's why I was wondering if I can insert a server.reset() right before any ESP crash, hardware reset, software reset.

In case of a hardware reset, pressing EN Button pretty much fixes everything that went wrong in the previous iteration, like heap memory.
Also, it's easy to write server.reset() before ESP.restart().

But I have no idea what to do when it crashes.

Any thoughts ?
Thank you !

Re: I'm wondering if the ESP32 can call a method right before it crashes

Posted: Wed Jun 12, 2019 10:48 am
by ESP_Sprite
No. A crash per definition means the execution environment is unstable. If the ESP32 could happily continue running, there would be no reason for it to crash/reboot.

Re: I'm wondering if the ESP32 can call a method right before it crashes

Posted: Thu Jun 13, 2019 9:22 am
by GeorgeFlorian1
ESP_Sprite wrote:
Wed Jun 12, 2019 10:48 am
No. A crash per definition means the execution environment is unstable. If the ESP32 could happily continue running, there would be no reason for it to crash/reboot.
I thought so. Thank you !

Re: [SOLVED] I'm wondering if the ESP32 can call a method right before it crashes

Posted: Thu Jun 13, 2019 3:48 pm
by chegewara
Probably its not what you are looking for, but in freertos you have stack overflow hook, which can be called right before crash (in 1 particualr case):
https://www.freertos.org/Stacks-and-sta ... cking.html