do not override user led in ARMING mode

arming mode basically sits in idle mode all the time, which means led
status is set once per second.  this makes it impossible to set user led
status in arming mode (testing, development, whatever).  Add a simple
check to not override user set led status.
pull/4/head
Rick Farina (Zero_Chaos) 2019-12-13 15:03:39 -05:00
parent ca54f29c7f
commit 55c0f683ca
No known key found for this signature in database
GPG Key ID: A29433C0AA431DDC
1 changed files with 6 additions and 3 deletions

View File

@ -197,16 +197,19 @@ function enter_idle_mode() {
while true while true
do do
if [[ $MODE = "ARMING" ]] || [[ $MODE = "OFF" ]]; then if [[ $MODE = "ARMING" ]] || [[ $MODE = "OFF" ]]; then
#ARMING mode is basically always idle which means this overrides user LED
#status once per second. Don't override user status with idle status.
#pgrep LED > /dev/null || /usr/bin/LED whatever
BATTERY_STATE=$(/usr/bin/BATTERY) BATTERY_STATE=$(/usr/bin/BATTERY)
case $BATTERY_STATE in case $BATTERY_STATE in
"charging") "charging")
/usr/bin/LED B SLOW pgrep LED > /dev/null || /usr/bin/LED B SLOW
;; ;;
"full") "full")
/usr/bin/LED B pgrep LED > /dev/null || /usr/bin/LED B
;; ;;
*) *)
/usr/bin/LED Y SLOW pgrep LED > /dev/null || /usr/bin/LED Y SLOW
if [[ $MODE = "OFF" ]]; then if [[ $MODE = "OFF" ]]; then
sleep 2 && halt sleep 2 && halt
fi fi