diff --git a/CHANGELOG.md b/CHANGELOG.md index b4dfcd5..02653d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/include/rain.include.sh b/include/rain.include.sh index c3345be..131af9a 100644 --- a/include/rain.include.sh +++ b/include/rain.include.sh @@ -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 diff --git a/piGarden.sh b/piGarden.sh index ecc11f9..079bcff 100755 --- a/piGarden.sh +++ b/piGarden.sh @@ -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" }