🐛 Fix pause action command on Marlin

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.
This commit is contained in:
Uri Shaked committed 2020-08-11 23:52:18 +03:00
1 parent 5ca20f741a
commit a11c3895ef
2 files changed
+8 -6

No files matched your search

+1
View File
@@ -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
+7 -6
View File
@@ -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: