sm6250-common: light: properly scale brightness range
Change-Id: I0c7b9d2644bbc67a1d404e60bbb2fcc7d8a305ec
This commit is contained in:
parent
7a6ac36e65
commit
f98970f590
@ -74,7 +74,7 @@ static uint32_t getBrightness(const LightState& state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightness) {
|
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) {
|
static inline uint32_t getScaledBrightness(const LightState& state, uint32_t maxBrightness) {
|
||||||
|
Loading…
Reference in New Issue
Block a user