diff --git a/Mesures/level/level_ruru_1/0_cron.lua b/Mesures/level/level_ruru_1/0_cron.lua index 7c384c7..32cf479 100644 --- a/Mesures/level/level_ruru_1/0_cron.lua +++ b/Mesures/level/level_ruru_1/0_cron.lua @@ -1,8 +1,8 @@ -- Petit script pour faire office de crontab pour les mesures -print("\n 0_cron.lua zf200621.1922 \n") +print("\n 0_cron.lua zf200625.1159 \n") cron1=tmr.create() -cron1:alarm(10*1000, tmr.ALARM_AUTO, function() +cron1:alarm(2.5*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 @@ -18,7 +18,7 @@ cron1:alarm(10*1000, tmr.ALARM_AUTO, function() -- if yellow_id == 64 then http_post(influxdb_url,"energy,compteur=4 puissance="..zpower/1000) end - -- if yellow_id == 69 then http_post(influxdb_url,"bolo_ruru,capteur="..node_id.." hauteur="..zlength) end + if yellow_id == 69 then http_post(influxdb_url,"bolo_ruru,capteur="..node_id.." hauteur="..zlength) end diff --git a/Mesures/level/level_ruru_1/0_http_post.lua b/Mesures/level/level_ruru_1/0_http_post.lua index bd0f922..7f847bc 100644 --- a/Mesures/level/level_ruru_1/0_http_post.lua +++ b/Mesures/level/level_ruru_1/0_http_post.lua @@ -1,7 +1,7 @@ -- 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 zf200621.2320 \n") end +if verbose then print("\n 0_http_post.lua zf200625.1137 \n") end t_zurl={} t_zarg={} f_zpost=false @@ -12,15 +12,15 @@ t_zurl={} t_zarg={} f_zpost=false function zpost() f_zpost=true local zurl=t_zurl[1] local zarg=t_zarg[1] -- zarg=zarg.."\n".."energy,value=nb_waiting_"..yellow_id.." val="..#t_zurl - zarg=zarg.."\n".."energy,memory=zpost_"..yellow_id.." ram="..node.heap() - -- if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end +-- zarg=zarg.."\n".."energy,memory=zpost_"..yellow_id.." ram="..node.heap() + if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end http.post(zurl, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data) if (code < 0) then print("HTTP request failed") print("zuzu", code, data) if debug_rec~=nil then debug_rec("HTTP request failed: ", code, data) end else - -- if verbose then print(code, data) end + if verbose then print(code, data) end end table.remove(t_zurl, 1) table.remove(t_zarg, 1) if t_zurl[1]==nil then diff --git a/Mesures/level/level_ruru_1/0_tst5_socat.lua b/Mesures/level/level_ruru_1/0_tst5_socat.lua index 27997db..95ad807 100644 --- a/Mesures/level/level_ruru_1/0_tst5_socat.lua +++ b/Mesures/level/level_ruru_1/0_tst5_socat.lua @@ -26,20 +26,20 @@ ou sur MAC telnet -rN localhost 23000 ]] -print("\n 0_tst5_socat.lua zf200621.2330 \n") +print("\n 0_tst5_socat.lua zf200625.1204 \n") function rt_connect() - print("................rt_connect") + -- print("................rt_connect") collectgarbage() local zlaps=tmr.now()/1000000-ztime_connect - print("time of retry connect... "..zlaps) + -- print("time of retry connect... "..zlaps) -- if debug_rec~=nil then debug_rec("time of retry connect... "..zlaps..", "..node.heap()) end if zlaps>1 then local zstr="trying connect to "..console_host..":"..console_port..", "..node.heap() -- if debug_rec~=nil then debug_rec(zstr) end if verbose==verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) - print(zstr) + -- print(zstr) end if http_post~=nil then http_post(influxdb_url,"energy,memory=socat_try_con_"..yellow_id.." ram="..node.heap()) end ztime_connect=tmr.now()/1000000 @@ -63,7 +63,7 @@ function rt_connect() end) srv_rt:on("reconnection", function(sck) - print(";;;;;;;;;;;;;;;;reconnection") + -- print(";;;;;;;;;;;;;;;;reconnection") srv_rt:on("connection", nil) srv_rt:on("reconnection", nil) end) @@ -92,7 +92,7 @@ end function rt_launch() - if http_post~=nil then http_post(influxdb_url,"energy,memory=tmr_socat1_"..yellow_id.." ram="..node.heap()) end + -- if http_post~=nil then http_post(influxdb_url,"energy,memory=tmr_socat1_"..yellow_id.." ram="..node.heap()) end if srv_rt~=nil then -- if http_post~=nil then http_post(influxdb_url,"energy,memory=srv_rt_no_nil_"..yellow_id.." ram="..node.heap()) end if console_port ~= srv_rt:getpeer() then @@ -104,8 +104,8 @@ function rt_launch() end --- tmr_socat1=tmr.create() --- tmr_socat1:alarm(15*1000, tmr.ALARM_AUTO , rt_launch) +tmr_socat1=tmr.create() +tmr_socat1:alarm(10*1000, tmr.ALARM_AUTO , rt_launch) ztime_connect=tmr.now()/1000000-10 diff --git a/Mesures/level/level_ruru_1/_zremote_cmd.txt b/Mesures/level/level_ruru_1/_zremote_cmd.txt index a58f82d..98c2d88 100644 --- a/Mesures/level/level_ruru_1/_zremote_cmd.txt +++ b/Mesures/level/level_ruru_1/_zremote_cmd.txt @@ -1,5 +1,5 @@ # Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom -# zf200624.1854 +# zf200625.1133 Todo à faire pour ce projet ! @@ -39,13 +39,13 @@ for k,v in pairs(_G) do print(k,v) end ################################ # pour les tests en direct sur la gateway ssh ubuntu@www.zuzu-test.ml -socat TCP-LISTEN:23064,fork,reuseaddr STDIO +socat TCP-LISTEN:23069,fork,reuseaddr STDIO ################################ # pour les tests en remote killall -9 ssh ssh ubuntu@www.zuzu-test.ml killall -9 socat -ssh ubuntu@www.zuzu-test.ml socat TCP-LISTEN:23064,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 & +ssh ubuntu@www.zuzu-test.ml socat TCP-LISTEN:23069,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 & # SHIFT+CMD+K SHIFT+CMD+K ALT+CMD+F watch -n 1 'ssh ubuntu@www.zuzu-test.ml netstat -nat |grep 230' diff --git a/Mesures/level/level_ruru_1/boot.lua b/Mesures/level/level_ruru_1/boot.lua index 3ab146a..9297b7a 100644 --- a/Mesures/level/level_ruru_1/boot.lua +++ b/Mesures/level/level_ruru_1/boot.lua @@ -1,7 +1,7 @@ -- Scripts à charger après le boot pour démarrer son projet function boot() - print("\n boot.lua zf200621.1939 \n") + print("\n boot.lua zf200625.1205 \n") print("On lance le boot...") collectgarbage() print(node.heap()) local f @@ -19,8 +19,7 @@ function boot() f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end collectgarbage() print(node.heap()) - zpower=0 - f="0_get_power.lua" if file.exists(f) then dofile(f) end + f="0_ultra_son.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