mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
Merge pull request #7266 from s-hadinger/fix_fade_7262
Fix Fade would ignore ``savedata 0`` and store to flash anyways (#7262)
This commit is contained in:
commit
7d35f8eb07
@ -10,6 +10,7 @@
|
|||||||
- Add fallback support from version 8.x
|
- Add fallback support from version 8.x
|
||||||
- Add restriction if fallback firmware is incompatible with settings resulting in unreachable device
|
- Add restriction if fallback firmware is incompatible with settings resulting in unreachable device
|
||||||
- Add support for DHT12 Temperature and Humidity sensor by Stefan Oskamp
|
- Add support for DHT12 Temperature and Humidity sensor by Stefan Oskamp
|
||||||
|
- Fix Fade would ignore ``savedata 0`` and store to flash anyways (#7262)
|
||||||
|
|
||||||
### 7.1.2.5 20191213
|
### 7.1.2.5 20191213
|
||||||
|
|
||||||
|
@ -1766,12 +1766,14 @@ void LightApplyFade(void) {
|
|||||||
// Note: Settings.light_speed is the number of half-seconds for a 100% fade,
|
// 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)
|
// i.e. light_speed=1 means 1024 steps in 10 ticks (500ms)
|
||||||
Light.fade_duration = (distance * Settings.light_speed * 10) / 1024;
|
Light.fade_duration = (distance * Settings.light_speed * 10) / 1024;
|
||||||
|
if (Settings.save_data) {
|
||||||
// Also postpone the save_data for the duration of the Fade (in seconds)
|
// 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
|
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);
|
// AddLog_P2(LOG_LEVEL_INFO, PSTR("delay_seconds %d, save_data_counter %d"), delay_seconds, save_data_counter);
|
||||||
if (save_data_counter < delay_seconds) {
|
if (save_data_counter < delay_seconds) {
|
||||||
save_data_counter = delay_seconds; // pospone
|
save_data_counter = delay_seconds; // pospone
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// no fade needed, we keep the duration at zero, it will fallback directly to end of fade
|
// no fade needed, we keep the duration at zero, it will fallback directly to end of fade
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user