Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9743198315 |
@@ -1,3 +1,8 @@
|
|||||||
|
## 0.3.1 - 13/05/2017
|
||||||
|
Add experimental support for monostable solenoid valve:
|
||||||
|
- define in your config file the variable EV_MONOSTABLE and assign value 1
|
||||||
|
- if the solenoid valves close instead of opening and vice versa, reverse the values of the RELE_GPIO_CLOSE and RELE_GPIO_OPEN variables in your configuration file
|
||||||
|
|
||||||
## 0.3.0 - 07/05/2017
|
## 0.3.0 - 07/05/2017
|
||||||
Add command "open_in" for scheduling on the fly the opens/close a solenoid
|
Add command "open_in" for scheduling on the fly the opens/close a solenoid
|
||||||
Add command "del_cron_open_in" for delete scheduling the fly the opens/close a solenoid
|
Add command "del_cron_open_in" for delete scheduling the fly the opens/close a solenoid
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ SED="/bin/sed"
|
|||||||
# Percorso readlink
|
# Percorso readlink
|
||||||
READLINK="/bin/readlink"
|
READLINK="/bin/readlink"
|
||||||
|
|
||||||
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
|
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
||||||
|
EV_MONOSTABLE=0
|
||||||
|
|
||||||
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
|
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
|
||||||
SUPPLY_GPIO_1=2
|
SUPPLY_GPIO_1=2
|
||||||
SUPPLY_GPIO_2=3
|
SUPPLY_GPIO_2=3
|
||||||
|
|||||||
35
piGarden.sh
35
piGarden.sh
@@ -12,11 +12,13 @@ function initialize {
|
|||||||
|
|
||||||
log_write "Run initialize"
|
log_write "Run initialize"
|
||||||
|
|
||||||
# Imposta l'alimentazione con voltaggio negativo e setta i gpio in scrittura
|
# Imposta l'alimentazione con voltaggio negativo e setta i gpio in scrittura per le elettrovalvole bistabili
|
||||||
|
if [ "$EV_MONOSTABLE" != "1" ]; then
|
||||||
$GPIO -g write $SUPPLY_GPIO_1 0
|
$GPIO -g write $SUPPLY_GPIO_1 0
|
||||||
$GPIO -g write $SUPPLY_GPIO_2 0
|
$GPIO -g write $SUPPLY_GPIO_2 0
|
||||||
$GPIO -g mode $SUPPLY_GPIO_1 out
|
$GPIO -g mode $SUPPLY_GPIO_1 out
|
||||||
$GPIO -g mode $SUPPLY_GPIO_2 out
|
$GPIO -g mode $SUPPLY_GPIO_2 out
|
||||||
|
fi
|
||||||
|
|
||||||
# Elimina tutti gli stati delle elettrovalvole preesistenti
|
# Elimina tutti gli stati delle elettrovalvole preesistenti
|
||||||
rm -f "$STATUS_DIR"/*
|
rm -f "$STATUS_DIR"/*
|
||||||
@@ -97,18 +99,26 @@ function ev_open {
|
|||||||
state=2
|
state=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_write "Solenoid '$1' open"
|
# Dall'alias dell'elettrovalvola recupero il numero e dal numero recupero gpio da usare
|
||||||
message_write "success" "Solenoid open"
|
|
||||||
supply_positive
|
|
||||||
ev_alias2number $1
|
ev_alias2number $1
|
||||||
EVNUM=$?
|
EVNUM=$?
|
||||||
ev_number2gpio $EVNUM
|
ev_number2gpio $EVNUM
|
||||||
g=$?
|
g=$?
|
||||||
|
|
||||||
|
# Gestisce l'apertura dell'elettrovalvola in base alla tipologia (monostabile / bistabile)
|
||||||
|
if [ "$EV_MONOSTABLE" == "1" ]; then
|
||||||
|
$GPIO -g write $g $RELE_GPIO_CLOSE
|
||||||
|
else
|
||||||
|
supply_positive
|
||||||
$GPIO -g write $g $RELE_GPIO_CLOSE
|
$GPIO -g write $g $RELE_GPIO_CLOSE
|
||||||
sleep 1
|
sleep 1
|
||||||
$GPIO -g write $g $RELE_GPIO_OPEN
|
$GPIO -g write $g $RELE_GPIO_OPEN
|
||||||
|
fi
|
||||||
|
|
||||||
ev_set_state $EVNUM $state
|
ev_set_state $EVNUM $state
|
||||||
|
|
||||||
|
log_write "Solenoid '$1' open"
|
||||||
|
message_write "success" "Solenoid open"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -177,19 +187,28 @@ function ev_open_in {
|
|||||||
# $1 alias elettrovalvola
|
# $1 alias elettrovalvola
|
||||||
#
|
#
|
||||||
function ev_close {
|
function ev_close {
|
||||||
log_write "Solenoid '$1' close"
|
|
||||||
message_write "success" "Solenoid close"
|
# Dall'alias dell'elettrovalvola recupero il numero e dal numero recupero gpio da usare
|
||||||
supply_negative
|
|
||||||
#$GPIO_alias2number $1
|
|
||||||
ev_alias2number $1
|
ev_alias2number $1
|
||||||
EVNUM=$?
|
EVNUM=$?
|
||||||
ev_number2gpio $EVNUM
|
ev_number2gpio $EVNUM
|
||||||
g=$?
|
g=$?
|
||||||
|
|
||||||
|
# Gestisce l'apertura dell'elettrovalvola in base alla tipologia (monostabile / bistabile)
|
||||||
|
if [ "$EV_MONOSTABLE" == "1" ]; then
|
||||||
|
$GPIO -g write $g $RELE_GPIO_OPEN
|
||||||
|
else
|
||||||
|
supply_negative
|
||||||
$GPIO -g write $g $RELE_GPIO_CLOSE
|
$GPIO -g write $g $RELE_GPIO_CLOSE
|
||||||
sleep 1
|
sleep 1
|
||||||
$GPIO -g write $g $RELE_GPIO_OPEN
|
$GPIO -g write $g $RELE_GPIO_OPEN
|
||||||
|
fi
|
||||||
|
|
||||||
ev_set_state $EVNUM 0
|
ev_set_state $EVNUM 0
|
||||||
|
|
||||||
|
log_write "Solenoid '$1' close"
|
||||||
|
message_write "success" "Solenoid close"
|
||||||
|
|
||||||
cron_del open_in_stop $1 > /dev/null 2>&1
|
cron_del open_in_stop $1 > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user