Dû corriger encore la partie élimination des mesures erronées (parasites)

This commit is contained in:
Christian Zufferey
2020-06-28 15:31:59 +02:00
parent d41b389e1b
commit 5ac0febdc9
4 changed files with 9 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
-- Petit script pour faire office de crontab pour les mesures
print("\n 0_cron.lua zf200628.1312 \n")
print("\n 0_cron.lua zf200628.1457 \n")
cron1=tmr.create()
cron1:alarm(3*1000, tmr.ALARM_AUTO, function()
cron1:alarm(15*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

View File

@@ -26,7 +26,7 @@ ou sur MAC
telnet -rN localhost 23000
]]
print("\n 0_tst5_socat.lua zf200625.1204 \n")
print("\n 0_tst5_socat.lua zf200628.1458 \n")
function rt_connect()
-- print("................rt_connect")
@@ -105,7 +105,7 @@ end
tmr_socat1=tmr.create()
tmr_socat1:alarm(10*1000, tmr.ALARM_AUTO , rt_launch)
tmr_socat1:alarm(20*1000, tmr.ALARM_AUTO , rt_launch)
ztime_connect=tmr.now()/1000000-10

View File

@@ -1,14 +1,14 @@
-- Mesure la distance avec le module ultra-son de 15cm à 2m
-- Attention le module à ultra-son doit être alimenté en 5V !
print("\n 0_ultra_son.lua zf200628.1448 \n")
print("\n 0_ultra_son.lua zf200628.1521 \n")
speed_air = 382 -- en m/s
zlength_min = 12 -- en cm
zlength_max = 56 -- en cm
zlength_brut = 0
zlength = 9
zlength = 33
zlength_1, zlength_2, zlength_3 = zlength,zlength,zlength
zlevel = 0
@@ -38,10 +38,7 @@ function zmesure()
ultra_son_stop=tmr.now()
-- print("Delta: "..ultra_son_stop-ultra_son_start)
zlength_brut = math.floor(speed_air*(ultra_son_stop-ultra_son_start)/2/10000)
if zlength_brut>zlength_max then zlength_brut = zlength end
if zlength_brut<zlength_min then zlength_brut = zlength end
zlength = zlength_brut
if (zlength_brut>=4) and (zlength_brut<=65) then zlength = zlength_brut end
zlength_3 = zlength_2 zlength_2 = zlength_1 zlength_1 = zlength
zlength = math.floor((zlength_1+zlength_2+zlength_3)/3)
@@ -55,5 +52,5 @@ end
gpio.trig(zecho,"both",zmesure)
tmr_mesure=tmr.create()
tmr_mesure:alarm(2*1000, tmr.ALARM_AUTO, zmesure_pulse)
tmr_mesure:alarm(5*1000, tmr.ALARM_AUTO, zmesure_pulse)

View File

@@ -68,7 +68,7 @@ node.restart()
./luatool.py --ip $zIP:$zport -f 0_get_power.lua
./luatool.py --ip $zIP:$zport -f 0_cron.lua
./luatool.py --ip $zIP:$zport -f 0_http_post.lua
./luatool.py --ip $zIP:$zport -f 0_tst4_socat.lua
./luatool.py --ip $zIP:$zport -f 0_tst5_socat.lua
./luatool.py --ip $zIP:$zport -f 0_ultra_son.lua
./luatool.py --ip $zIP:$zport --zrestart