SensorToDisplayScale now supports floats
A 5 second delay was added to the startup. Dew to reports of the service starting before the system values are initalized
This commit is contained in:
parent
be0a1c71a2
commit
1b0997474f
2 changed files with 9 additions and 5 deletions
|
@ -3,8 +3,8 @@ Description=Mac like automatic brightness as service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Restart=no
|
Restart=on-failure
|
||||||
RestartSec=1
|
RestartSec=5s
|
||||||
|
|
||||||
ExecStart=/usr/local/bin/AutomaticBrightness.sh
|
ExecStart=/usr/local/bin/AutomaticBrightness.sh
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ LightChange=10
|
||||||
SensorDelay=1
|
SensorDelay=1
|
||||||
|
|
||||||
# Scale sesor to displas brightness range
|
# Scale sesor to displas brightness range
|
||||||
SensorToDisplayScale=24
|
# NOW WITH FLOAT SUPPORT
|
||||||
|
SensorToDisplayScale=24.09
|
||||||
|
|
||||||
#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
|
#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
|
LevelSteps=60
|
||||||
|
@ -69,6 +70,8 @@ priority=19 # Priority level , 0 = regular app , 19 = very much background app
|
||||||
# Set the priority of the current script, Thank you Theluga.
|
# Set the priority of the current script, Thank you Theluga.
|
||||||
renice "$priority" "$$"
|
renice "$priority" "$$"
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
MaxScreenBrightness=$(find -L /sys/class/backlight -maxdepth 2 -name "max_brightness" 2>/dev/null | grep "max_brightness" | xargs cat)
|
MaxScreenBrightness=$(find -L /sys/class/backlight -maxdepth 2 -name "max_brightness" 2>/dev/null | grep "max_brightness" | xargs cat)
|
||||||
|
|
||||||
BLightPath=$(find -L /sys/class/backlight -maxdepth 2 -name "brightness" 2>/dev/null | grep "brightness")
|
BLightPath=$(find -L /sys/class/backlight -maxdepth 2 -name "brightness" 2>/dev/null | grep "brightness")
|
||||||
|
@ -111,8 +114,9 @@ do
|
||||||
|
|
||||||
Light=$(( $Light + $MinimumBrightness ))
|
Light=$(( $Light + $MinimumBrightness ))
|
||||||
|
|
||||||
|
TempLight=$(echo "scale=2; $Light * $SensorToDisplayScale" | bc)
|
||||||
TempLight=$(($Light * $SensorToDisplayScale))
|
# REmoves float for latter checks
|
||||||
|
TempLight=$(LANG=C printf "%.0f" $TempLight)
|
||||||
|
|
||||||
if [[ $TempLight -gt $MaxScreenBrightness ]]
|
if [[ $TempLight -gt $MaxScreenBrightness ]]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue