Corrects issues with flashing the LED when the battery is low.
This commit is contained in:
parent
c9821c88a5
commit
5b04cdee94
2 changed files with 31 additions and 11 deletions
|
@ -7,16 +7,36 @@
|
|||
COLOR=$(get_setting led.color)
|
||||
BRI=$(get_setting led.brightness)
|
||||
|
||||
ledcontrol off
|
||||
ledcontrol brightness mid
|
||||
if [ -z "${COLOR}" ] || \
|
||||
[ "${COLOR}" = "off" ] || \
|
||||
[ -n "${DEVICE_LED_CHARGING}" ]
|
||||
then
|
||||
FLASH_COLOR="red"
|
||||
else
|
||||
FLASH_COLOR="${COLOR}"
|
||||
fi
|
||||
|
||||
if [ "${DEVICE_LED_BRIGHTNESS}" = "true" ]
|
||||
then
|
||||
ledcontrol brightness mid
|
||||
fi
|
||||
|
||||
for i in $(seq 1 1 3)
|
||||
do
|
||||
sleep 1
|
||||
ledcontrol ${1}
|
||||
sleep 1
|
||||
ledcontrol off
|
||||
ledcontrol ${FLASH_COLOR}
|
||||
sleep .5
|
||||
ledcontrol poweroff
|
||||
sleep .5
|
||||
done
|
||||
|
||||
ledcontrol ${COLOR}
|
||||
ledcontrol brightness ${BRI}
|
||||
if [ -n "${COLOR}" ]
|
||||
then
|
||||
ledcontrol ${COLOR}
|
||||
else
|
||||
ledcontrol default
|
||||
fi
|
||||
|
||||
if [ "${DEVICE_LED_BRIGHTNESS}" = "true" ]
|
||||
then
|
||||
ledcontrol brightness ${BRI}
|
||||
fi
|
||||
|
|
|
@ -71,8 +71,8 @@ do
|
|||
fi
|
||||
### Until we have an overlay. :rofl:
|
||||
BATLEFT=$(battery_percent)
|
||||
if (( "${BATCNT}" >= "90" )) &&
|
||||
[[ "${STATUS}" =~ Disch ]]
|
||||
if (( "${BATCNT}" >= "20" )) &&
|
||||
[[ "${AC_STATUS}" =~ Disch ]]
|
||||
then
|
||||
AUDIBLEALERT=$(get_setting system.battery.warning)
|
||||
if (( ${BATLEFT} < "26" ))
|
||||
|
@ -80,7 +80,7 @@ do
|
|||
if [ "${DEVICE_LED_CONTROL}" = "true" ]
|
||||
then
|
||||
# Flash the RGB or power LED if available.
|
||||
led_flash red
|
||||
led_flash
|
||||
BATCNT=0
|
||||
elif [ "${AUDIBLEALERT}" = "1" ]
|
||||
then
|
||||
|
|
Loading…
Reference in a new issue