🐛 Fix sending of M876 while printing

We need to immediately force it into the send queue and not allow it to
get pushed into the command queue. Otherwise it will be stuck there
waiting for busy state to end instead of the emergency sending routine
triggering.

Closes #3699
This commit is contained in:
Gina Häußge committed 2020-09-03 17:48:31 +02:00
1 parent f415010337
commit 966c473507
3 files changed
+14 -5

No files matched your search

@@ -221,10 +221,12 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
self._close_prompt()
if "{choice}" in self._command:
self._printer.commands([self._command.format(choice=choice)])
self._printer.commands([self._command.format(choice=choice)],
force=True)
else:
self._printer.commands(["{command} S{choice}".format(command=self._command,
choice=choice)])
choice=choice)],
force=True)
__plugin_name__ = "Action Command Prompt Support"
+2 -1
View File
@@ -175,7 +175,7 @@ class PrinterInterface(object):
"""
raise NotImplementedError()
def commands(self, commands, tags=None, *args, **kwargs):
def commands(self, commands, tags=None, force=False, *args, **kwargs):
"""
Sends the provided ``commands`` to the printer.
@@ -183,6 +183,7 @@ class PrinterInterface(object):
commands (str, list): The commands to send. Might be a single command provided just as a string or a list
of multiple commands to send in order.
tags (set of str): An optional set of tags to attach to the command(s) throughout their lifecycle
force (bool): Whether to force sending of the command right away or allow queuing while printing
"""
raise NotImplementedError()
+8 -2
View File
@@ -303,7 +303,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._comm.fakeOk()
def commands(self, commands, *args, **kwargs):
def commands(self, commands, tags=None, force=False, *args, **kwargs):
"""
Sends one or more gcode commands to the printer.
"""
@@ -313,8 +313,14 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if not isinstance(commands, (list, tuple)):
commands = [commands]
if tags is None:
tags = set()
tags |= {"trigger:printer.commands"}
for command in commands:
self._comm.sendCommand(command, tags=kwargs.get("tags", set()) | {"trigger:printer.commands"})
self._comm.sendCommand(command,
tags=tags,
force=force)
def script(self, name, context=None, must_be_set=True, part_of_job=False, *args, **kwargs):
if self._comm is None: