Sync the time every 5 minutes from the internet
This commit is contained in:
parent
fe8817bfe6
commit
a2021fcb48
8
main.lua
8
main.lua
@ -154,6 +154,7 @@ function normalOperation()
|
|||||||
|
|
||||||
tmr.alarm(2, 500, 0 ,function()
|
tmr.alarm(2, 500, 0 ,function()
|
||||||
syncTimeFromInternet()
|
syncTimeFromInternet()
|
||||||
|
displayTime()
|
||||||
end)
|
end)
|
||||||
tmr.alarm(3, 2000, 0 ,function()
|
tmr.alarm(3, 2000, 0 ,function()
|
||||||
if (startTelnetServer ~= nil) then
|
if (startTelnetServer ~= nil) then
|
||||||
@ -162,13 +163,18 @@ function normalOperation()
|
|||||||
print("NO Telent found")
|
print("NO Telent found")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
displayTime()
|
|
||||||
-- Start the time Thread
|
-- Start the time Thread
|
||||||
tmr.alarm(1, 10000, 1 ,function()
|
tmr.alarm(1, 10000, 1 ,function()
|
||||||
displayTime()
|
displayTime()
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- sync the time every 5 minutes
|
||||||
|
tmr.alarm(4, 300000, 1 ,function()
|
||||||
|
syncTimeFromInternet()
|
||||||
|
displayTime()
|
||||||
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
-- when no wifi available, open an accesspoint and ask the user
|
-- when no wifi available, open an accesspoint and ask the user
|
||||||
if (connect_counter >= 60) then -- 300 is 30 sec in 100ms cycle
|
if (connect_counter >= 60) then -- 300 is 30 sec in 100ms cycle
|
||||||
|
Loading…
Reference in New Issue
Block a user