From c9e67324d95d5c680123ffd58b01b563e56d546d Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Mon, 25 May 2020 15:42:57 +0200 Subject: [PATCH] Ca marchotte mais je suis beaucoup trop tangent quand je mets le socat, 1x sur 3, pas assez de ram :-( --- Mesures/humidity/solar-grafana/0_cron.lua | 16 +++-------- .../humidity/solar-grafana/0_http_post.lua | 6 ++++- .../humidity/solar-grafana/0_tst3_socat.lua | 4 +-- Mesures/humidity/solar-grafana/boot.lua | 27 ++++++++----------- 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/Mesures/humidity/solar-grafana/0_cron.lua b/Mesures/humidity/solar-grafana/0_cron.lua index 9d53463..4776fd9 100644 --- a/Mesures/humidity/solar-grafana/0_cron.lua +++ b/Mesures/humidity/solar-grafana/0_cron.lua @@ -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() diff --git a/Mesures/humidity/solar-grafana/0_http_post.lua b/Mesures/humidity/solar-grafana/0_http_post.lua index f6509b5..0798d35 100644 --- a/Mesures/humidity/solar-grafana/0_http_post.lua +++ b/Mesures/humidity/solar-grafana/0_http_post.lua @@ -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 diff --git a/Mesures/humidity/solar-grafana/0_tst3_socat.lua b/Mesures/humidity/solar-grafana/0_tst3_socat.lua index ac1df40..718d4d1 100644 --- a/Mesures/humidity/solar-grafana/0_tst3_socat.lua +++ b/Mesures/humidity/solar-grafana/0_tst3_socat.lua @@ -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 diff --git a/Mesures/humidity/solar-grafana/boot.lua b/Mesures/humidity/solar-grafana/boot.lua index d1593c5..d3bbc4d 100644 --- a/Mesures/humidity/solar-grafana/boot.lua +++ b/Mesures/humidity/solar-grafana/boot.lua @@ -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()