Implementato supporto a zone non soggette a pioggia (con il parametro EVx_NORAIN)

This commit is contained in:
lejubila
2017-10-28 00:12:06 +02:00
parent 4a0d6178d3
commit daf8a7baa6
3 changed files with 26 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
# 0.5.1 - xx/xx/2017
# 0.5.1 - 28/10/2017
- Added events managemets
- Added support for zones not subject to rainfall (with parameter EVx_NORAIN)
# 0.5.0 - 12/10/2017
- Implemented driver subsystem for interfacing with other board

View File

@@ -105,10 +105,12 @@ function close_all_for_rain {
do
local a=EV"$i"_ALIAS
local al=${!a}
local a=EV"$i"_NORAIN
local evnorain=${!a}
ev_status $al
local state=$?
#echo "$al = $state"
if [ "$state" = "1" ]; then
if [ "$state" = "1" ] && [ "$evnorain" != "1" ]; then
ev_close $al
log_write "close_all_for_rain - Close solenoid '$al' for rain"
fi

View File

@@ -85,7 +85,13 @@ function ev_open {
cron_del open_in $1 > /dev/null 2>&1
if [ ! "$2" = "force" ]; then
# Dall'alias dell'elettrovalvola recupero il numero e dal numero recupero gpio da usare
ev_alias2number $1
local EVNUM=$?
local g=`ev_number2gpio $EVNUM`
local EVNORAIN=`ev_number2norain $EVNUM`
if [ ! "$2" = "force" ] && [ "$EVNORAIN" != "1" ]; then
if [[ "$NOT_IRRIGATE_IF_RAIN_ONLINE" -gt 0 && -f $STATUS_DIR/last_rain_online ]]; then
local last_rain=`cat $STATUS_DIR/last_rain_online`
local now=`date +%s`
@@ -124,11 +130,6 @@ function ev_open {
return
fi
# Dall'alias dell'elettrovalvola recupero il numero e dal numero recupero gpio da usare
ev_alias2number $1
EVNUM=$?
g=`ev_number2gpio $EVNUM`
lock
# Gestisce l'apertura dell'elettrovalvola in base alla tipologia (monostabile / bistabile)
@@ -388,11 +389,20 @@ function alias_exists {
# $1 numero elettrovalvola
#
function ev_number2gpio {
# echo "numero ev $1"
i=$1
g=EV"$i"_GPIO
gv=${!g}
# echo "gv = $gv"
local i=$1
local g=EV"$i"_GPIO
local gv=${!g}
echo "$gv"
}
#
# Recupera il valore norain associato ad una elettrovalvola
# $1 numero elettrovalvola
#
function ev_number2norain {
local i=$1
local g=EV"$i"_NORAIN
local gv=${!g}
echo "$gv"
}