From a3b843b24e4426c18ab9179d26e543a83071be24 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 2 Mar 2015 23:56:38 +0100 Subject: [PATCH] Bugfix: temperature was not set correctly when using sequential printing. Includes regression test. #2702 --- lib/Slic3r/Print/GCode.pm | 1 + t/gcode.t | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 72ac2d38e..bdc928685 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -217,6 +217,7 @@ sub export { } $self->flush_filters; $finished_objects++; + $self->_second_layer_things_done(0); } } } else { diff --git a/t/gcode.t b/t/gcode.t index 2bb18094c..79ab1a7de 100644 --- a/t/gcode.t +++ b/t/gcode.t @@ -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'; } {