🐛 virtual: fix homing

This commit is contained in:
Gina Häußge committed 2019-03-16 09:40:55 +01:00
1 parent c1670d03c8
commit d5eefcd1a5
1 file changed
+25 -1
@@ -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:]