aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/heater.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-01-12 15:04:06 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-01-12 15:13:41 -0500
commitf335045273401d89977b663eab9b96d62e5e2bbb (patch)
treecc83675eab59cb47d04b7189e412acefaa224abd /klippy/heater.py
parent4ea091339ed98ccf4df2341abef41c67460a40c6 (diff)
downloadkutter-f335045273401d89977b663eab9b96d62e5e2bbb.tar.gz
kutter-f335045273401d89977b663eab9b96d62e5e2bbb.tar.xz
kutter-f335045273401d89977b663eab9b96d62e5e2bbb.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/heater.py')
-rw-r--r--klippy/heater.py7
1 files 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):