Left here for archival purposes.

User avatar
By ohgary
#6209 Was working on my esp8266 with the lua code loaded and ran into an interesting issues. I am using rom NodeMcu 0.9.4 build 20141230 powered by Lua 5.1.4


The following program runs with no issues.


while 1 do
print("led on")
tmr.delay(2000000)
print("led off")
tmr.delay(2000000)
end

If I change the delay line tmr.delay(200000) the esp8266 seems to crash and restart.
Below is the esplorer push to chip and chip running along with the error.

> node.restart()

NodeMcu 0.9.4 build 20141230 powered by Lua 5.1.4
nil
>
while 1 do
print("led on")
>> tmr.delay(200000)
print("led off")
tmr.delay(200000)
>> end
led on
led off
led on
led off
led on
led off
led on
led off
led on
led off
led on
led off
NodeMcu 0.9.4 build 20141230 powered by Lua 5.1.4
nil
>
User avatar
By Quindor
#7139 The hardware timer has a watchdog function which will reset the ESP after a certain amount of hanging or in this case delaying (which hangs everything).

You can try and issue a watchdog reset between the delays, but it's a patch stop at best. I think you can work around it with an alarm trigger loop. Take a look at my code, it should provide you with a solution!

http://www.esp8266.com/viewtopic.php?f=24&t=1021&p=5645#p5645