one thing that make me confused is how the microcontroller notice the errors and restart by itself
let me give an example
we have cooler system with Esp 32 and temperature sensor,when temperature be Above 25 centigrade degrees cooler will work until temperature reduce to 25 degree .
all the thing will work in the loop .
for example after 1 week of work errors come to esp , how is possible that Esp notice the error and restart automatically for fixing the error .
It sounds like your processor is resetting due to the Watch Dog Timer (WDT). Google ESP WDT and see if there's a way to stop it. Or if the reset is caused by a particular function taking too long, maybe you can increase the time setting of the WDT.
Mike.
Edit, is there a way to log the heap size? Memory leaks can cause errors that take a long time to show up.
I think you've been confused by his 'unusual' English? (obviously not his first language) - his question isn't why the ESP is resetting (as it's not), it's how to make the ESP reset if an error occurs.
An obvious answer would be a watchdog timer - but it rather depends what's causing the issue, and where to reset the watchdog timer.
If you are programming with the arduino IDE, the number of milliseconds since startup can be monitored with millis() command. As in,
If millis() > 100000 {
ESP.restart();
}
the above will trigger a restart every 100 seconds. A much larger number can be used - google to check maximum. I remember it is about 7-weeks worth of milliseconds. I may be wrong.
If you are programming with the arduino IDE, the number of milliseconds since startup can be monitored with millis() command. As in,
If millis() > 100000 {
ESP.restart();
}
the above will trigger a restart every 100 seconds. A much larger number can be used - google to check maximum. I remember it is about 5 weeks worth of milliseconds. I may be wrong.