Clear Memory, and try next time again
This commit is contained in:
parent
8bc3b0cb66
commit
b8f037d61c
8
mqtt.lua
8
mqtt.lua
@ -206,7 +206,7 @@ function startMqttClient()
|
|||||||
dstimer:register(123, tmr.ALARM_SINGLE, function (kTemp)
|
dstimer:register(123, tmr.ALARM_SINGLE, function (kTemp)
|
||||||
if (file.open("ds18b20_diet.lc")) then
|
if (file.open("ds18b20_diet.lc")) then
|
||||||
t=true
|
t=true
|
||||||
print "Setup temperature"
|
print "Setup temperatur"
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
dstimer:start()
|
dstimer:start()
|
||||||
@ -226,14 +226,16 @@ function startMqttClient()
|
|||||||
ds18b20.setup(2) -- GPIO4
|
ds18b20.setup(2) -- GPIO4
|
||||||
readTemp(ds18b20) -- read once, to setup chip
|
readTemp(ds18b20) -- read once, to setup chip
|
||||||
temperatur=readTemp(ds18b20)
|
temperatur=readTemp(ds18b20)
|
||||||
if (temperatur == 85) then
|
if (temperatur == 8500) then
|
||||||
temperatur=nil
|
temperatur=nil
|
||||||
end
|
end
|
||||||
ds18b20=nil
|
ds18b20=nil
|
||||||
|
else
|
||||||
|
collectgarbage()
|
||||||
end
|
end
|
||||||
if (temperatur ~= nil and temperatur ~= oldTemp) then
|
if (temperatur ~= nil and temperatur ~= oldTemp) then
|
||||||
oldTemp = temperatur
|
oldTemp = temperatur
|
||||||
m:publish(mqttPrefix .. "/temp", tostring(temperatur/100).."."..tostring(temperatur%100), 0, 0)
|
m:publish(mqttPrefix .. "/temp", tostring(temperatur/100)..".".. tostring(temperatur%100), 0, 0)
|
||||||
else
|
else
|
||||||
m:publish(mqttPrefix .. "/heap", tostring(heapusage), 0, 0)
|
m:publish(mqttPrefix .. "/heap", tostring(heapusage), 0, 0)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user