Complete retraction if the wipe path was too short for the full retract. #1264

This commit is contained in:
Alessandro Ranellucci 2013-06-23 00:10:57 +02:00
parent c03f9f0197
commit 1e3ce9b8c4

View File

@ -441,9 +441,16 @@ sub retract {
$self->speed('travel');
# subdivide the retraction
my $retracted = 0;
for (1 .. $#$wipe_path) {
my $segment_length = $wipe_path->[$_-1]->distance_to($wipe_path->[$_]);
$gcode .= $self->G1($wipe_path->[$_], undef, $retract->[2] * ($segment_length / $total_wipe_length), $retract->[3] . ";_WIPE");
$retracted += my $e = $retract->[2] * ($segment_length / $total_wipe_length);
$gcode .= $self->G1($wipe_path->[$_], undef, $e, $retract->[3] . ";_WIPE");
}
if ($retracted > $retract->[2]) {
# if we retracted less than we had to, retract the remainder
# TODO: add regression test
$gcode .= $self->G1(undef, undef, $retract->[2] - $retracted, $comment);
}
} else {
$self->speed('retract');