From 9579c90d62cc09e5b3ca3b683d1525fa226444e8 Mon Sep 17 00:00:00 2001 From: steel99xl Date: Wed, 28 Feb 2024 13:22:40 -0500 Subject: [PATCH] Fixed setup.sh awk in setup.sh was not capturing the correct feild cleanded up floating point in AutomaticBrightness.sh --- AutomaticBrightness.sh | 6 ++---- setup.sh | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 100755 => 100644 AutomaticBrightness.sh diff --git a/AutomaticBrightness.sh b/AutomaticBrightness.sh old mode 100755 new mode 100644 index e39adb6..defea77 --- a/AutomaticBrightness.sh +++ b/AutomaticBrightness.sh @@ -122,9 +122,7 @@ do # Gernate a TempLight value for the screen to be set to # Float math thanks Matthias_Wachter - TempLight=$(echo "scale=2; $Light * $SensorToDisplayScale" | bc) - # REmoves float for latter checks - TempLight=$(LANG=C printf "%.0f" $TempLight) + TempLight=$(LANG=C printf "%.0f" $(echo "scale=2; $Light * $SensorToDisplayScale" | bc)) # Check we dont ask the screen to go brighter than it can @@ -136,7 +134,7 @@ do fi # 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 for i in $(eval echo {1..$LevelSteps} ) diff --git a/setup.sh b/setup.sh index 4c1190d..1bd83d2 100755 --- a/setup.sh +++ b/setup.sh @@ -33,7 +33,7 @@ Scale=$(echo "scale=2; $MaxScreenBrightness / $Smax" | bc) 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..."