From 92276aff2d50e4af9a44310d6de54b1f604eda85 Mon Sep 17 00:00:00 2001 From: Ollo Date: Tue, 9 Feb 2021 20:07:21 +0100 Subject: [PATCH] Less memory --- main.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.lua b/main.lua index 6b5a1aa..2b330c9 100644 --- a/main.lua +++ b/main.lua @@ -135,10 +135,11 @@ function normalOperation() local setupCounter=5 local alive=0 - looptimer:register(5000, tmr.ALARM_AUTO, function (lt) + looptimer:register(1000, tmr.ALARM_AUTO, function (lt) if (setupCounter > 4) then syncTimeFromInternet() setupCounter=setupCounter-1 + alive = 1 elseif (setupCounter > 3) then if (startMqttClient ~= nil) then startMqttClient() @@ -154,18 +155,17 @@ function normalOperation() displayTime() end setupCounter=setupCounter-1 - elseif ((alive % 60) == 0) then - -- sync the time every 5 minutes + elseif ( (alive % 300) == 0) then + -- sync the time every 5 minutes syncTimeFromInternet() - displayTime() - alive = alive + 1 + alive = alive + 1 else displayTime() - alive = alive + 1 + alive = alive + 1 end collectgarbage() - -- Feed the system watchdog. - tmr.wdclr() + -- Feed the system watchdog. + tmr.wdclr() end) looptimer:start()