From df929f9445ec147639b2e81f3f772b46b433dd91 Mon Sep 17 00:00:00 2001 From: Pavel Skuratovich Date: Wed, 5 Jan 2022 23:31:11 +0300 Subject: [PATCH] Fix SlowPWM output switch at the end of period (#2984) --- esphome/components/slow_pwm/slow_pwm_output.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/slow_pwm/slow_pwm_output.cpp b/esphome/components/slow_pwm/slow_pwm_output.cpp index 9b2589e735..8c88b3537c 100644 --- a/esphome/components/slow_pwm/slow_pwm_output.cpp +++ b/esphome/components/slow_pwm/slow_pwm_output.cpp @@ -15,7 +15,7 @@ void SlowPWMOutput::loop() { uint32_t now = millis(); 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); this->period_start_time_ += this->period_; }