From 9ff44c49a6e73f7538d7dbd3c3308ef234735e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 21 May 2019 14:20:41 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20broken=20tool=20filtering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/util/comm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 69a17d642..9acc6272e 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -3479,7 +3479,7 @@ class MachineCom(object): if not self._validate_tool(new_tool): self._log("Not queuing T{}, that tool doesn't exist according to the printer profile or " "was reported as invalid by the firmware".format(new_tool)) - return None + return None, before = self._getGcodeScript("beforeToolChange", replacements=dict(tool=dict(old=current_tool, new=new_tool))) after = self._getGcodeScript("afterToolChange", replacements=dict(tool=dict(old=current_tool, new=new_tool))) @@ -3496,15 +3496,19 @@ class MachineCom(object): return convert(before) + [cmd] + convert(after) - def _gcode_T_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs): + def _gcode_T_sending(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs): toolMatch = regexes_parameters["intT"].search(cmd) if toolMatch: new_tool = int(toolMatch.group("value")) if not self._validate_tool(new_tool): self._log("Not sending T{}, that tool doesn't exist according to the printer profile or " "was reported as invalid by the firmware".format(new_tool)) - return None + return None, + def _gcode_T_sent(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs): + toolMatch = regexes_parameters["intT"].search(cmd) + if toolMatch: + new_tool = int(toolMatch.group("value")) self._toolBeforeChange = self._currentTool self._currentTool = new_tool eventManager().fire(Events.TOOL_CHANGE, dict(old=self._toolBeforeChange, new=self._currentTool))