Fixed some regressions in retracts and wipe. Includes regression test
This commit is contained in:
parent
a4eef93950
commit
11bd1e68e2
@ -192,7 +192,7 @@ sub extrude_loop {
|
||||
# reset acceleration
|
||||
$gcode .= $self->writer->set_acceleration($self->config->default_acceleration);
|
||||
|
||||
$self->_wipe_path($paths[-1]->polyline->clone) if $self->enable_wipe; # TODO: don't limit wipe to last path
|
||||
$self->_wipe_path($paths[0]->polyline->clone) if $self->enable_wipe; # TODO: don't limit wipe to last path
|
||||
|
||||
# make a little move inwards before leaving loop
|
||||
if ($paths[-1]->role == EXTR_ROLE_EXTERNAL_PERIMETER && defined $self->layer && $self->config->perimeters > 1) {
|
||||
@ -422,9 +422,10 @@ sub retract {
|
||||
|
||||
# get the retraction length
|
||||
my $length = $toolchange
|
||||
? $self->writer->extruder->retract_length
|
||||
: $self->writer->extruder->retract_length_toolchange;
|
||||
? $self->writer->extruder->retract_length_toolchange
|
||||
: $self->writer->extruder->retract_length;
|
||||
|
||||
if ($length) {
|
||||
# Calculate how long we need to travel in order to consume the required
|
||||
# amount of retraction. In other words, how far do we move in XY at $wipe_speed
|
||||
# for the time needed to consume retract_length at retract_speed?
|
||||
@ -456,6 +457,7 @@ sub retract {
|
||||
}
|
||||
$self->writer->extruder->set_retracted($self->writer->extruder->retracted + $retracted);
|
||||
}
|
||||
}
|
||||
|
||||
# The parent class will decide whether we need to perform an actual retraction
|
||||
# (the extruder might be already retracted fully or partially). We call these
|
||||
@ -464,7 +466,8 @@ sub retract {
|
||||
$gcode .= $toolchange ? $self->writer->retract_for_toolchange : $self->writer->retract;
|
||||
|
||||
$gcode .= $self->writer->reset_e;
|
||||
$gcode .= $self->writer->lift;
|
||||
$gcode .= $self->writer->lift
|
||||
if $self->writer->extruder->retract_length > 0;
|
||||
|
||||
return $gcode;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use Test::More tests => 14;
|
||||
use Test::More tests => 16;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -127,16 +127,21 @@ use Slic3r::Test qw(_eq);
|
||||
|
||||
{
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('start_gcode', ''); # prevent any default priming Z move from affecting our lift detection
|
||||
$config->set('retract_length', [0]);
|
||||
$config->set('retract_layer_change', [0]);
|
||||
$config->set('retract_lift', [0.2]);
|
||||
|
||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||
my $retracted = 0;
|
||||
my $layer_changes_with_retraction = 0;
|
||||
my $retractions = my $z_restores = 0;
|
||||
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if ($info->{retracting}) {
|
||||
$retracted = 1;
|
||||
$retractions++;
|
||||
} elsif ($info->{extruding} && $retracted) {
|
||||
$retracted = 0;
|
||||
}
|
||||
@ -144,9 +149,14 @@ use Slic3r::Test qw(_eq);
|
||||
if ($info->{dist_Z} && $retracted) {
|
||||
$layer_changes_with_retraction++;
|
||||
}
|
||||
if ($info->{dist_Z} && $args->{Z} < $self->Z) {
|
||||
$z_restores++;
|
||||
}
|
||||
});
|
||||
|
||||
is $layer_changes_with_retraction, 0, 'no retraction on layer change';
|
||||
is $retractions, 0, 'no retractions';
|
||||
is $z_restores, 0, 'no lift';
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user