AOU:optimisation du code (while : , let i++ et message d'info)
This commit is contained in:
parent
d9fef1e417
commit
2a63bab202
33
btn_track.sh
33
btn_track.sh
@ -16,25 +16,22 @@ mpc play
|
||||
printf "MPC started"
|
||||
|
||||
i=0
|
||||
echo "Loop"
|
||||
while true
|
||||
echo "Loop check push"
|
||||
while :
|
||||
do
|
||||
echo "Until"
|
||||
until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null
|
||||
do
|
||||
/bin/sleep .1
|
||||
done
|
||||
echo "End until"
|
||||
i=$((i+1))
|
||||
if [ $i -ge 30 ]
|
||||
then
|
||||
until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null
|
||||
do
|
||||
/bin/sleep .1
|
||||
done
|
||||
|
||||
sudo systemctl poweroff
|
||||
echo "Shutdown..."
|
||||
break
|
||||
fi
|
||||
let i++
|
||||
if [ $i -ge 30 ]
|
||||
then
|
||||
printf "Shutdown by button"
|
||||
sudo systemctl poweroff
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Next Track"
|
||||
/usr/bin/mpc next
|
||||
echo "Next Track"
|
||||
mpc next
|
||||
done
|
||||
echo "End loop"
|
Loading…
x
Reference in New Issue
Block a user