Temperature is calcualted, only once
This commit is contained in:
parent
7cf761c7a5
commit
d6d305ec70
5
main.lua
5
main.lua
@ -48,11 +48,6 @@ function displayTime()
|
||||
words.briPer=nil
|
||||
end
|
||||
end
|
||||
local tw=nil
|
||||
local tcol=nil
|
||||
if (mqttDispTemp ~= nil) then
|
||||
tw, tcol = wc.temp(dw, rgbBuffer, invertRows)
|
||||
end
|
||||
wc = nil
|
||||
collectgarbage()
|
||||
print("wc: " .. tostring(node.heap()))
|
||||
|
18
mqtt.lua
18
mqtt.lua
@ -3,7 +3,8 @@ local m=nil
|
||||
local mqttConnected = false
|
||||
-- Temp:
|
||||
local t=nil
|
||||
dispTemp=nil
|
||||
local tw=nil
|
||||
local tcol=nil
|
||||
|
||||
function handleSingleCommand(client, topic, data)
|
||||
if (data == "ON") then
|
||||
@ -118,9 +119,20 @@ function registerMqtt()
|
||||
handleSingleCommand(client, topic, data)
|
||||
elseif (topic == (mqttPrefix .. "/cmd/temp")) then
|
||||
if ( data == "" ) then
|
||||
dispTemp = nil
|
||||
tw=nil
|
||||
tcol=nil
|
||||
else
|
||||
dispTemp = tonumber(data)
|
||||
-- generate the temperatur to display, once as it will not change
|
||||
local dispTemp = tonumber(data)
|
||||
collectgarbage()
|
||||
mydofile("wordclock")
|
||||
if (wc ~= nil) then
|
||||
tw, tcol = wc.temp(dw, rgbBuffer, invertRows)
|
||||
wc = nil
|
||||
else
|
||||
print("MQTT | wordclock failed")
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
-- Handle here the /cmd/# sublevel
|
||||
|
Loading…
Reference in New Issue
Block a user