Adapt the new gcode.t test to master (and subtract final retraction from used filament length)
This commit is contained in:
parent
9515acf527
commit
ed3a6349c7
@ -83,8 +83,8 @@ sub extrude {
|
||||
}
|
||||
|
||||
sub extruded_volume {
|
||||
my ($self) = @_;
|
||||
return $self->absolute_E * ($self->filament_diameter**2) * PI/4;
|
||||
my ($self, $E) = @_;
|
||||
return $E * ($self->filament_diameter**2) * PI/4;
|
||||
}
|
||||
|
||||
sub e_per_mm {
|
||||
|
@ -977,11 +977,15 @@ sub write_gcode {
|
||||
$self->total_extruded_volume(0);
|
||||
foreach my $extruder_id (@{$self->extruders}) {
|
||||
my $extruder = $gcodegen->extruders->{$extruder_id};
|
||||
$self->total_used_filament($self->total_used_filament + $extruder->absolute_E);
|
||||
$self->total_extruded_volume($self->total_extruded_volume + $extruder->extruded_volume);
|
||||
# the final retraction doesn't really count as "used filament"
|
||||
my $used_filament = $extruder->absolute_E + $extruder->retract_length;
|
||||
my $extruded_volume = $extruder->extruded_volume($used_filament);
|
||||
|
||||
printf $fh "; filament used = %.1fmm (%.1fcm3)\n",
|
||||
$extruder->absolute_E, $extruder->extruded_volume/1000;
|
||||
$used_filament, $extruded_volume/1000;
|
||||
|
||||
$self->total_used_filament($self->total_used_filament + $used_filament);
|
||||
$self->total_extruded_volume($self->total_extruded_volume + $extruded_volume);
|
||||
}
|
||||
|
||||
# append full config
|
||||
|
@ -78,8 +78,7 @@ use Slic3r::Test;
|
||||
|
||||
|
||||
});
|
||||
# account for one single retraction at the end of the print
|
||||
ok $print->extruders->[0]->absolute_E + $config->retract_length->[0] > 0, 'total filament length is positive';
|
||||
ok $print->total_used_filament > 0, 'final retraction is not considered in total used filament';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
Loading…
Reference in New Issue
Block a user