diff --git a/light/Light.cpp b/light/Light.cpp index 44507f4..f16c82a 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -74,6 +74,10 @@ static uint32_t getBrightness(const LightState& state) { } static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightness) { + if (brightness == 0) { + return 0; + } + return (brightness - 1) * (maxBrightness - 1) / (0xFF - 1) + 1; }