1-capture / display tmr value = print#1 436 us
2- tmr.alarm issued print#2 noda
3 print#3 noda
4 start for loop print #4 2005 us
5 end for loop print #5 7.5+ seconds
6 print chip info, flash info,heap info, ip=nil, start server
#6 occurs way before it should
# 2 finally prints time 7.8+ seconds
# 2 keeps trying connect and time reflects this
#3 - #2 ends at 10+ seconds
The intent is to start the wifi connection
Wait for connection to get IP
print chip info, flash info, ip info, start server
As can be seen results are no where close to this..
Why does #2 from tmr.alarm occur 7.5 seconds after being issued
I'm totally bamboozled by the way this is working , CAN ANY BODY GIVE A VALID EXPLANATION...
wifi info printed
wifiConfig.ssid = "12345NETGEAR" -- Name of the WiFi network you want to join
wifiConfig.pwd = "mikeis12345" -- Password for the WiFi network
wifi.setmode(wifi.STATION) -- Set station mode
y=tmr.now()
print("1--->",(tmr.now()-y))
tmr.alarm(0, 1000, 1, function()
print("2--->",(tmr.now()-y))
print("Try Connecting:")
ip, nm, gw=wifi.sta.getip()
if ip ~= nil then
print("3--->",(tmr.now()-y))
print("\nIP Info: \nIP Address: ",ip,"\n Netmask: ",nm,"\n Gateway: ",gw)
tmr.stop(0)
end
end)
print("4--->",(tmr.now()-y))
for x=1,22000 do
if x==2000 or x==4000 or x==6000 or x==8000 or x==10000 then
tmr.wdclr()
print("w-",x)
end
if x==12000 or x==14000 or x==16000 or x==18000 or x==20000 then
tmr.wdclr()
print("w-",x)
end
if ip ~= ip then break end
if x == 21000 then break end
end
print("5--->",(tmr.now()-y))
print('chip : ',node.chipid())
print('Flash: ',node.flashid())
wifiConfig = nil -- End WiFi configuration
collectgarbage()
print('heap : ',node.heap())
print("gotIP",wifi.sta.getip())
dofile("httpserver.lc")(80)
NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4
1---> 436
4---> 2005
w- 2000
w- 4000
w- 6000
w- 8000
w- 10000
w- 12000
w- 14000
w- 16000
w- 18000
w- 20000
5---> 7558411
chip : 14695596
Flash: 1458400
heap : 26488
gotIP nil
lua: cannot open httpserver.lc
2---> 7839525
Try Connecting:
2---> 7845113
Try Connecting:
2---> 7849726
Try Connecting:
2---> 7854323
Try Connecting:
2---> 7868942
Try Connecting:
2---> 7902283
Try Connecting:
2---> 7935728
Try Connecting:
> 2---> 8002244
Try Connecting:
2---> 9002323
Try Connecting:
2---> 10002838
Try Connecting:
3---> 10009704
IP Info:
IP Address: 192.168.1.32
Netmask: 255.255.255.0
Gateway: 192.168.1.1