From 47d1e6f78bf9bc85bb560d51085a1284ddae3c64 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 10 May 2021 20:35:04 +0200 Subject: [PATCH] Use changeUIntScale when scaling brightness --- tasmota/xdrv_04_light.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 91775d70c..e22b4706f 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1269,8 +1269,8 @@ void LightSetBriScaled(uint8_t bri) { bri_rgb = bri; bri_ct = bri; } else { - bri_rgb = bri * bri_rgb / max_bri; - bri_ct = bri * bri_ct / max_bri; + bri_rgb = changeUIntScale(bri_rgb, 0, max_bri, 0, bri); + bri_ct = changeUIntScale(bri_ct, 0, max_bri, 0, bri); } #ifdef DEBUG_LIGHT AddLog(LOG_LEVEL_DEBUG, "LightSetBri new bri_rgb:%d, new bri_ct: %d", bri_rgb, bri_ct);