I expected to see TMR0,1,2,3,4,5 in that sequence .
I'm seeing TMR0,4,5,1,2,3 . my dofile is loading too early
How can I fix it? Code and results listed below..
print("TMR0 "..tmr.now())
if "a" == "a" then
local ip, nm, gw
local tmx
tmr.alarm (1, 1000, 1, function ( )
print("TMR1 "..tmr.now())
ip, nm, gw = wifi.sta.getip()
if ip == nil then
print ("Wait Connection")
else
tmr.stop (1)
print ("Mode= "..wifi.getmode(),tmr.now())
print ("MAC " .. wifi.ap.getmac ( ))
print (" IP: "..ip.."\n NM: "..nm.."\n GW: "..gw)
tmx =tmr.now()+10000000 -- 10 sec
print("TMR2 "..tmr.now())
while (tmx > tmr.now()) do -- loop for 10 seconds
tmr.wdclr()
end
print("TMR3 "..tmr.now())
end
end)
end
print("TMR4 "..tmr.now())
collectgarbage()
print('dofile',tmr.now())
print("TMR5 "..tmr.now())
if (not not wifi.sta.getip()) or (not not wifi.ap.getip()) then
dofile("httpserver.lc")(80)
end
RESULTS---------------------------------------------------------------------------------
dofile('oinit.lua')
set (mode=3)
AP MAC: 5e:cf:7f:01:21:90
Client MAC: 5c:cf:7f:01:21:90
chip: 74128
heap: 18904
TMR0 1629091445
TMR4 1629102700
dofile 1629109011
TMR5 1629113074
cannot open httpserver.lc
> TMR1 1630102848
Wait Connection
TMR1 1631103061
Wait Connection
TMR1 1632102885
Wait Connection
TMR1 1633102840
Mode= 3 1633113765
MAC 5e:cf:7f:01:21:90
IP: 192.168.1.35
NM: 255.255.255.0
GW: 192.168.1.1
TMR2 1633127319
TMR3 1643127464