Current Lua downloadable firmware will be posted here

User avatar
By gerardwr
#2835
Hans174 wrote:
Code: Select all
for i=1,1000,1 do print(i) end



leads to a hardware reset after 400 to 600 counts.


Yep, same here! Checked the heap space in the loop but that seems fine, remains the same.
Code: Select all183:15280
184:15280
185:15280
'._..RS..Fj..fJS.f.
functions.lua executed
NodeMcu 0.9.2  powered by Lua 5.1.4
User avatar
By cendev
#2836
gerardwr wrote:
Hans174 wrote:
Code: Select all
for i=1,1000,1 do print(i) end



leads to a hardware reset after 400 to 600 counts.


Yep, same here! Checked the heap space in the loop but that seems fine, remains the same.
Code: Select all183:15280
184:15280
185:15280
'._..RS..Fj..fJS.f.
functions.lua executed
NodeMcu 0.9.2  powered by Lua 5.1.4


I must tell, that i'm kinda away from being good at this thing, but can it be caused by the baud 9600 and buffer to print? i mean can u try doin it with a maybe a 10ms delays? Still the same result? (i know , it wont go for the next until the first printing is completed but ?? :D )
User avatar
By zeroday
#2839
Hans174 wrote:Hello,

I just flashed the latest version (18. Nov.).
But like the version before this line

Code: Select all
for i=1,1000,1 do print(i) end



leads to a hardware reset after 400 to 600 counts.

Is there a hint why this happens? Could it be the watchdog of the ESP8266?

Hans


Yes, same thing happens here, don't know why yet.
if I change the baud-rate to higher speed, it will output more, to cover 1000 output.
but
Code: Select allfor i=1,10000 do print(i) end
still cause reset.
and a forever loop
Code: Select alli=0 while(1) do i=i+1 end
also cause reset.

tmr.delay(10000) will cause even less output.

so, this may be because of system clock or watchdog or something related to time.
have no clue to solve it.

for now tmr.alarm(interval, 1, function do()) is recommended to do repeat job.
User avatar
By zeroday
#2840 Here is a example for node.output, node.input api.
Code: Select all-- a simple telnet server
s=net.createServer(net.TCP)
s:listen(2323,function(c)
   con_std = c
   function s_output(str)
      if(con_std~=nil)
         then con_std:send(str)
      end
   end
   node.output(s_output, 0) -- re-direct output to function s_ouput.
   c:on("receive",function(c,l)
      node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line
   end)
   c:on("disconnection",function(c)
      con_std = nil
      node.output(nil)  -- un-regist the redirect output function, output goes to serial
   end)
end)