job_status and base_panel: safeguard against possible issues with temps

This commit is contained in:
alfrix 2022-07-02 20:53:28 -03:00 committed by Alfredo Monclus
parent 784253ca77
commit d3cd4008a8
2 changed files with 6 additions and 5 deletions

View File

@ -230,7 +230,7 @@ class BasePanel(ScreenPanel):
if devices is not None:
for device in devices:
temp = self._screen.printer.get_dev_stat(device, "temperature")
if temp is not None:
if temp is not None and device in self.labels:
name = ""
if not (device.startswith("extruder") or device.startswith("heater_bed")):
if self.titlebar_name_type == "full":

View File

@ -932,7 +932,8 @@ class JobStatusPanel(ScreenPanel):
self.labels['lcdmessage'].set_text(str(msg))
def update_temp(self, x, temp, target):
if target > 0:
self.labels[x].set_label("%3d/%3d°" % (temp, target))
else:
self.labels[x].set_label("%3d°" % temp)
if x in self.labels and temp is not None:
if target is not None and target > 0:
self.labels[x].set_label("%3d/%3d°" % (temp, target))
else:
self.labels[x].set_label("%3d°" % temp)