From 7073c1244469314e738147d055edfe45db66b052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 28 Jul 2017 13:34:10 +0200 Subject: [PATCH] Virtual printer: Support debug commands while streaming --- src/octoprint/plugins/virtual_printer/virtual.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index a87e16a0..bf08fa03 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -259,6 +259,13 @@ class VirtualPrinter(object): data += "\n" + if data.startswith("!!DEBUG:") or data.strip() == "!!DEBUG": + debug_command = "" + if data.startswith("!!DEBUG:"): + debug_command = data[len("!!DEBUG:"):].strip() + self._debugTrigger(debug_command) + continue + # shortcut for writing to SD if self._writingToSdHandle is not None and not "M29" in data: self._writingToSdHandle.write(data) @@ -269,12 +276,6 @@ class VirtualPrinter(object): from octoprint._version import get_versions self._send("OctoPrint VirtualPrinter v" + get_versions()["version"]) continue - elif data.startswith("!!DEBUG:") or data.strip() == "!!DEBUG": - debug_command = "" - if data.startswith("!!DEBUG:"): - debug_command = data[len("!!DEBUG:"):].strip() - self._debugTrigger(debug_command) - continue # if we are sending oks before command output, send it now if len(data.strip()) > 0 and self._okBeforeCommandOutput: