Chat freely about anything...

User avatar
By Rob.Binet
#57338 Hi,
I have a software function that takes at least 3 seconds, so when entering this function, the ESP crashes for watchdog time-out ( it look that the software watchdog is set to 2 seconds).
For the time being, I can skip this issue by using:
ESP.wdtEnable(value);
before calling this function.
(see example below)
Now any time value will work (even 0) so I can't fine tune this value to fit my environment
If I use the at setup; ESP.wdtEnable(value) it has no effect.
If I use ESP.wdtDisable(); at setup my function crashes immediately
If have also used different combinations of ESP.wdtFeed(), without results
So the question:
Is there a description or guidelines how to safely use the functions:
ESP.wdtDisable();
ESP.wdtEnable();
ESP.wdtFeed();
Thanks in advance
Robert
Code: Select allvoid myFunction ()
{
long TIMEOUT = 3000;
long now = millis(); 
while ((millis()-now<TIMEOUT))
  {
  }
}


is solved by:

Code: Select allvoid myFunction ()
{
ESP.wdtEnable(0);
long TIMEOUT = 3000;
long now = millis(); 
while ((millis()-now<TIMEOUT))
  {
  }
}
User avatar
By Rob.Binet
#57377 Yes yield() or delay(0) is the solution, I also read a good explanation at:
https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/using-the-arduino-addon
However the ESP.wdtxxx usage still mysterious, and may deserve some documentation.
Thanks again for you fast reply
Robert