Expose lambda action to reset a cycle in slow_pwm (#4158)

This commit is contained in:
John Britton authored and GitHub committed 2022-12-07 19:27:14 +13:00
1 parent 34387adbcd
commit 92e44b8238
2 files changed
+2 -1

No files matched your search

@@ -70,7 +70,7 @@ void SlowPWMOutput::dump_config() {
void SlowPWMOutput::write_state(float state) {
this->state_ = state;
if (this->restart_cycle_on_state_change_)
this->period_start_time_ = millis();
this->restart_cycle();
}
} // namespace slow_pwm
@@ -14,6 +14,7 @@ class SlowPWMOutput : public output::FloatOutput, public Component {
void set_restart_cycle_on_state_change(bool restart_cycle_on_state_change) {
restart_cycle_on_state_change_ = restart_cycle_on_state_change;
}
void restart_cycle() { this->period_start_time_ = millis(); }
/// Initialize pin
void setup() override;