Less memory
This commit is contained in:
parent
0b9e96518f
commit
92276aff2d
16
main.lua
16
main.lua
@ -135,10 +135,11 @@ function normalOperation()
|
|||||||
|
|
||||||
local setupCounter=5
|
local setupCounter=5
|
||||||
local alive=0
|
local alive=0
|
||||||
looptimer:register(5000, tmr.ALARM_AUTO, function (lt)
|
looptimer:register(1000, tmr.ALARM_AUTO, function (lt)
|
||||||
if (setupCounter > 4) then
|
if (setupCounter > 4) then
|
||||||
syncTimeFromInternet()
|
syncTimeFromInternet()
|
||||||
setupCounter=setupCounter-1
|
setupCounter=setupCounter-1
|
||||||
|
alive = 1
|
||||||
elseif (setupCounter > 3) then
|
elseif (setupCounter > 3) then
|
||||||
if (startMqttClient ~= nil) then
|
if (startMqttClient ~= nil) then
|
||||||
startMqttClient()
|
startMqttClient()
|
||||||
@ -154,18 +155,17 @@ function normalOperation()
|
|||||||
displayTime()
|
displayTime()
|
||||||
end
|
end
|
||||||
setupCounter=setupCounter-1
|
setupCounter=setupCounter-1
|
||||||
elseif ((alive % 60) == 0) then
|
elseif ( (alive % 300) == 0) then
|
||||||
-- sync the time every 5 minutes
|
-- sync the time every 5 minutes
|
||||||
syncTimeFromInternet()
|
syncTimeFromInternet()
|
||||||
displayTime()
|
alive = alive + 1
|
||||||
alive = alive + 1
|
|
||||||
else
|
else
|
||||||
displayTime()
|
displayTime()
|
||||||
alive = alive + 1
|
alive = alive + 1
|
||||||
end
|
end
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
-- Feed the system watchdog.
|
-- Feed the system watchdog.
|
||||||
tmr.wdclr()
|
tmr.wdclr()
|
||||||
end)
|
end)
|
||||||
looptimer:start()
|
looptimer:start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user