Minimum brightness change thresh hold

This commit is contained in:
steel99xl 2023-10-06 21:15:32 -04:00 committed by GitHub
parent 78eb04caf7
commit acb72c3269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,16 +1,30 @@
#!/bin/bash #!/bin/bash
LevelSteps=60 #How much light change must be seen by the sensor befor it will act
AnimationDelay=0.016 LightChange=5
MaxScreenBrightness=96000
#How often it check the sensor
SensorDelay=1 SensorDelay=1
# Scale sesor to displas brightness range
SensorToDisplayScale=24
#This should match your refesh rate other wise it will either change the back light more times than needed or too few for a smooth animation
LevelSteps=60
# The is should match the LevelSteps but in the acual time each event should take to see
AnimationDelay=0.016
# Read the variable names
MaxScreenBrightness=96000
MinimumBrightness=001 MinimumBrightness=001
SensorToDisplayScale=24
touch '/tmp/AB.running' touch '/tmp/AB.running'
OldLight=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw)
until [ -f /tmp/AB.kill ] until [ -f /tmp/AB.kill ]
do do
if [[ -f /tmp/AB.stop ]] if [[ -f /tmp/AB.stop ]]
@ -27,6 +41,14 @@ do
else else
Light=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw) Light=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw)
MaxOld=$((OldLight + OldLight/LightChange))
MinOld=$((OldLight - OldLight/LightChange))
if [[ $Light -gt $MaxOld ]] || [[ $Light -lt $MinOld ]]
then
CurrentBrightness=$(cat /sys/class/backlight/intel_backlight/brightness) CurrentBrightness=$(cat /sys/class/backlight/intel_backlight/brightness)
@ -61,11 +83,16 @@ do
sleep $AnimationDelay sleep $AnimationDelay
done done
fi
sleep $SensorDelay sleep $SensorDelay
fi fi
done done
rm '/tmp/AutoBright.running'
rm '/tmp/AutoBright.kill'
rm '/tmp/AB.running'
rm '/tmp/AB.kill'