From 0857eb0e3c05684937ba484da7684f52bffc3fba Mon Sep 17 00:00:00 2001 From: Ollo Date: Tue, 9 Feb 2021 20:18:24 +0100 Subject: [PATCH] tweaked timings --- main.lua | 6 +++--- mqtt.lua | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 2b330c9..1f04a16 100644 --- a/main.lua +++ b/main.lua @@ -10,7 +10,6 @@ function syncTimeFromInternet() sntp.sync(sntpserverhostname, function(sec,usec,server) print('sync', sec, usec, server) - displayTime() syncRunning=nil end, function() @@ -23,6 +22,7 @@ end briPercent = 50 function displayTime() + collectgarbage() local sec, usec = rtctime.get() -- Handle lazy programmer: if (timezoneoffset == nil) then @@ -135,7 +135,7 @@ function normalOperation() local setupCounter=5 local alive=0 - looptimer:register(1000, tmr.ALARM_AUTO, function (lt) + looptimer:register(2500, tmr.ALARM_AUTO, function (lt) if (setupCounter > 4) then syncTimeFromInternet() setupCounter=setupCounter-1 @@ -155,7 +155,7 @@ function normalOperation() displayTime() end setupCounter=setupCounter-1 - elseif ( (alive % 300) == 0) then + elseif ( (alive % 120) == 0) then -- sync the time every 5 minutes syncTimeFromInternet() alive = alive + 1 diff --git a/mqtt.lua b/mqtt.lua index 9784fe2..6cbadea 100644 --- a/mqtt.lua +++ b/mqtt.lua @@ -158,7 +158,6 @@ function startMqttClient() local temp = nil if (t ~= nil) then temp=readTemp() - print(tostring(temp) .. "°C") end if (oldBrightness ~= briPercent) then m:publish(mqttPrefix .. "/brightness", tostring(briPercent), 0, 0)