diff --git a/klippy/extruder.py b/klippy/extruder.py index 2e890025..22fb5f76 100644 --- a/klippy/extruder.py +++ b/klippy/extruder.py @@ -53,6 +53,8 @@ class PrinterExtruder: if is_active: return self.activate_gcode return self.deactivate_gcode + def stats(self, eventtime): + return self.heater.stats(eventtime) def motor_off(self, print_time): self.stepper.motor_enable(print_time, 0) self.need_motor_enable = True diff --git a/klippy/heater.py b/klippy/heater.py index 8dff7dbc..632ae88e 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -140,7 +140,7 @@ class PrinterHeater: self.control = algo(self, config) # pwm caching self.next_pwm_time = 0. - self.last_pwm_value = 0 + self.last_pwm_value = 0. def set_pwm(self, read_time, value): if self.target_temp <= 0.: value = 0. @@ -189,6 +189,13 @@ class PrinterHeater: def finish_auto_tune(self, old_control): self.control = old_control self.target_temp = 0 + def stats(self, eventtime): + with self.lock: + target_temp = self.target_temp + last_temp = self.last_temp + last_pwm_value = self.last_pwm_value + return '%s: target=%.0f temp=%.0f pwm=%.3f' % ( + self.name, target_temp, last_temp, last_pwm_value) ######################################################################