From f335045273401d89977b663eab9b96d62e5e2bbb Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 12 Jan 2017 15:04:06 -0500 Subject: [PATCH] heater: Resend PWM values even if last value was zero Continue to resend the pwm value even if the last value was zero - this extends the debugging info. Also, add the target temperature to the pwm debugging. Signed-off-by: Kevin O'Connor --- klippy/heater.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/klippy/heater.py b/klippy/heater.py index 5addfaca..359c80bd 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -65,14 +65,15 @@ class PrinterHeater: if (read_time < self.next_pwm_time and abs(value - self.last_pwm_value) < 15): return - elif not self.last_pwm_value: + elif not self.last_pwm_value and ( + self.target_temp <= 0. or read_time < self.next_pwm_time): return pwm_time = read_time + REPORT_TIME + SAMPLE_TIME*SAMPLE_COUNT self.next_pwm_time = pwm_time + 0.75 * MAX_HEAT_TIME self.last_pwm_value = value - logging.debug("%s: pwm=%d@%.3f (from %.3f@%.3f)" % ( + logging.debug("%s: pwm=%d@%.3f (from %.3f@%.3f [%.3f])" % ( self.config.section, value, pwm_time, - self.last_temp, self.last_temp_time)) + self.last_temp, self.last_temp_time, self.target_temp)) self.mcu_pwm.set_pwm(pwm_time, value) # Temperature calculation def calc_temp(self, adc):