Skip to content

Commit

Permalink
Fix for non-firmware retraction
Browse files Browse the repository at this point in the history
  • Loading branch information
adammhaile committed May 29, 2022
1 parent 82b239b commit ba612cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions rrfpost/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ def wipe_tower_fix(self):

if unretract_insert is not None:
if l.line.startswith('; CP TOOLCHANGE WIPE'):
# print(unretract_insert.pre)
# print(unretract_insert.line)
out_lines.append(unretract_insert)
unretract_insert = None
suppress_moves = False
Expand All @@ -438,20 +440,33 @@ def wipe_tower_fix(self):

out_lines.append(l)
if l.IsRetract():
if self.lines[i+1].line.startswith('G1 Z'):
l.post = self.lines[i+1].line
self.lines[i+1].line = ''
last_retract = (len(out_lines)-1, l)

if l.IsUnretract():
if self.lines[i-1].line.startswith('G1 Z'):
l.pre = self.lines[i-1].line
self.lines[i-1].line = ''
last_unretract = (len(out_lines)-1, l)

if suppress_moves and isinstance(l, ToolChange):
suppress_moves = False

if l.line.startswith('; CP TOOLCHANGE START'):
ri, rl = last_retract
ui, ul = last_unretract
if ui == ri+2:
out_lines[ri+1].RemoveMove()

if ui >= ri+2:
for j in range(ri+1, ui):
if out_lines[j].line:
out_lines[j].RemoveMove()
unretract_insert = GCodeLine(ul.num, ul.line)
unretract_insert.pre = ul.pre
out_lines[ui].pre = None
out_lines[ui].line = ''

suppress_moves = True

last_retract = (-1, None)
Expand Down
2 changes: 1 addition & 1 deletion rrfpost/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION='0.10.0'
VERSION='0.10.1'

0 comments on commit ba612cc

Please sign in to comment.