From e5440961f0f739b825af151578f2d96df1680b82 Mon Sep 17 00:00:00 2001 From: Demon000 Date: Thu, 5 Sep 2019 22:05:51 +0200 Subject: [PATCH] davinci: light: Properly scale brightness range Change-Id: I0c7b9d2644bbc67a1d404e60bbb2fcc7d8a305ec --- light/Light.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/light/Light.cpp b/light/Light.cpp index a9b58f4..44507f4 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -74,7 +74,7 @@ static uint32_t getBrightness(const LightState& state) { } static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightness) { - return brightness * maxBrightness / 0xFF; + return (brightness - 1) * (maxBrightness - 1) / (0xFF - 1) + 1; } static inline uint32_t getScaledBrightness(const LightState& state, uint32_t maxBrightness) {