Browse Source

light: repeat timer instead of re-init

pull/2552/head
Maxim Prokhorov 1 year ago
parent
commit
a44860f50c
1 changed files with 9 additions and 4 deletions
  1. +9
    -4
      code/espurna/light.cpp

+ 9
- 4
code/espurna/light.cpp View File

@ -1736,9 +1736,14 @@ struct LightProviderHandler {
_timer.stop();
}
void reset() {
_ready = false;
}
void start(Duration duration) {
_ready = false;
_timer.once(duration,
_timer.repeat(
duration,
[&]() {
_ready = true;
});
@ -1858,12 +1863,12 @@ void _lightProviderUpdate() {
_lightProviderHandleValue,
_lightProviderHandleUpdate);
if (next) {
_light_provider_update.start(_light_transition->step());
} else {
if (!next) {
_light_transition.reset(nullptr);
_light_provider_update.stop();
}
_light_provider_update.reset();
}
} // namespace


Loading…
Cancel
Save