-->
Page 1 of 1

Simple loop causes crash

PostPosted: Fri Dec 12, 2014 2:41 am
by javiery
For example:

\0x02b\0xff\0x04\0x0c\0xfe9\0xca \0xfa5\0xcf$\0xff1\0xa6\0xff
NodeMcu 0.9.2 build 20141211 powered by Lua 5.1.4
lua: cannot open init.lua
> i=0
>
> repeat
>>
>> print(i)
>>
>> i=i+1
>>
>> until false
0
1
2
3
.
.
.
369
370
371
37>B\0xb7Q@i\0xff\0x9cE\0xe0\0xfe\0xf9\0x9a6z9\0xff
\0x12U\0xc2\0xfd@4\0x9c\0x85p\0xff\0xf9\0x9a8\0xffz9\0xff
NodeMcu 0.9.2 build 20141211 powered by Lua 5.1.4
lua: cannot open init.lua



And same with for:

\0x00\0x12`\0xff\0x04L\0xfe1\0xcf\0xa0\0xfc-\0x83\0x14\0xff9\0xa4
NodeMcu 0.9.2 build 20141211 powered by Lua 5.1.4
lua: cannot open init.lua
> for i=0,1000 do
>>
>> print(i)
>>
>> end
0
1
2
3
.
.
.
366
367
368
\0xb3\0x12\0xba\0x89\0xfa\0xa1\0x1c\0x9cEh\0xffzHJ\0xf1z9\0xff
\0x12\0xba\0x89\0xfa\0xa1\0x1c\0x9cEh\0xffzHJ\0xf1z9\0xff
\0xa8\0x98{\0xed@4\0xffz\0xa4\0x05\0xfc\0xf9\0x9a\0xb6\0xf9\0x84
NodeMcu 0.9.2 build 20141211 powered by Lua 5.1.4
lua: cannot open init.lua

Re: Simple loop causes crash

PostPosted: Fri Dec 12, 2014 3:11 am
by ThomasW
This is a known issue. The module has a watchdog-timer that reboots in these cases. If you really need
such tight loops, you have to put a tmr.wdclr() (see the tmr - api) inside the loop. Please note that all networking
activity is blocked during this time and you risk loosing wifi-connectivity if it takes too long...

Thomas

Re: Simple loop causes crash

PostPosted: Fri Dec 12, 2014 9:30 am
by javiery
Thanks for your answer, it was to me very clarifying.