Fixed setup.sh
awk in setup.sh was not capturing the correct feild cleanded up floating point in AutomaticBrightness.sh
This commit is contained in:
parent
1a919d6299
commit
9579c90d62
2 changed files with 3 additions and 5 deletions
6
AutomaticBrightness.sh
Executable file → Normal file
6
AutomaticBrightness.sh
Executable file → Normal file
|
@ -122,9 +122,7 @@ do
|
||||||
|
|
||||||
# Gernate a TempLight value for the screen to be set to
|
# Gernate a TempLight value for the screen to be set to
|
||||||
# Float math thanks Matthias_Wachter
|
# Float math thanks Matthias_Wachter
|
||||||
TempLight=$(echo "scale=2; $Light * $SensorToDisplayScale" | bc)
|
TempLight=$(LANG=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc))
|
||||||
# REmoves float for latter checks
|
|
||||||
TempLight=$(LANG=C printf "%.0f" $TempLight)
|
|
||||||
|
|
||||||
|
|
||||||
# Check we dont ask the screen to go brighter than it can
|
# Check we dont ask the screen to go brighter than it can
|
||||||
|
@ -136,7 +134,7 @@ do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# How diffrent should each stop be
|
# How diffrent should each stop be
|
||||||
DiffCount=$(( ( $NewLight - $CurrentBrightness ) / $LevelSteps ))
|
DiffCount=$(LANG=C printf "%.0f" $(echo "scale=2; ( $NewLight - $CurrentBrightness ) / $LevelSteps" | bc ))
|
||||||
|
|
||||||
# Step once per Screen Hz to make animation
|
# Step once per Screen Hz to make animation
|
||||||
for i in $(eval echo {1..$LevelSteps} )
|
for i in $(eval echo {1..$LevelSteps} )
|
||||||
|
|
2
setup.sh
2
setup.sh
|
@ -33,7 +33,7 @@ Scale=$(echo "scale=2; $MaxScreenBrightness / $Smax" | bc)
|
||||||
|
|
||||||
Final="SensorToDisplayScale=$Scale"
|
Final="SensorToDisplayScale=$Scale"
|
||||||
|
|
||||||
awk -v new_phrase="$Final" '/SensorToDisplayScale/{ print new_phrase; next } 1' AutomaticBrightness.sh > temp && mv temp AutomaticBrightness.sh
|
awk -v new_phrase="$Final" '/SensorToDisplayScale=/{ print new_phrase; next } 1' AutomaticBrightness.sh > temp && mv temp AutomaticBrightness.sh
|
||||||
|
|
||||||
|
|
||||||
echo "Cloning AutomaticBrighness.sh..."
|
echo "Cloning AutomaticBrighness.sh..."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue