From d5eefcd1a55af5be49b2db41dfaec995b1b2868f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 16 Mar 2019 09:34:04 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20virtual:=20fix=20homing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/virtual_printer/virtual.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/virtual_printer/virtual.py b/src/octoprint/plugins/virtual_printer/virtual.py index 72f8de7dc..8bbc16986 100644 --- a/src/octoprint/plugins/virtual_printer/virtual.py +++ b/src/octoprint/plugins/virtual_printer/virtual.py @@ -620,7 +620,7 @@ class VirtualPrinter(object): self._setPosition(data) def _gcode_G28(self, data): - self._performMove(data) + self._home(data) def _gcode_G0(self, data): # simulate reprap buffered commands via a Queue with maxsize which internally simulates the moves @@ -1116,6 +1116,30 @@ class VirtualPrinter(object): except: pass + def _home(self, line): + x = y = z = e = None + + if "X" in line: + x = True + if "Y" in line: + y = True + if "Z" in line: + z = True + if "E" in line: + e = True + + if x is None and y is None and z is None and e is None: + self._lastX = self._lastY = self._lastZ = self._lastE[self.currentExtruder] = 0 + else: + if x: + self._lastX = 0 + if y: + self._lastY = 0 + if z: + self._lastZ = 0 + if e: + self._lastE = 0 + def _writeSdFile(self, filename): if filename.startswith("/"): filename = filename[1:]