Reduced necessary memory
This commit is contained in:
parent
3b2554ee53
commit
5703c27576
6
mqtt.lua
6
mqtt.lua
@ -122,7 +122,7 @@ function registerMqtt()
|
|||||||
collectgarbage()
|
collectgarbage()
|
||||||
if data ~= nil then
|
if data ~= nil then
|
||||||
local heapusage = node.heap()
|
local heapusage = node.heap()
|
||||||
if (heapusage < 12000) then
|
if (heapusage < 11000) then
|
||||||
print("Skip " .. topic .. ":" .. data .. "; heap:" .. heapusage)
|
print("Skip " .. topic .. ":" .. data .. "; heap:" .. heapusage)
|
||||||
heapusage=nil
|
heapusage=nil
|
||||||
return
|
return
|
||||||
@ -236,7 +236,7 @@ function startMqttClient()
|
|||||||
mMqttClient:publish(mqttPrefix .. "/brightness", tostring(briPer), 0, 0)
|
mMqttClient:publish(mqttPrefix .. "/brightness", tostring(briPer), 0, 0)
|
||||||
loldBrightness = briPer
|
loldBrightness = briPer
|
||||||
else
|
else
|
||||||
if ((t ~= nil) and (heapusage > 12000)) then
|
if ((t ~= nil) and (heapusage > 11900)) then
|
||||||
local ds18b20=require("ds18b20_diet")
|
local ds18b20=require("ds18b20_diet")
|
||||||
ds18b20.setup(2) -- GPIO4
|
ds18b20.setup(2) -- GPIO4
|
||||||
readTemp(ds18b20) -- read once, to setup chip
|
readTemp(ds18b20) -- read once, to setup chip
|
||||||
@ -245,7 +245,7 @@ function startMqttClient()
|
|||||||
temperatur=nil
|
temperatur=nil
|
||||||
end
|
end
|
||||||
ds18b20=nil
|
ds18b20=nil
|
||||||
else
|
else
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
end
|
end
|
||||||
if (temperatur ~= nil and temperatur ~= mOldTemp) then
|
if (temperatur ~= nil and temperatur ~= mOldTemp) then
|
||||||
|
Loading…
Reference in New Issue
Block a user