diff --git a/docs/features/action_commands.rst b/docs/features/action_commands.rst index 7fcf6063e..fe9dde4f8 100644 --- a/docs/features/action_commands.rst +++ b/docs/features/action_commands.rst @@ -21,8 +21,12 @@ Action commands are a feature defined for the GCODE based RepRap communication p OctoPrint out of the box supports handling of the above mentioned commands: +start + When this command is received from the printer, a job is currently selected and *not* active, OctoPrint + will start it just like if the "Start"/"Restart" button had been clicked. + cancel - When this command is received from the printer, OctoPrint will cancel a current print job like if the + When this command is received from the printer, OctoPrint will cancel a current print job just like if the "Cancel" button had been clicked. pause diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index a1c1d1be2..f5751f38e 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1768,21 +1768,25 @@ class MachineCom(object): action_name = action_command action_params = "" - if action_name == "cancel": + if action_name == "start": + if self._currentFile is not None: + self._log("(Re)Starting current job on request of the printer...") + self.startPrint(tags={"trigger:serial.action_command.start"}) + elif action_name == "cancel": self._log("Cancelling on request of the printer...") - self.cancelPrint() + self.cancelPrint(tags={"trigger:serial.action_command.cancel"}) elif action_name == "pause": self._log("Pausing on request of the printer...") - self.setPause(True) + self.setPause(True, tags={"trigger:serial.action_command.pause"}) elif action_name == "paused": self._log("Printer signalled that it paused, switching state...") - self.setPause(True, local_handling=False) + self.setPause(True, local_handling=False, tags={"trigger:serial.action_command.paused"}) elif action_name == "resume": self._log("Resuming on request of the printer...") - self.setPause(False) + self.setPause(False, tags={"trigger:serial.action_command.resume"}) elif action_name == "resumed": self._log("Printer signalled that it resumed, switching state...") - self.setPause(False, local_handling=False) + self.setPause(False, local_handling=False, tags={"trigger:serial.action_command.resumed"}) elif action_name == "disconnect": self._log("Disconnecting on request of the printer...") self._callback.on_comm_force_disconnect()