From f20eda360f341d53c4a628dab7a875c71098149f Mon Sep 17 00:00:00 2001 From: socke7 <31484741+socke7@users.noreply.github.com> Date: Sun, 1 Oct 2023 09:35:31 +0200 Subject: [PATCH] match calculation of automatic brightness control to real bit width of the LDR sensor signal; sensor signal is 10bit, so 100% brightness is reached at 1023.0 - not 4095.0 --- src/PeripheryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PeripheryManager.cpp b/src/PeripheryManager.cpp index 73f1fddb..b8abdaeb 100644 --- a/src/PeripheryManager.cpp +++ b/src/PeripheryManager.cpp @@ -464,7 +464,7 @@ void PeripheryManager_::tick() CURRENT_LUX = (roundf(photocell.getSmoothedLux() * 1000) / 1000); if (AUTO_BRIGHTNESS && !MATRIX_OFF) { - brightnessPercent = sampleAverage / 4095.0 * 100.0; + brightnessPercent = sampleAverage / 1023.0 * 100.0; BRIGHTNESS = map(brightnessPercent, 0, 100, MIN_BRIGHTNESS, MAX_BRIGHTNESS); DisplayManager.setBrightness(BRIGHTNESS); }