davinci: light: Properly scale brightness range

Change-Id: I0c7b9d2644bbc67a1d404e60bbb2fcc7d8a305ec
This commit is contained in:
Demon000 2019-09-05 22:05:51 +02:00 committed by Arian
parent 5af8701925
commit e5440961f0
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9

View File

@ -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) {