Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
馃悰 virtual: fix homing
  • Loading branch information
foosel committed Mar 16, 2019
1 parent c1670d0 commit d5eefcd
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/octoprint/plugins/virtual_printer/virtual.py
Expand Up @@ -620,7 +620,7 @@ def _gcode_G92(self, data):
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
Expand Down Expand Up @@ -1116,6 +1116,30 @@ def _setPosition(self, line):
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:]
Expand Down

0 comments on commit d5eefcd

Please sign in to comment.