From 01f089e71039c1f9e63b8f1def218e6f465b41da Mon Sep 17 00:00:00 2001 From: Maksim Bolgov <57844100+MRX8024@users.noreply.github.com> Date: Fri, 20 Mar 2026 18:19:45 +0200 Subject: [PATCH] heaters: Fix no heating on small max_power values (#7227) If the config parameter "max_power" is less than 0.05, the heaters will never start heating. Added PWM threshold scaling with "max_power" value. Signed-off-by: Maksim Bolgov --- klippy/extras/heaters.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klippy/extras/heaters.py b/klippy/extras/heaters.py index ec4792dea..f8ed904cc 100644 --- a/klippy/extras/heaters.py +++ b/klippy/extras/heaters.py @@ -16,6 +16,7 @@ AMBIENT_TEMP = 25. PID_PARAM_BASE = 255. MAX_MAINTHREAD_TIME = 5.0 QUELL_STALE_TIME = 7.0 +MIN_PWM_CHANGE_RATIO = 0.05 class Heater: def __init__(self, config, sensor): @@ -37,6 +38,7 @@ class Heater: is not None) self.can_extrude = self.min_extrude_temp <= 0. or is_fileoutput self.max_power = config.getfloat('max_power', 1., above=0., maxval=1.) + self.min_pwm_change = self.max_power * MIN_PWM_CHANGE_RATIO self.smooth_time = config.getfloat('smooth_time', 1., above=0.) self.inv_smooth_time = 1. / self.smooth_time self.verify_mainthread_time = -999. @@ -71,7 +73,7 @@ class Heater: if self.target_temp <= 0. or read_time > self.verify_mainthread_time: value = 0. if ((read_time < self.next_pwm_time or not self.last_pwm_value) - and abs(value - self.last_pwm_value) < 0.05): + and abs(value - self.last_pwm_value) < self.min_pwm_change): # No significant change in value - can suppress update return pwm_time = read_time + self.pwm_delay