printer: tempstore fixup (#1353)

temp from get_stat could be {} if the device is not available
This commit is contained in:
林玮 (Jade Lin) authored and GitHub committed 2024-05-04 15:11:59 -03:00
1 parent 925dbe99ae
commit 7e94c68993
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -396,7 +396,8 @@ class Printer:
for x in self.tempstore[device]:
self.tempstore[device][x].pop(0)
temp = self.get_stat(device, x[:-1])
if temp is None:
if not temp:
# If the temperature is not available, set it to 0.
temp = 0
self.tempstore[device][x].append(temp)
return True
+1 -1
View File
@@ -256,7 +256,7 @@ class BasePanel(ScreenPanel):
return
for device in self._printer.get_temp_devices():
temp = self._printer.get_stat(device, "temperature")
if temp is not None and device in self.labels:
if temp and device in self.labels:
name = ""
if not (device.startswith("extruder") or device.startswith("heater_bed")):
if self.titlebar_name_type == "full":