Minimum brightness change thresh hold
This commit is contained in:
parent
78eb04caf7
commit
acb72c3269
1 changed files with 56 additions and 29 deletions
|
@ -1,16 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
LevelSteps=60
|
||||
AnimationDelay=0.016
|
||||
MaxScreenBrightness=96000
|
||||
#How much light change must be seen by the sensor befor it will act
|
||||
LightChange=5
|
||||
|
||||
#How often it check the sensor
|
||||
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
|
||||
|
||||
SensorToDisplayScale=24
|
||||
|
||||
touch '/tmp/AB.running'
|
||||
|
||||
OldLight=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw)
|
||||
|
||||
until [ -f /tmp/AB.kill ]
|
||||
do
|
||||
if [[ -f /tmp/AB.stop ]]
|
||||
|
@ -27,6 +41,14 @@ do
|
|||
else
|
||||
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)
|
||||
|
||||
|
||||
|
@ -61,11 +83,16 @@ do
|
|||
sleep $AnimationDelay
|
||||
|
||||
done
|
||||
fi
|
||||
|
||||
sleep $SensorDelay
|
||||
fi
|
||||
|
||||
done
|
||||
rm '/tmp/AutoBright.running'
|
||||
rm '/tmp/AutoBright.kill'
|
||||
|
||||
|
||||
rm '/tmp/AB.running'
|
||||
rm '/tmp/AB.kill'
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue