From 087aa8d7623f6594637d415f76ff82120effd33e Mon Sep 17 00:00:00 2001 From: ohmdelta <64962148+ohmdelta@users.noreply.github.com> Date: Thu, 17 Oct 2024 22:18:41 +0100 Subject: [PATCH] fix skip objects none --- bambulabs_api/client.py | 6 +++--- bambulabs_api/mqtt_client.py | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bambulabs_api/client.py b/bambulabs_api/client.py index 26d8791..77c4309 100644 --- a/bambulabs_api/client.py +++ b/bambulabs_api/client.py @@ -195,7 +195,7 @@ def start_print(self, filename: str, plate_number: int, use_ams: bool = True, ams_mapping: list[int] = [0], - skip_objects: list[int] = [], + skip_objects: list[int] | None = None, ) -> bool: """ Start printing a file. @@ -211,8 +211,8 @@ def start_print(self, filename: str, ams_mapping : list[int], optional The mapping of the filament trays to the plate numbers, by default [0]. - skip_objects (list[int], optional): List of gcode objects to skip. - Defaults to []. + skip_objects (list[int] | None, optional): List of gcode objects to + skip. Defaults to None. Returns ------- diff --git a/bambulabs_api/mqtt_client.py b/bambulabs_api/mqtt_client.py index b001c2f..e79e185 100644 --- a/bambulabs_api/mqtt_client.py +++ b/bambulabs_api/mqtt_client.py @@ -198,7 +198,7 @@ def start_print_3mf(self, filename: str, plate_number: int, use_ams: bool = True, ams_mapping: list[int] = [0], - skip_objects: list[int] = [] + skip_objects: list[int] | None = None ) -> bool: """ Start the print @@ -208,12 +208,15 @@ def start_print_3mf(self, filename: str, plate_number (int): The plate number to print to use_ams (bool, optional): Use the AMS system. Defaults to True. ams_mapping (list[int], optional): The AMS mapping. Defaults to [0]. - skip_objects (list[int], optional): List of gcode objects to skip. - Defaults to []. + skip_objects (list[int] | None, optional): List of gcode objects to + skip. Defaults to []. Returns: str: print_status """ + if skip_objects is not None and not skip_objects: + skip_objects = None + return self.__publish_command( { "print":