Corrects issues with flashing the LED when the battery is low.

This commit is contained in:
fewtarius 2024-02-02 17:02:42 +00:00
parent c9821c88a5
commit 5b04cdee94
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
2 changed files with 31 additions and 11 deletions

View file

@ -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

View file

@ -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