From a2482d4f952e0ffd908e4381cae9e45ab1148773 Mon Sep 17 00:00:00 2001
From: alchemyEngine <robertp@norbital.com>
Date: Thu, 29 Sep 2022 19:44:04 +0100
Subject: [PATCH] z_thermal_adjust: get_temp hotfix

M105 expects get_temp method. Module crashes when gcode_id parameter
is set and M105 called. Add methods as hotfix.

Signed-off-by: Robert Pazdzior <robertp@norbital.com>
---
 klippy/extras/z_thermal_adjust.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/klippy/extras/z_thermal_adjust.py b/klippy/extras/z_thermal_adjust.py
index 96e2dba7e..0fa0bff0d 100644
--- a/klippy/extras/z_thermal_adjust.py
+++ b/klippy/extras/z_thermal_adjust.py
@@ -145,6 +145,12 @@ class ZThermalAdjuster:
             self.measured_min = min(self.measured_min, self.smoothed_temp)
             self.measured_max = max(self.measured_max, self.smoothed_temp)
 
+    def get_temp(self, eventtime):
+        return self.smoothed_temp, 0.
+
+    def stats(self, eventtime):
+        return False, '%s: temp=%.1f' % ("z_thermal_adjust", self.smoothed_temp)
+
     def cmd_SET_Z_THERMAL_ADJUST(self, gcmd):
         enable = gcmd.get_int('ENABLE', None, minval=0, maxval=1)
         coeff = gcmd.get_float('TEMP_COEFF', None, minval=-1, maxval=1)