mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Expose lambda action to reset a cycle in slow_pwm
(#4158)
This commit is contained in:
parent
34387adbcd
commit
92e44b8238
2 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue