Page 1 of 1

ESP8266 reboot report

Posted: Sun Sep 17, 2023 5:49 pm
by arjen1
Dear forum

Got an ESP8266 running measuring my Energy consumption and solar panels yield. Got it running for a few years already. Now and then, maybe twice a day, it reboots. This was not the case in the beginning it would run for days, even months. I'd like to investigate the cause of the error.

I cannot 'wait' for hours to watch this to occur and then read the serial output. Is there a way to store the reboot report so I can read that at my convenience?

An example of such a function is highly appreciated.

Thanks.

Re: ESP8266 reboot report

Posted: Tue Sep 19, 2023 6:01 pm
by bobtidey
ESP.getResetReason().c_str() will return a string with reason for last reset

rst_info *resetInfo;
resetInfo = ESP.getResetInfoPtr();

will give you access to the rst_info structure which has more detail

Check out https://www.esp8266.com/viewtopic.php?p=26862

From either of those you could store the data in a file if you have the filing system set up.

Re: ESP8266 reboot report

Posted: Wed Sep 20, 2023 10:07 am
by arjen1
Thanks. I'll try that.