diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 0444fba6b..5c7202aae 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix Arduino IDE function prototyping compile error (#6982) - Change update lib IRremoteESP8266 updated to v2.7.1, -2.7k flash and -1.5k RAM for Tasmota-IR - Fix auto--power on/off when setting channel to non-zero or zero value, when SetOption68 1 +- Fix postpone saving settings to flash until Fade is complete, avoids pause in Fade ### 7.0.0.5 20191118 diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 07e5d23a1..695815d71 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1792,6 +1792,12 @@ void LightApplyFade(void) { // Note: Settings.light_speed is the number of half-seconds for a 100% fade, // i.e. light_speed=1 means 1024 steps in 10 ticks (500ms) Light.fade_duration = (distance * Settings.light_speed * 10) / 1024; + // Also postpone the save_data for the duration of the Fade (in seconds) + uint32_t delay_seconds = 1 + (Light.fade_duration + 19) / 20; // add one more second + // AddLog_P2(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, save_data_counter); + if (save_data_counter < delay_seconds) { + save_data_counter = delay_seconds; // pospone + } } else { // no fade needed, we keep the duration at zero, it will fallback directly to end of fade }