Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
908173214f | |||
df4bd6cf44 |
@ -196,7 +196,7 @@ class BambuPrinter:
|
||||
self._send("// action:paused")
|
||||
self._sendPaused()
|
||||
|
||||
if ( print_job.get("gcode_state") == "FINISH" or print_job.get("gcode_state") == "FAILED" ):
|
||||
if print_job.get("gcode_state") == "FINISH" or print_job.get("gcode_state") == "FAILED":
|
||||
if self._sdPrintStarting is False:
|
||||
self._sdPrinting = False
|
||||
if self._sdPrintingSemaphore.is_set():
|
||||
@ -211,7 +211,12 @@ class BambuPrinter:
|
||||
):
|
||||
asyncio.run(self._create_connection_async())
|
||||
|
||||
def on_disconnect(self, on_disconnect):
|
||||
self._logger.debug(f"on disconnect called")
|
||||
return on_disconnect
|
||||
|
||||
async def _create_connection_async(self):
|
||||
self._logger.debug(f"connecting via local mqtt: {self._settings.get_boolean(['local_mqtt'])}")
|
||||
self.bambu = BambuClient(device_type=self._settings.get(["device_type"]),
|
||||
serial=self._settings.get(["serial"]),
|
||||
host=self._settings.get(["host"]),
|
||||
@ -222,13 +227,10 @@ class BambuPrinter:
|
||||
email=self._settings.get(["email"]),
|
||||
auth_token=self._settings.get(["auth_token"])
|
||||
)
|
||||
|
||||
self.bambu.on_disconnect = self.on_disconnect(self.bambu.on_disconnect)
|
||||
self.bambu.connect(callback=self.new_update)
|
||||
self._logger.info(f"bambu connection status: {self.bambu.connected}")
|
||||
self._sendOk()
|
||||
# while True:
|
||||
# await asyncio.sleep(self.tick_rate)
|
||||
# self._processTemperatureQuery()
|
||||
|
||||
def __str__(self):
|
||||
return "BAMBU(read_timeout={read_timeout},write_timeout={write_timeout},options={options})".format(
|
||||
@ -698,6 +700,7 @@ class BambuPrinter:
|
||||
return result
|
||||
|
||||
def _getSdFileData(self, filename: str) -> Optional[Dict[str, Any]]:
|
||||
self._logger.debug(f"_getSdFileData: {filename}")
|
||||
data = self._sdFileListCache.get(filename.lower())
|
||||
if isinstance(data, str):
|
||||
data = self._sdFileListCache.get(data.lower())
|
||||
@ -705,9 +708,11 @@ class BambuPrinter:
|
||||
|
||||
def _getSdFiles(self) -> List[Dict[str, Any]]:
|
||||
self._sdFileListCache = self._mappedSdList()
|
||||
self._logger.debug(f"_getSdFiles return: {self._sdFileListCache}")
|
||||
return [x for x in self._sdFileListCache.values() if isinstance(x, dict)]
|
||||
|
||||
def _selectSdFile(self, filename: str, check_already_open: bool = False) -> None:
|
||||
self._logger.debug(f"_selectSdFile: {filename}, check_already_open={check_already_open}")
|
||||
if filename.startswith("/"):
|
||||
filename = filename[1:]
|
||||
|
||||
@ -729,6 +734,7 @@ class BambuPrinter:
|
||||
self._send("File selected")
|
||||
|
||||
def _startSdPrint(self, from_printer: bool = False) -> None:
|
||||
self._logger.debug(f"_startSdPrint: from_printer={from_printer}")
|
||||
if self._selectedSdFile is not None:
|
||||
if self._sdPrinter is None:
|
||||
self._sdPrinting = True
|
||||
@ -820,7 +826,13 @@ class BambuPrinter:
|
||||
print_command = {"print": {"sequence_id": 0,
|
||||
"command": "project_file",
|
||||
"param": "Metadata/plate_1.gcode",
|
||||
"md5": "",
|
||||
"profile_id": "0",
|
||||
"project_id": "0",
|
||||
"subtask_id": "0",
|
||||
"task_id": "0",
|
||||
"subtask_name": f"{self._selectedSdFile}",
|
||||
"file": f"{self._selectedSdFile}",
|
||||
"url": f"file:///mnt/sdcard/{self._selectedSdFile}" if self._settings.get_boolean(["device_type"]) in ["X1", "X1C"] else f"file:///sdcard/{self._selectedSdFile}",
|
||||
"timelapse": self._settings.get_boolean(["timelapse"]),
|
||||
"bed_leveling": self._settings.get_boolean(["bed_leveling"]),
|
||||
|
2
setup.py
2
setup.py
@ -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.0.17"
|
||||
plugin_version = "0.0.18"
|
||||
|
||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||
# module
|
||||
|
Reference in New Issue
Block a user