Compare commits

...

2 Commits
0.0.3 ... 0.0.5

Author SHA1 Message Date
f910a6b03e 0.0.5
update requirements and related adjustments
2024-01-27 20:11:10 -05:00
d94c76b96e 0.0.4
potential fix for starting prints on A1/P1 devices
2024-01-20 11:18:08 -05:00
3 changed files with 22 additions and 14 deletions

View File

@ -27,7 +27,11 @@ class BambuPrintPlugin(
"flow_cali": False,
"vibration_cali": True,
"layer_inspect": True,
"use_ams": False}
"use_ams": False,
"local_mqtt": True,
"region": "",
"email": "",
"auth_token": ""}
def support_3mf_files(self):
return {'machinecode': {'3mf': ["3mf"]}}

View File

@ -151,7 +151,7 @@ class BambuPrinter:
elif event_type == "event_printer_data_update":
device_data = self.bambu.get_device()
ams = device_data.ams.__dict__
info = device_data.info.__dict__
print_job = device_data.print_job.__dict__
temperatures = device_data.temperature.__dict__
lights = device_data.lights.__dict__
fans = device_data.fans.__dict__
@ -163,20 +163,21 @@ class BambuPrinter:
self.bedTargetTemp = temperatures.get("target_bed_temp", 0.0)
self.chamberTemp = temperatures.get("chamber_temp", 0.0)
if info.get("gcode_state") == "RUNNING":
if print_job.get("gcode_state") == "RUNNING":
if not self._sdPrintingSemaphore.is_set():
self._sdPrintingSemaphore.set()
if self._sdPrintingPausedSemaphore.is_set():
self._sdPrintingPausedSemaphore.clear()
if not self._sdPrinting:
filename = info.get("subtask_name")
filename = print_job.get("subtask_name")
# TODO: swap this out to use 8 dot 3 name based on long name/path
self._selectSdFile(filename)
self._startSdPrint(from_printer=True)
# fuzzy math here to get print percentage to match BambuStudio
self._selectedSdFilePos = int(self._selectedSdFileSize * ((info.get("print_percentage") + 1)/100))
self._selectedSdFilePos = int(self._selectedSdFileSize * ((print_job.get("print_percentage") + 1)/100))
if info.get("gcode_state") == "PAUSE":
if print_job.get("gcode_state") == "PAUSE":
if not self._sdPrintingPausedSemaphore.is_set():
self._sdPrintingPausedSemaphore.set()
if self._sdPrintingSemaphore.is_set():
@ -184,7 +185,7 @@ class BambuPrinter:
self._send("// action:paused")
self._sendPaused()
if info.get("gcode_state") == "FINISH" and self._sdPrintingSemaphore.is_set():
if print_job.get("gcode_state") == "FINISH" and self._sdPrintingSemaphore.is_set():
self._selectedSdFilePos = self._selectedSdFileSize
self._finishSdPrint()
def _create_connection(self):
@ -201,10 +202,14 @@ class BambuPrinter:
serial=self._settings.get(["serial"]),
host=self._settings.get(["host"]),
username=self._settings.get(["username"]),
access_code=self._settings.get(["access_code"])
access_code=self._settings.get(["access_code"]),
local_mqtt=self._settings.get_boolean(["local_mqtt"]),
region=self._settings.get(["region"]),
email=self._settings.get(["email"]),
auth_token=self._settings.get(["auth_token"])
)
await self.bambu.connect(callback=self.new_update)
self.bambu.connect(callback=self.new_update)
self._logger.info(f"bambu connection status: {self.bambu.connected}")
self._sendOk()
# while True:
@ -645,7 +650,6 @@ class BambuPrinter:
def _getSdFileData(self, filename: str) -> Optional[Dict[str, Any]]:
files = self._mappedSdList()
# TODO: swap this out to use 8 dot 3 name to find long name/path
data = files.get(filename.lower())
if isinstance(data, str):
data = files.get(data.lower())
@ -761,7 +765,7 @@ class BambuPrinter:
"command": "project_file",
"param": "Metadata/plate_1.gcode",
"subtask_name": f"{self._selectedSdFile}",
"url": f"file:///mnt/sdcard/{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"]),
"flow_cali": self._settings.get_boolean(["flow_cali"]),

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.0.3"
plugin_version = "0.0.5"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
@ -33,7 +33,7 @@ plugin_url = "https://github.com/jneilliii/OctoPrint-BambuPrinter"
plugin_license = "AGPLv3"
# Any additional requirements besides OctoPrint should be listed here
plugin_requires = ["paho-mqtt", "pybambu>=1.0.0"]
plugin_requires = ["paho-mqtt", "python-dateutil", "pybambu>=1.0.1"]
### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
@ -61,7 +61,7 @@ plugin_ignored_packages = []
# additional_setup_parameters = {"dependency_links": ["https://github.com/someUser/someRepo/archive/master.zip#egg=someDependency-dev"]}
# "python_requires": ">=3,<4" blocks installation on Python 2 systems, to prevent confused users and provide a helpful error.
# Remove it if you would like to support Python 2 as well as 3 (not recommended).
additional_setup_parameters = {"python_requires": ">=3,<4"}
additional_setup_parameters = {"python_requires": ">=3.9,<4"}
########################################################################################################################