aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
authorTimofey Titovets <nefelim4ag@gmail.com>2024-12-23 23:11:58 +0100
committerKevinOConnor <kevin@koconnor.net>2025-04-05 21:27:37 -0400
commit3a9e9a4bef8e6e04c743a6330249568686257f0c (patch)
tree7bf37a42b015a8aa2ef8e7f4056996ca15f04ef6 /klippy/extras
parent3beb465247d06bed789025b9857105f3f2496e5e (diff)
downloadkutter-3a9e9a4bef8e6e04c743a6330249568686257f0c.tar.gz
kutter-3a9e9a4bef8e6e04c743a6330249568686257f0c.tar.xz
kutter-3a9e9a4bef8e6e04c743a6330249568686257f0c.zip
temperature_combined: avoid crash with temperature monitors
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/temperature_combined.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/klippy/extras/temperature_combined.py b/klippy/extras/temperature_combined.py
index f5aafd1e..d032bce0 100644
--- a/klippy/extras/temperature_combined.py
+++ b/klippy/extras/temperature_combined.py
@@ -41,14 +41,22 @@ class PrinterSensorCombined:
sensor = self.printer.lookup_object(sensor_name)
# check if sensor has get_status function and
# get_status has a 'temperature' value
- if (hasattr(sensor, 'get_status') and
- 'temperature' in sensor.get_status(
- self.reactor.monotonic())):
- self.sensors.append(sensor)
- else:
+ if not hasattr(sensor, 'get_status'):
+ raise self.printer.config_error(
+ "'%s' does not have a status."
+ % (sensor_name,))
+ status = sensor.get_status(self.reactor.monotonic())
+ if 'temperature' not in status:
raise self.printer.config_error(
"'%s' does not report a temperature."
% (sensor_name,))
+ # Handle temperature monitors
+ if status["temperature"] is None:
+ raise self.printer.config_error(
+ "Temperature monitor '%s' is not supported"
+ % (sensor_name,))
+
+ self.sensors.append(sensor)
def _handle_ready(self):
# Start temperature update timer