Skip to content

Commit cd4103c

Browse files
authored
0.1.2 (#40)
* fix issues related to 8dot3 filenames used in M23 command, #39 * switch to auto reporting temp and sd status
1 parent 01c6cac commit cd4103c

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

octoprint_bambu_printer/printer/bambu_virtual_printer.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(
7272

7373
self._running = True
7474
self._print_status_reporter = None
75+
self._print_temp_reporter = None
7576
self._printer_thread = threading.Thread(
7677
target=self._printer_worker,
7778
name="octoprint.plugins.bambu_printer.printer_state",
@@ -367,8 +368,10 @@ def _report_sd_print_status(self, data: str) -> bool:
367368
interval = int(matchS.group(1))
368369
if interval > 0:
369370
self.start_continuous_status_report(interval)
371+
return False
370372
else:
371373
self.stop_continuous_status_report()
374+
return False
372375

373376
self.report_print_job_status()
374377
return True
@@ -403,10 +406,39 @@ def _report_temperatures(self, data: str) -> bool:
403406
self._processTemperatureQuery()
404407
return True
405408

409+
@gcode_executor.register("M155")
410+
def _auto_report_temperatures(self, data: str) -> bool:
411+
matchS = re.search(r"S([0-9]+)", data)
412+
if matchS:
413+
interval = int(matchS.group(1))
414+
if interval > 0:
415+
self.start_continuous_temp_report(interval)
416+
else:
417+
self.stop_continuous_temp_report()
418+
419+
self.report_print_job_status()
420+
return True
421+
422+
def start_continuous_temp_report(self, interval: int):
423+
if self._print_temp_reporter is not None:
424+
self._print_temp_reporter.cancel()
425+
426+
self._print_temp_reporter = RepeatedTimer(
427+
interval, self._processTemperatureQuery
428+
)
429+
self._print_temp_reporter.start()
430+
431+
def stop_continuous_temp_report(self):
432+
if self._print_temp_reporter is not None:
433+
self._print_temp_reporter.cancel()
434+
self._print_temp_reporter = None
435+
406436
# noinspection PyUnusedLocal
407437
@gcode_executor.register_no_data("M115")
408438
def _report_firmware_info(self) -> bool:
409439
self.sendIO("Bambu Printer Integration")
440+
self.sendIO("Cap:AUTOREPORT_SD_STATUS:1")
441+
self.sendIO("Cap:AUTOREPORT_TEMP:1")
410442
self.sendIO("Cap:EXTENDED_M20:1")
411443
self.sendIO("Cap:LFN_WRITE:1")
412444
return True

octoprint_bambu_printer/printer/file_system/cached_file_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_file_by_stem(self, file_stem: str, allowed_suffixes: list[str]):
8585
return file_data
8686

8787
def _get_file_by_stem_cached(self, file_stem: str, allowed_suffixes: list[str]):
88-
for file_path_str in self._file_data_cache.keys():
88+
for file_path_str in list(self._file_data_cache.keys()) + list(self._file_alias_cache.keys()):
8989
file_path = Path(file_path_str)
9090
if file_stem == file_path.with_suffix("").stem and all(
9191
suffix in allowed_suffixes for suffix in file_path.suffixes

octoprint_bambu_printer/printer/states/idle_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _get_print_command_for_file(self, selected_file: FileInfo):
2626
# URL to print. Root path, protocol can vary. E.g., if sd card, "ftp:///myfile.3mf", "ftp:///cache/myotherfile.3mf"
2727
filesystem_root = (
2828
"file:///mnt/sdcard/"
29-
if self._printer._settings.get_boolean(["device_type"]) in ["X1", "X1C"]
29+
if self._printer._settings.get(["device_type"]) in ["X1", "X1C"]
3030
else "file:///"
3131
)
3232

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-BambuPrinter"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.1.1"
17+
plugin_version = "0.1.2"
1818

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

0 commit comments

Comments
 (0)