From a11c3895efdc2d9bffde4e7e2f82d4bfd0427547 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Tue, 11 Aug 2020 23:23:13 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20pause=20action=20command?= =?UTF-8?q?=20on=20Marlin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Marlin pauses due the filament run out, it sends the following line: ``` //action:pause filament_runout 0 ``` The current code compares the entire string with `pause`, so Marlin's action is silently ignored. This fix compares the first word with `pause`, so it should work correctly with Marlin filament run out detection feature. --- AUTHORS.md | 1 + src/octoprint/util/comm.py | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index db2e16367..8482501b2 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -122,6 +122,7 @@ date of first contribution): * [Lachlan Cresswell](https://github.com/lachyc) * [Khoi Pham](https://github.com/osubuu) * [Federico Nembrini](https://github.com/FedericoNembrini) + * [Uri Shaked](https://github.com/urish) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 5411ee287..fd3da71a5 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1761,23 +1761,24 @@ class MachineCom(object): debugging_output = line[2:].strip() if debugging_output.startswith("action:"): action_command = debugging_output[len("action:"):].strip() + action_command_name = action_command.split(' ')[0].strip() - if action_command == "cancel": + if action_command_name == "cancel": self._log("Cancelling on request of the printer...") self.cancelPrint() - elif action_command == "pause": + elif action_command_name == "pause": self._log("Pausing on request of the printer...") self.setPause(True) - elif action_command == "paused": + elif action_command_name == "paused": self._log("Printer signalled that it paused, switching state...") self.setPause(True, local_handling=False) - elif action_command == "resume": + elif action_command_name == "resume": self._log("Resuming on request of the printer...") self.setPause(False) - elif action_command == "resumed": + elif action_command_name == "resumed": self._log("Printer signalled that it resumed, switching state...") self.setPause(False, local_handling=False) - elif action_command == "disconnect": + elif action_command_name == "disconnect": self._log("Disconnecting on request of the printer...") self._callback.on_comm_force_disconnect() else: