Current Lua downloadable firmware will be posted here

User avatar
By gerardwr
#2929
scargill wrote:I REALLY thought I'd cracked this - but the timer just keeps on ticking.... I can inject tmr.stop() via serial but as shown here as part of the setup... it doesn't stop.... just keeps repeating. Thoughts, anyone.

file.remove("init.lua")
file.open("init.lua","w")
file.writeline([[print("Petes Tester 4")]])
file.writeline([[tmr.alarm(5000, 0, function() dofile("thelot.lua") end )]])
file.close()


I use a similar approach, but I execute the file with my lua functions directly with dofile, so NO timer. Works for me.
init.lua just contains:
Code: Select alldofile("functions.lua")
print("functions.lua executed")


Bootlog:
Code: Select all> file.list()
  init.lua size:56
  functions.lua size:1522
> node.restart()
c_..RS.fJ..fJS.f.
functions.lua executed
NodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
>


Not sure if this helps!?
User avatar
By gerardwr
#2932
scargill wrote:file.writeline([[tmr.delay(500000)]])

Either way this FAILS and the unit ends up in a loop - Am I right in guessing this is some kind of WATCHDOG issue?


I see something peculiar with tmr.delay. If I want to delay for a number of seconds, AFTER the tmr.delay expires, the ESP is often reset. Mind you, not always. A delay of 1 sec (1000000 usec) is OK, a delay of 3 sec (3000000 usec) sometimes OK, but not always. See the log below. WDT issue?
Code: Select all> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(3000000)
c_..RS.fJS.fJS.f.
functions.lua executed
NodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
> tmr.delay(3000000)
c...RS.f.S.fJS.f.
functions.lua executed
NodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(1000000)
> tmr.delay(3000000)
> tmr.delay(3000000)
c_..R..fJS.fJS.f.
functions.lua executed
NodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
> tmr.delay(3000000)
> tmr.delay(3000000)
c_..RS.f
S.fJS.f.
functions.lua executed
NodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
>
User avatar
By Hans174
#2936 Hello,

Is there a problem with the watchdog?

This line (see also reports by other users)

Code: Select all tmr.delay(5000000)

leads to a hardware reset.

The watchdog in the 9.22 AT interface implementaion has two commands:

AT+CSYSWDTENABLE
AT+CSYSWDTDISABLE

Maybe the LUA implementation needs the enable/disable commands also.

Hans