Different loop cycles
This commit is contained in:
parent
7e7a87f90a
commit
efe5b38e58
2
main.lua
2
main.lua
@ -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)
|
||||||
|
5
mqtt.lua
5
mqtt.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user