Revert "Merge pull request #2141 from fewtarius/dev"

This reverts commit 2e21c362e7, reversing
changes made to a8a0a59e43.
This commit is contained in:
fewtarius 2023-10-03 19:53:21 +00:00
parent 586dbebaa5
commit 6780f3ad3f
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
2 changed files with 20 additions and 8 deletions

View file

@ -8,10 +8,17 @@
BRIGHTNESS_DEV="$(find /sys/class/backlight/*/ -name brightness -print -quit)"
BRIGHTNESS_PATH="${BRIGHTNESS_DEV%/brightness}"
BRIGHTNESS_TABLE=($(get_setting brightness_table))
if [ -z $BRIGHTNESS_TABLE ]; then
BRIGHTNESS_TABLE="0 0.04 0.08 0.13 0.19 0.25 0.33 0.42 0.54 0.71 1"
set_setting brightness_table "$BRIGHTNESS_TABLE"
fi
NUM_STEPS=${#BRIGHTNESS_TABLE[@]}
MIN=0
MAX=$(<$(find /sys/class/backlight/*/ -name max_brightness -print -quit))
STEP="$(echo "scale=1; (${MAX} / 10)" | bc)"
compute() {
echo "${BRIGHTNESS_TABLE[$NEXT]} * $MAX" | bc -l
}
if [ ! -f "${BRIGHTNESS_DEV}" ]
then
@ -31,12 +38,16 @@ setBrightness() {
stepUp() {
CURRENT=$(get_setting system.brightness)
NEXT=$(( ${CURRENT} + 1 ))
if (( ${NEXT} > 10 ))
if (( ${NEXT} >= $NUM_STEPS ))
then
NEXT=10
NEXT=$(( $NUM_STEPS - 1 ))
fi
BRIGHTNESS=$(printf '%.0f' "$(echo "scale=1; ${STEP} * ${NEXT}" | bc)")
BRIGHTNESS=$(printf '%.0f' "$(compute)")
if (($BRIGHTNESS > $MAX ))
then
BRIGHTNESS=$MAX
fi
setBrightness ${BRIGHTNESS} ${NEXT}
}
@ -49,7 +60,7 @@ stepDown() {
NEXT=0
fi
BRIGHTNESS=$(printf '%.0f' "$(echo "scale=1; ${STEP} * ${NEXT}" | bc)")
BRIGHTNESS=$(printf '%.0f' "$(compute)")
setBrightness ${BRIGHTNESS} ${NEXT}
}
@ -68,7 +79,8 @@ case ${1} in
echo ${BRIGHTNESS_PATH}
;;
"set")
setBrightness "$(printf '%.0f' "$(echo "scale=1; ${STEP} * ${2}" | bc)")" ${2}
NEXT=${2}
setBrightness "$(printf '%.0f' "$(compute)")" ${2}
;;
*)
echo $(getBrightness)

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="345fc99"
PKG_VERSION="29db271"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"