fix(heater): don't turn heater on when controller time is zero (#26659)

When the PI controller computed zero on-time (e.g. temperature already
above target), the heater was still momentarily turned on every cycle
before being immediately turned off. Skip the on/off toggle entirely
when the computed on-time is zero.
This commit is contained in:
Jacob Dahl 2026-03-04 19:12:13 -09:00 committed by GitHub
parent b79ed50615
commit c677cb75df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -417,9 +417,14 @@ void Heater::Run()
_temperature_target_met = false;
}
_heater_on = true;
heater_on();
ScheduleDelayed(_controller_time_on_usec);
if (_controller_time_on_usec > 0) {
_heater_on = true;
heater_on();
ScheduleDelayed(_controller_time_on_usec);
} else {
ScheduleDelayed(CONTROLLER_PERIOD_DEFAULT);
}
}
publish_status();