Mon filtre d'élimination d'erreurs de mesures de la hauteur de l'eau à l'air de bien fonctionner maintenant
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- Petit script pour faire office de crontab pour les mesures
|
||||
print("\n 0_cron.lua zf200628.1457 \n")
|
||||
print("\n 0_cron.lua zf200705.2247 \n")
|
||||
|
||||
cron1=tmr.create()
|
||||
cron1:alarm(15*1000, tmr.ALARM_AUTO, function()
|
||||
@@ -20,7 +20,7 @@ cron1:alarm(15*1000, tmr.ALARM_AUTO, function()
|
||||
|
||||
if yellow_id == 69 then
|
||||
local zmes="bolo_ruru,capteur="..node_id.." level="..zlevel
|
||||
zmes=zmes.."\n".."bolo_ruru,capteur="..node_id.." hauteur="..zlength_brut
|
||||
zmes=zmes.."\n".."bolo_ruru,capteur="..node_id.." hauteur="..zlength
|
||||
http_post(influxdb_url,zmes)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- 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 zf200705.1157 \n")
|
||||
print("\n 0_ultra_son.lua zf200705.2259 \n")
|
||||
|
||||
speed_air = 382 -- en m/s
|
||||
zlength_min = 12 -- en cm
|
||||
@@ -10,7 +10,7 @@ zlength_max = 56 -- en cm
|
||||
zlength_brut = 0
|
||||
zlength = 33
|
||||
zlength_1, zlength_2, zlength_3 = zlength,zlength,zlength
|
||||
|
||||
znbmaxerr = 0
|
||||
zlevel = 0
|
||||
|
||||
--Paramètres pour le module ultra son
|
||||
@@ -45,7 +45,16 @@ function zmesure()
|
||||
http_post(influxdb_url,zmes)
|
||||
|
||||
|
||||
if (zlength_brut>=4) and (zlength_brut<=65) then zlength = zlength_brut end
|
||||
-- if (zlength_brut>=4) and (zlength_brut<=65) then zlength = zlength_brut end
|
||||
if (math.abs(zlength_brut-zlength) < 10) or (znbmaxerr > 2) then
|
||||
zlength = zlength_brut
|
||||
znbmaxerr = 0
|
||||
else
|
||||
znbmaxerr = znbmaxerr + 1
|
||||
end
|
||||
|
||||
zmes="bolo_ruru,capteur="..node_id.." hauteur_brute2="..zlength
|
||||
http_post(influxdb_url,zmes)
|
||||
|
||||
zlength_3 = zlength_2 zlength_2 = zlength_1 zlength_1 = zlength
|
||||
-- zlength = math.floor((zlength_1+zlength_2+zlength_3)/3)
|
||||
@@ -61,4 +70,5 @@ gpio.trig(zecho,"both",zmesure)
|
||||
|
||||
tmr_mesure=tmr.create()
|
||||
tmr_mesure:alarm(5*1000, tmr.ALARM_AUTO, zmesure_pulse)
|
||||
zmesure_pulse()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom
|
||||
# zf200704.1832
|
||||
# zf200704.2310
|
||||
|
||||
|
||||
Todo à faire pour ce projet !
|
||||
@@ -65,6 +65,9 @@ verbose=false
|
||||
verbose=true
|
||||
node.restart()
|
||||
|
||||
dofile("head.lua")
|
||||
zhead("0_ultra_son.lua")
|
||||
|
||||
./luatool.py --ip $zIP:$zport -f boot.lua
|
||||
./luatool.py --ip $zIP:$zport -f 0_get_power.lua
|
||||
./luatool.py --ip $zIP:$zport -f 0_cron.lua
|
||||
|
||||
Reference in New Issue
Block a user