mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Fix SlowPWM output switch at the end of period (#2984)
This commit is contained in:
parent
d8e719d1c4
commit
df929f9445
@ -15,7 +15,7 @@ void SlowPWMOutput::loop() {
|
|||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
float scaled_state = this->state_ * this->period_;
|
float scaled_state = this->state_ * this->period_;
|
||||||
|
|
||||||
if (now - this->period_start_time_ > this->period_) {
|
if (now - this->period_start_time_ >= this->period_) {
|
||||||
ESP_LOGVV(TAG, "End of period. State: %f, Scaled state: %f", this->state_, scaled_state);
|
ESP_LOGVV(TAG, "End of period. State: %f, Scaled state: %f", this->state_, scaled_state);
|
||||||
this->period_start_time_ += this->period_;
|
this->period_start_time_ += this->period_;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user