fix a couple of errors that may happen if klipper fails to start or takes too long

This commit is contained in:
alfrix committed 2022-12-11 19:22:45 -03:00
1 parent 502d9699bd
commit e4d5cd65ce
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -101,6 +101,8 @@ class Printer:
logging.info(f"# Output pins: {self.output_pin_count}")
def process_update(self, data):
if self.data is None:
return
for x in (self.get_tools() + self.get_heaters() + self.get_filament_sensors()):
if x in data:
for i in data[x]:
@@ -316,7 +318,7 @@ class Printer:
return True
def init_temp_store(self, tempstore):
if 'result' in tempstore:
if tempstore and 'result' in tempstore:
if self.tempstore and list(self.tempstore) != list(tempstore['result']):
logging.debug("Tempstore has changed")
self.tempstore = tempstore['result']
+1 -1
View File
@@ -242,7 +242,7 @@ class BasePanel(ScreenPanel):
name = f"{name[:1].upper()}: "
self.labels[device].set_label(f"{name}{int(temp)}°")
with contextlib.suppress(KeyError):
with contextlib.suppress(Exception):
if data["toolhead"]["extruder"] != self.current_extruder:
self.control['temp_box'].remove(self.labels[f"{self.current_extruder}_box"])
self.current_extruder = data["toolhead"]["extruder"]