From d43baea44347ce1ab6bfb2ec81bd3f061a699043 Mon Sep 17 00:00:00 2001 From: steel99xl Date: Fri, 6 Oct 2023 21:44:48 -0400 Subject: [PATCH] Add files via upload --- AutomaticBrightness.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/AutomaticBrightness.sh b/AutomaticBrightness.sh index ba32966..f2f86a8 100644 --- a/AutomaticBrightness.sh +++ b/AutomaticBrightness.sh @@ -41,9 +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 -lt $LightChange ]] + then + MaxOld=$((OldLight + LightChange)) + MinOld=$((OldLight - LightChange)) + else + MaxOld=$((OldLight + OldLight/LightChange)) + MinOld=$((OldLight - OldLight/LightChange)) + fi if [[ $Light -gt $MaxOld ]] || [[ $Light -lt $MinOld ]] then