From b6a09abb83de59a908b8a27bc06370e654482706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 24 May 2017 17:51:01 +0200 Subject: [PATCH] Fix an issue causing non-gcode commands not to be sent Introduced by multi-command returns from comm handlers --- src/octoprint/util/comm.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index f99e1e31..482d96ef 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2239,18 +2239,23 @@ class MachineCom(object): # if it's a gcode command send it through the specific handler if it exists new_results = [] + modified = False for command, command_type, gcode in results: if gcode is not None: gcode_handler = "_gcode_" + gcode + "_" + phase if hasattr(self, gcode_handler): handler_results = getattr(self, gcode_handler)(command, cmd_type=command_type) new_results += _normalize_command_handler_result(command, command_type, gcode, handler_results) + modified = True else: new_results.append((command, command_type, gcode)) - if not new_results: - # gcode handler returned None or empty list for all commands, so we'll stop here and return a full out empty result - return [] - results = new_results + modified = True + if modified: + if not new_results: + # gcode handler returned None or empty list for all commands, so we'll stop here and return a full out empty result + return [] + else: + results = new_results # send it through the phase specific command handler if it exists command_phase_handler = "_command_phase_" + phase