aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/heater.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-01-28 23:37:56 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-01-28 23:37:56 -0500
commit6eefbe5e3069c70bb8c9e2d55b087ae8a6c27fee (patch)
tree0563dbdf1ddbe5eb4a410545eac4734a0c2e3ff1 /klippy/heater.py
parent650d55d7b2c4f2379f900569ec4d52bbbe1d00c6 (diff)
downloadkutter-6eefbe5e3069c70bb8c9e2d55b087ae8a6c27fee.tar.gz
kutter-6eefbe5e3069c70bb8c9e2d55b087ae8a6c27fee.tar.xz
kutter-6eefbe5e3069c70bb8c9e2d55b087ae8a6c27fee.zip
heater: Add stats reporting
Report the current temperature, current pwm setting, and target temperature as statistics in the log. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/heater.py')
-rw-r--r--klippy/heater.py9
1 files changed, 8 insertions, 1 deletions
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)
######################################################################