0.1.8rc10

reduce settings save by refactoring ams data updates
This commit is contained in:
jneilliii 2024-11-14 21:26:41 -05:00
parent 76f706df19
commit b54e372342
3 changed files with 4 additions and 19 deletions

View File

@ -170,22 +170,6 @@ class BambuVirtualPrinter:
def change_state(self, new_state: APrinterState):
self._state_change_queue.put(new_state)
def _convert2serialize(self, obj):
if isinstance(obj, dict):
return {k: self._convert2serialize(v) for k, v in obj.items()}
elif hasattr(obj, "_ast"):
return self._convert2serialize(obj._ast())
elif not isinstance(obj, str) and hasattr(obj, "__iter__"):
return [self._convert2serialize(v) for v in obj]
elif hasattr(obj, "__dict__"):
return {
k: self._convert2serialize(v)
for k, v in obj.__dict__.items()
if not callable(v) and not k.startswith('_')
}
else:
return obj
def new_update(self, event_type):
if event_type == "event_hms_errors":
self._update_hms_errors()
@ -196,7 +180,8 @@ class BambuVirtualPrinter:
device_data = self.bambu_client.get_device()
print_job_state = device_data.print_job.gcode_state
temperatures = device_data.temperature
ams_data = self._convert2serialize(device_data.ams.data)
# strip out extra data to avoid unneeded settings updates
ams_data = [{"tray": asdict(x).pop("tray", None)} for x in device_data.ams.data if x is not None]
if self.ams_data != ams_data:
self._log.debug(f"Recieveid AMS Update: {ams_data}")

View File

@ -71,7 +71,7 @@ class PrintingState(APrinterState):
subtask_name: str = print_job_info.subtask_name
gcode_file: str = print_job_info.gcode_file
self._log.info(f"update_print_job_info: {print_job_info}")
self._log.debug(f"update_print_job_info: {print_job_info}")
project_file_info = self._printer.project_files.get_file_by_name(subtask_name) or self._printer.project_files.get_file_by_name(gcode_file)
if project_file_info is None:

View File

@ -14,7 +14,7 @@ plugin_package = "octoprint_bambu_printer"
plugin_name = "OctoPrint-BambuPrinter"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.1.8rc9"
plugin_version = "0.1.8rc10"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module