Bugfix: temperature was not set correctly when using sequential printing. Includes regression test. #2702

This commit is contained in:
Alessandro Ranellucci 2015-03-02 23:56:38 +01:00
parent 9d435c8f4d
commit a3b843b24e
2 changed files with 10 additions and 1 deletions

View file

@ -217,6 +217,7 @@ sub export {
}
$self->flush_filters;
$finished_objects++;
$self->_second_layer_things_done(0);
}
}
} else {

View file

@ -1,4 +1,4 @@
use Test::More tests => 21;
use Test::More tests => 22;
use strict;
use warnings;
@ -86,6 +86,7 @@ use Slic3r::Test;
# - no hard-coded "E" are generated
# - Z moves are correctly generated for both objects
# - no travel moves go outside skirt
# - temperatures are set correctly
my $config = Slic3r::Config->new_from_defaults;
$config->set('gcode_comments', 1);
$config->set('complete_objects', 1);
@ -93,11 +94,14 @@ use Slic3r::Test;
$config->set('start_gcode', ''); # prevent any default extra Z move
$config->set('layer_height', 0.4);
$config->set('first_layer_height', 0.4);
$config->set('temperature', [200]);
$config->set('first_layer_temperature', [210]);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 2);
ok my $gcode = Slic3r::Test::gcode($print), "complete_objects";
my @z_moves = ();
my @travel_moves = (); # array of scaled points
my @extrusions = (); # array of scaled points
my @temps = ();
Slic3r::GCode::Reader->new->parse($gcode, sub {
my ($self, $cmd, $args, $info) = @_;
fail 'unexpected E argument' if defined $args->{E};
@ -112,6 +116,8 @@ use Slic3r::Test;
push @travel_moves, Slic3r::Point->new_scale($info->{new_X}, $info->{new_Y})
if @extrusions; # skip initial travel move to first skirt point
}
} elsif ($cmd eq 'M104' || $cmd eq 'M109') {
push @temps, $args->{S} if !@temps || $args->{S} != $temps[-1];
}
});
my $layer_count = 20/0.4; # cube is 20mm tall
@ -120,6 +126,8 @@ use Slic3r::Test;
my $convex_hull = convex_hull(\@extrusions);
ok !(defined first { !$convex_hull->contains_point($_) } @travel_moves), 'all travel moves happen within skirt';
is_deeply \@temps, [210, 200, 210, 200, 0], 'expected temperature changes';
}
{