reduce cpu load while fading

This commit is contained in:
root 2019-07-06 22:28:56 +00:00
parent 7397c8f43e
commit 1246652dec
1 changed files with 9 additions and 8 deletions

View File

@ -137,13 +137,14 @@ case "$ROOM_NUMBER" in
while [ $R -ne $R_ -o $G -ne $G_ -o $B -ne $B_ ]; do
DR=$(sign $(($R_-$R))); DG=$(sign $(($G_-$G))); DB=$(sign $(($B_-$B)))
R=$(($R+$DR)); G=$((G+$DG)); B=$(($B+$DB))
PIDS=""
for i in 5:${GAMMA_LUT[$R]} 4:${GAMMA_LUT[$G]} 3:${GAMMA_LUT[$B]}; do
wget -q --timeout 3 -O- http://172.23.92.5/ecmd?channel%20$(echo $i | cut -d: -f1)%20$(echo $i | cut -d: -f2) > /dev/null 2>&1 &
PIDS="$PIDS $!"
COLOR_B_TMP="$(echo "$COLOR_B_TMP" | cut -c3-)"
done
sleep .1
wget -q --timeout 3 -O- --input-file <(
for i in 5:${GAMMA_LUT[$R]} 4:${GAMMA_LUT[$G]} 3:${GAMMA_LUT[$B]}; do
echo "http://172.23.92.5/ecmd?channel%20$(echo $i | cut -d: -f1)%20$(echo $i | cut -d: -f2)"
COLOR_B_TMP="$(echo "$COLOR_B_TMP" | cut -c3-)"
done
) > /dev/null 2>&1 &
PID=$!
sleep .2
kill -9 $PIDS >/dev/null 2>&1
done
done
@ -158,7 +159,7 @@ case "$ROOM_NUMBER" in
PIDS="$PIDS $!"
COLOR_B_TMP="$(echo "$COLOR_B_TMP" | cut -c3-)"
done
sleep .1
sleep .5
kill -9 $PIDS >/dev/null 2>&1
fi
;;