printer: tempstore fixup (#1353)

temp from get_stat could be {} if the device is not available
This commit is contained in:
林玮 (Jade Lin) 2024-05-05 02:11:59 +08:00 committed by GitHub
parent 925dbe99ae
commit 7e94c68993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

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

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":