Different loop cycles

This commit is contained in:
Ollo 2020-12-10 21:11:35 +01:00
parent 7e7a87f90a
commit efe5b38e58
2 changed files with 4 additions and 3 deletions

View File

@ -186,7 +186,7 @@ function normalOperation()
end) end)
-- sync the time every 5 minutes -- sync the time every 5 minutes
tmr.alarm(2, 300000, 1 ,function() tmr.alarm(2, 300003, 1 ,function()
syncTimeFromInternet() syncTimeFromInternet()
displayTime() displayTime()
end) end)

View File

@ -39,12 +39,13 @@ function startMqttClient()
startMqtt() startMqtt()
print "Started MQTT client" print "Started MQTT client"
oldBrightness=0 oldBrightness=0
tmr.alarm(5, 10000, 1 ,function() tmr.alarm(5, 5001, 1 ,function()
if (oldBrightness ~= briPercent) then if (oldBrightness ~= briPercent) then
m:publish(mqttPrefix .. "/brightness", tostring(briPercent), 0, 0) m:publish(mqttPrefix .. "/brightness", tostring(briPercent), 0, 0)
else
m:publish(mqttPrefix .. "/heap", tostring(node.heap()), 0, 0) m:publish(mqttPrefix .. "/heap", tostring(node.heap()), 0, 0)
end end
oldBrightness = briPercent oldBrightness = briPercent
end) end)
end end
end end