Fix SlowPWM output switch at the end of period (#2984)

This commit is contained in:
Pavel Skuratovich 2022-01-05 23:31:11 +03:00 committed by GitHub
parent d8e719d1c4
commit df929f9445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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_;
}