2016-07-20 13:44:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
. /lib/functions.sh
|
2016-07-20 13:44:50 +00:00
|
|
|
. /lib/functions/leds.sh
|
|
|
|
|
2017-11-28 21:51:07 +00:00
|
|
|
boot="$(get_dt_led boot)"
|
|
|
|
failsafe="$(get_dt_led failsafe)"
|
|
|
|
running="$(get_dt_led running)"
|
|
|
|
upgrade="$(get_dt_led upgrade)"
|
2016-07-20 13:44:50 +00:00
|
|
|
|
|
|
|
set_state() {
|
2017-11-28 21:51:07 +00:00
|
|
|
status_led="$boot"
|
2016-07-20 13:44:50 +00:00
|
|
|
|
|
|
|
case "$1" in
|
2017-11-28 21:51:07 +00:00
|
|
|
preinit_regular)
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
;;
|
2016-07-20 13:44:50 +00:00
|
|
|
preinit)
|
|
|
|
status_led_blink_preinit
|
|
|
|
;;
|
|
|
|
failsafe)
|
2017-11-28 21:51:07 +00:00
|
|
|
status_led_off
|
|
|
|
[ -n "$running" ] && {
|
|
|
|
status_led="$running"
|
|
|
|
status_led_off
|
|
|
|
}
|
|
|
|
status_led="$failsafe"
|
2016-07-20 13:44:50 +00:00
|
|
|
status_led_blink_failsafe
|
|
|
|
;;
|
2017-11-28 21:51:07 +00:00
|
|
|
upgrade)
|
|
|
|
[ -n "$running" ] && {
|
|
|
|
status_led="$upgrade"
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
}
|
2017-12-17 13:59:54 +00:00
|
|
|
;;
|
2016-07-20 13:44:50 +00:00
|
|
|
done)
|
2017-11-28 21:51:07 +00:00
|
|
|
status_led_off
|
|
|
|
[ -n "$running" ] && {
|
|
|
|
status_led="$running"
|
|
|
|
status_led_on
|
|
|
|
}
|
2016-07-20 13:44:50 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|