Ca marchotte mais je suis beaucoup trop tangent quand je mets le socat, 1x sur 3, pas assez de ram :-(

This commit is contained in:
Christian Zufferey
2020-05-25 15:42:57 +02:00
parent 03a20c0921
commit c9e67324d9
4 changed files with 21 additions and 32 deletions

View File

@@ -1,22 +1,12 @@
-- Petit script pour faire office de crontab pour les mesures
print("\n 0_cron.lua zf200525.1402 \n")
function tprint(t)
for key,value in pairs(t) do
print(key, value)
end
end
ztemp1=20 zhum1=40 ztemp2=20 zhum2=40
print("\n 0_cron.lua zf200525.1520 \n")
cron1=tmr.create()
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
if verbose then print("cron1........................") end
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
http_post(influxdb_url,"energy,memory=cron1 ram="..node.heap())
http_post(influxdb_url,"energy,memory=cron1_"..yellow_id.." ram="..node.heap())
f = "0_1_htu21d.lua" if file.exists(f) then dofile(f) end
http_post(influxdb_url,"energy,capteur=th1 temperature="..ztemp1)
@@ -28,7 +18,7 @@ cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
ztemp1=nil zhum1=nil ztemp2=nil zhum2=nil
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
-- f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
if verbose then print("End cron:\n"..node.heap()) end
collectgarbage()

View File

@@ -1,10 +1,14 @@
-- Petit script pour envoyer en // es valeurs sur un serveur WEB (InfluxDB)
-- via un http POST à travers un FIFO
if verbose then print("\n 0_http_post.lua zf200525.1403 \n") end
if verbose then print("\n 0_http_post.lua zf200525.1412 \n") end
t_zurl={} t_zarg={} f_zpost=false
function tprint(t)
for key,value in pairs(t) do print(key, value) end
end
function zpost()
f_zpost=true zurl=t_zurl[1] zarg=t_zarg[1]
if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end

View File

@@ -27,7 +27,7 @@ telnet -rN localhost 23000
]]
print("\n 0_tst3_socat.lua zf200520.2007 \n")
print("\n 0_tst3_socat.lua zf200525.1528 \n")
local node, table, tmr, uwrite, tostring =
node, table, tmr, uart.write, tostring
@@ -152,7 +152,7 @@ function rt_connect()
end
tmr_socat1=tmr.create()
tmr_socat1:alarm(5*1000, tmr.ALARM_AUTO , function()
tmr_socat1:alarm(15*1000, tmr.ALARM_AUTO , function()
rt_retry=1
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end

View File

@@ -1,8 +1,8 @@
-- Scripts à charger après le boot pour démarrer son projet
print("\n boot.lua zf200525.1404 \n")
print("\n boot.lua zf200525.1539 \n")
function ztime_stamp() return tmr.now()/1000000 end
-- function ztime_stamp() return tmr.now()/1000000 end
function boot()
verbose = true
@@ -10,27 +10,22 @@ function boot()
print(node.heap()) collectgarbage() print(node.heap())
f = "0_http_post.lua" if file.exists(f) then dofile(f) end
print(node.heap()) collectgarbage() print(node.heap())
-- http_post(influxdb_url,"energy,memory=boot_"..yellow_id.." ram="..node.heap())
-- http_post(influxdb_url,"energy,memory=cron1 ram="..node.heap())
-- f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
print(node.heap()) collectgarbage() print(node.heap())
http_post(influxdb_url,"energy,memory=boot_"..yellow_id.." ram="..node.heap())
f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
print(node.heap()) collectgarbage() print(node.heap())
f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
-- f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
-- print(node.heap()) collectgarbage() print(node.heap())
-- f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
-- print(node.heap()) collectgarbage() print(node.heap())
f="0_cron.lua" if file.exists(f) then dofile(f) end
print(node.heap()) collectgarbage() print(node.heap())
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
print("verbose:",verbose)
print("boot lancé...")
print(node.heap()) collectgarbage() print(node.heap())
f=nil boot=nil
print(node.heap()) collectgarbage() print(node.heap())
end
boot()