Add regression test to ensure fan is enabled when printing overhangs. #432
This commit is contained in:
parent
c707073a73
commit
19b40baf55
3 changed files with 20 additions and 4 deletions
|
@ -860,7 +860,7 @@ END
|
||||||
},
|
},
|
||||||
'bridge_fan_speed' => {
|
'bridge_fan_speed' => {
|
||||||
label => 'Bridges fan speed',
|
label => 'Bridges fan speed',
|
||||||
tooltip => 'This fan speed is enforced during all bridges.',
|
tooltip => 'This fan speed is enforced during all bridges and overhangs.',
|
||||||
sidetext => '%',
|
sidetext => '%',
|
||||||
cli => 'bridge-fan-speed=i',
|
cli => 'bridge-fan-speed=i',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
|
|
|
@ -590,7 +590,7 @@ sub _Gx {
|
||||||
|
|
||||||
$gcode .= sprintf " ; %s", $comment if $comment && $self->config->gcode_comments;
|
$gcode .= sprintf " ; %s", $comment if $comment && $self->config->gcode_comments;
|
||||||
if ($append_bridge_off) {
|
if ($append_bridge_off) {
|
||||||
$gcode .= "\n;_BRIDGE_FAN_END";
|
$gcode = ";_BRIDGE_FAN_END\n$gcode";
|
||||||
}
|
}
|
||||||
return "$gcode\n";
|
return "$gcode\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ use Slic3r::Test;
|
||||||
$config->set('perimeters', 3);
|
$config->set('perimeters', 3);
|
||||||
$config->set('top_solid_layers', 0);
|
$config->set('top_solid_layers', 0);
|
||||||
$config->set('bottom_solid_layers', 0);
|
$config->set('bottom_solid_layers', 0);
|
||||||
$config->set('cooling', 0); # to prevent speeds to be altered
|
$config->set('cooling', 0); # to prevent speeds from being altered
|
||||||
$config->set('first_layer_speed', '100%'); # to prevent speeds to be altered
|
$config->set('first_layer_speed', '100%'); # to prevent speeds from being altered
|
||||||
|
|
||||||
{
|
{
|
||||||
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
||||||
|
@ -45,18 +45,34 @@ use Slic3r::Test;
|
||||||
$config->set('perimeter_speed', 77);
|
$config->set('perimeter_speed', 77);
|
||||||
$config->set('external_perimeter_speed', 66);
|
$config->set('external_perimeter_speed', 66);
|
||||||
$config->set('bridge_speed', 99);
|
$config->set('bridge_speed', 99);
|
||||||
|
$config->set('cooling', 1);
|
||||||
|
$config->set('fan_below_layer_time', 0);
|
||||||
|
$config->set('slowdown_below_layer_time', 0);
|
||||||
|
$config->set('bridge_fan_speed', 100);
|
||||||
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
||||||
my %layer_speeds = (); # print Z => [ speeds ]
|
my %layer_speeds = (); # print Z => [ speeds ]
|
||||||
|
my $fan_speed = 0;
|
||||||
Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
|
Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
|
||||||
my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
|
|
||||||
|
$fan_speed = 0 if $cmd eq 'M107';
|
||||||
|
$fan_speed = $args->{S} if $cmd eq 'M106';
|
||||||
if ($info->{extruding} && $info->{dist_XY} > 0) {
|
if ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
$layer_speeds{$self->Z} ||= {};
|
$layer_speeds{$self->Z} ||= {};
|
||||||
$layer_speeds{$self->Z}{my $feedrate = $args->{F} // $self->F} = 1;
|
$layer_speeds{$self->Z}{my $feedrate = $args->{F} // $self->F} = 1;
|
||||||
|
|
||||||
fail 'wrong speed found'
|
fail 'wrong speed found'
|
||||||
if $feedrate != $config->perimeter_speed*60
|
if $feedrate != $config->perimeter_speed*60
|
||||||
&& $feedrate != $config->external_perimeter_speed*60
|
&& $feedrate != $config->external_perimeter_speed*60
|
||||||
&& $feedrate != $config->bridge_speed*60;
|
&& $feedrate != $config->bridge_speed*60;
|
||||||
|
|
||||||
|
if ($feedrate == $config->bridge_speed*60) {
|
||||||
|
fail 'printing overhang but fan is not enabled or running at wrong speed'
|
||||||
|
if $fan_speed != 255;
|
||||||
|
} else {
|
||||||
|
fail 'fan is running when not supposed to'
|
||||||
|
if $fan_speed > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
is scalar(grep { keys %$_ > 1 } values %layer_speeds), 1,
|
is scalar(grep { keys %$_ > 1 } values %layer_speeds), 1,
|
||||||
|
|
Loading…
Reference in a new issue