Page 1 of 1
ESP32 reset by software!
Posted: Sun Jan 15, 2023 8:12 pm
by jgu1
Hi!
Is it possible to hardreset the software the ESP32 by help of a C command, pls

If it is possible, is it then nessesary to add something in "Supplementary code"
Br Jorgen
Re: ESP32 reset by software!
Posted: Sun Jan 15, 2023 8:21 pm
by mnfisher
Re: ESP32 reset by software!
Posted: Sun Jan 15, 2023 8:30 pm
by jgu1
Hi Martin!
I already try your suggest, But then i get error when I compile?
I give it a new go tomorrow again.
Thank youvery much.
Jorgen
Re: ESP32 reset by software!
Posted: Sun Jan 15, 2023 8:39 pm
by mnfisher
Seems to work okay...
A simple program - just waits 5s then restarts and does it all again...
Martin
Re: ESP32 reset by software!
Posted: Mon Jan 16, 2023 3:50 pm
by jgu1
Hi Martin!
Work´s now, thank you
Jorgen
Re: ESP32 reset by software!
Posted: Mon Jan 16, 2023 9:22 pm
by mnfisher
Glad to hear it works okay.
Gave me an idea to do an utility component for esp32 with some of these type 'commands' in it.
I did a small trial:
Restart() - restart the MCU
RegisterShutdownHandler(addr of macro) - macro to be called before restart (see demo)
UnRegisterShudownHandler(addr of macro) - unregister a shutdownhandler
GetRestartReason() - 1 is power on, 3 is Restart() called (there are others though I didn't look them up)
GetFreeHeapSize() - get some memory stats
GetMinimumHeapSize()
GetFreeInternalHeapSize()
Need to add the fcpx file to component directory (Global Options->Locations->Search For Components in)
Demo - is very simple and just displays the values from each routine. - then uses a ShutDownHandler to do a 5s countdown to a restart...
Any ideas on 'useful' macros (I just used a handful from the link above)
Martin