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))