Refactorisé/simplifié le cron et remis le get_power. Maintenant l'appli est complète et il me reste 18kB de RAM !

This commit is contained in:
Christian Zufferey
2020-06-16 16:41:45 +02:00
parent 0a3d430f36
commit 8fb0c9a1db
2 changed files with 10 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
-- Petit script pour faire office de crontab pour les mesures
print("\n 0_cron.lua zf200615.1934 \n")
print("\n 0_cron.lua zf200616.1638 \n")
cron1=tmr.create()
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
@@ -8,7 +8,7 @@ cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
-- http_post(influxdb_url,"energy,value=test1_"..yellow_id.." val=1")
http_post(influxdb_url,"energy,memory=cron1_"..yellow_id.." ram="..node.heap())
-- http_post(influxdb_url,"energy,memory=cron1_"..yellow_id.." ram="..node.heap())
-- if yellow_id == 60 then http_post(influxdb_url,"energy,compteur=3 puissance="..zpower/1000) end
if yellow_id == 64 then http_post(influxdb_url,"energy,compteur=4 puissance="..zpower/1000) end
@@ -19,23 +19,15 @@ cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
-- f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
f=nil
-- f=nil
if verbose then print("End cron:") end
collectgarbage()
if verbose then print(node.heap()) end
end)
--[[
cron1:stop()
cron1:start()
sec, usec = rtctime.get()
print(sec,usec)
print(ztime_format(rtctime.get()))
]]

View File

@@ -1,7 +1,7 @@
-- Scripts à charger après le boot pour démarrer son projet
function boot()
print("\n boot.lua zf200616.1613 \n")
print("\n boot.lua zf200616.1637 \n")
print("On lance le boot...")
collectgarbage() print(node.heap())
local f
@@ -20,11 +20,11 @@ function boot()
collectgarbage() print(node.heap())
zpower=0
-- f="0_get_power.lua" if file.exists(f) then dofile(f) end
-- collectgarbage() print(node.heap())
--
-- f="0_cron.lua" if file.exists(f) then dofile(f) end
-- collectgarbage() print(node.heap())
f="0_get_power.lua" if file.exists(f) then dofile(f) end
collectgarbage() print(node.heap())
f="0_cron.lua" if file.exists(f) then dofile(f) end
collectgarbage() print(node.heap())
verbose = false
print("verbose: ",verbose,"\nle boot est lancé...")