From df50a56c25c085bd5260aa82f1b9a541eb3337ea Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 2 Aug 2023 17:48:12 +0200 Subject: [PATCH] Fade would fail when the difference between start and target would be too small (#19246) --- CHANGELOG.md | 1 + tasmota/tasmota_xdrv_driver/xdrv_04_light.ino | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56ae54e9a..b81eac2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Initial battery level percentage (#19160) - Berry SK6812_GRBW crash (#19166) +- Fade would fail when the difference between start and target would be too small ### Removed diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino index f4b27dd10..6599fde21 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino @@ -2080,7 +2080,7 @@ bool LightApplyFade(void) { // did the value chanegd and needs to be applied Light.fade_duration = LightGetSpeedSetting() * 500; Light.speed_once_enabled = false; // The once off speed value has been read, reset it if (!Settings->flag5.fade_fixed_duration) { - Light.fade_duration = (distance * Light.fade_duration) / 1023; // time is proportional to distance, except with SO117 + Light.fade_duration = (distance * Light.fade_duration) / 1023 + 1 /* make sure value is not zero */; // time is proportional to distance, except with SO117 } if (Settings->save_data) { // Also postpone the save_data for the duration of the Fade (in seconds)