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]
|
||||
Type=simple
|
||||
Restart=no
|
||||
RestartSec=1
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
ExecStart=/usr/local/bin/AutomaticBrightness.sh
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ LightChange=10
|
|||
SensorDelay=1
|
||||
|
||||
# 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
|
||||
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.
|
||||
renice "$priority" "$$"
|
||||
|
||||
sleep 5
|
||||
|
||||
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")
|
||||
|
@ -111,8 +114,9 @@ do
|
|||
|
||||
Light=$(( $Light + $MinimumBrightness ))
|
||||
|
||||
|
||||
TempLight=$(($Light * $SensorToDisplayScale))
|
||||
TempLight=$(echo "scale=2; $Light * $SensorToDisplayScale" | bc)
|
||||
# REmoves float for latter checks
|
||||
TempLight=$(LANG=C printf "%.0f" $TempLight)
|
||||
|
||||
if [[ $TempLight -gt $MaxScreenBrightness ]]
|
||||
then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue