Skip to content

Commit

Permalink
馃悰 virtual: fix parsing of negative coordinates
Browse files Browse the repository at this point in the history
Closes #3080
  • Loading branch information
foosel committed Mar 16, 2019
1 parent b2637eb commit c1670d0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/octoprint/plugins/virtual_printer/virtual.py
Expand Up @@ -1002,10 +1002,10 @@ def _parseBedCommand(self, line, wait=False, support_r=False):
self._send("TargetBed:%d" % self.bedTargetTemp)

def _performMove(self, line):
matchX = re.search("X([0-9.]+)", line)
matchY = re.search("Y([0-9.]+)", line)
matchZ = re.search("Z([0-9.]+)", line)
matchE = re.search("E([0-9.]+)", line)
matchX = re.search("X(-?[0-9.]+)", line)
matchY = re.search("Y(-?[0-9.]+)", line)
matchZ = re.search("Z(-?[0-9.]+)", line)
matchE = re.search("E(-?[0-9.]+)", line)
matchF = re.search("F([0-9.]+)", line)

duration = 0.0
Expand Down Expand Up @@ -1087,10 +1087,10 @@ def _performMove(self, line):
time.sleep(duration)

def _setPosition(self, line):
matchX = re.search("X([0-9.]+)", line)
matchY = re.search("Y([0-9.]+)", line)
matchZ = re.search("Z([0-9.]+)", line)
matchE = re.search("E([0-9.]+)", line)
matchX = re.search("X(-?[0-9.]+)", line)
matchY = re.search("Y(-?[0-9.]+)", line)
matchZ = re.search("Z(-?[0-9.]+)", line)
matchE = re.search("E(-?[0-9.]+)", line)

if matchX is None and matchY is None and matchZ is None and matchE is None:
self._lastX = self._lastY = self._lastZ = self._lastE[self.currentExtruder] = 0
Expand Down

0 comments on commit c1670d0

Please sign in to comment.