Skip to content

Commit

Permalink
improve initial connection sequence, wait for bambu client connection…
Browse files Browse the repository at this point in the history
… before returning firmware information.
  • Loading branch information
jneilliii committed Oct 28, 2024
1 parent eaa0ed9 commit 28be048
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions octoprint_bambu_printer/printer/bambu_virtual_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _update_printer_info(self):
self._telemetry.bedTemp = temperatures.bed_temp
self._telemetry.bedTargetTemp = temperatures.target_bed_temp
self._telemetry.chamberTemp = temperatures.chamber_temp
if device_data.push_all_data:
if device_data.push_all_data and "ams" in device_data.push_all_data:
self._telemetry.ams_current_tray = device_data.push_all_data["ams"]["tray_now"] or 255

if self._telemetry.ams_current_tray != self._settings.get_int(["ams_current_tray"]):
Expand Down Expand Up @@ -367,8 +367,9 @@ def select_project_file(self, file_path: str) -> bool:
##~~ command implementations

@gcode_executor.register_no_data("M21")
def _sd_status(self) -> None:
def _sd_status(self) -> bool:
self.sendIO("SD card ok")
return True

@gcode_executor.register("M23")
def _select_sd_file(self, data: str) -> bool:
Expand Down Expand Up @@ -469,6 +470,9 @@ def stop_continuous_temp_report(self):
# noinspection PyUnusedLocal
@gcode_executor.register_no_data("M115")
def _report_firmware_info(self) -> bool:
# wait for connection to be established before sending back firmware info
while self.bambu_client.connected is False:
time.sleep(1)
self.sendIO("Bambu Printer Integration")
self.sendIO("Cap:AUTOREPORT_SD_STATUS:1")
self.sendIO("Cap:AUTOREPORT_TEMP:1")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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.8rc2"
plugin_version = "0.1.8rc3"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 28be048

Please sign in to comment.