Pressure advance overrides print speeds patch (#3287)
* Fix PressureRegulation.pm Check if a pressure advance is needed even if speed is unchanged, but a discharge happened before. Restore print speed after advance / discharge. Solves #3282
This commit is contained in:
parent
27a1a6609f
commit
b8ece2af06
1 changed files with 5 additions and 4 deletions
|
@ -38,8 +38,8 @@ sub process {
|
||||||
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# This is a print move.
|
# This is a print move.
|
||||||
my $F = $args->{F} // $reader->F;
|
my $F = $args->{F} // $reader->F;
|
||||||
if ($F != $self->_last_print_F) {
|
if ($F != $self->_last_print_F || ($F == $self->_last_print_F && $self->_advance == 0)) {
|
||||||
# We are setting a (potentially) new speed, so we calculate the new advance amount.
|
# We are setting a (potentially) new speed or a discharge event happend since the last speed change, so we calculate the new advance amount.
|
||||||
|
|
||||||
# First calculate relative flow rate (mm of filament over mm of travel)
|
# First calculate relative flow rate (mm of filament over mm of travel)
|
||||||
my $rel_flow_rate = $info->{dist_E} / $info->{dist_XY};
|
my $rel_flow_rate = $info->{dist_E} / $info->{dist_XY};
|
||||||
|
@ -56,6 +56,7 @@ sub process {
|
||||||
$self->_extrusion_axis, $new_E, $self->_unretract_speed;
|
$self->_extrusion_axis, $new_E, $self->_unretract_speed;
|
||||||
$new_gcode .= sprintf "G92 %s%.5f ; restore E\n", $self->_extrusion_axis, $reader->E
|
$new_gcode .= sprintf "G92 %s%.5f ; restore E\n", $self->_extrusion_axis, $reader->E
|
||||||
if !$self->config->use_relative_e_distances;
|
if !$self->config->use_relative_e_distances;
|
||||||
|
$new_gcode .= sprintf "G1 F%.3f ; restore F\n", $F;
|
||||||
$self->_advance($new_advance);
|
$self->_advance($new_advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ sub process {
|
||||||
}
|
}
|
||||||
} elsif (($info->{retracting} || $cmd eq 'G10') && $self->_advance != 0) {
|
} elsif (($info->{retracting} || $cmd eq 'G10') && $self->_advance != 0) {
|
||||||
# We need to bring pressure to zero when retracting.
|
# We need to bring pressure to zero when retracting.
|
||||||
$new_gcode .= $self->_discharge($args->{F});
|
$new_gcode .= $self->_discharge($args->{F}, $args->{F} // $reader->F);
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_gcode .= "$info->{raw}\n";
|
$new_gcode .= "$info->{raw}\n";
|
||||||
|
@ -77,7 +78,7 @@ sub process {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _discharge {
|
sub _discharge {
|
||||||
my ($self, $F) = @_;
|
my ($self, $F, $oldSpeed) = @_;
|
||||||
|
|
||||||
my $new_E = ($self->config->use_relative_e_distances ? 0 : $self->reader->E) - $self->_advance;
|
my $new_E = ($self->config->use_relative_e_distances ? 0 : $self->reader->E) - $self->_advance;
|
||||||
my $gcode = sprintf "G1 %s%.5f F%.3f ; pressure discharge\n",
|
my $gcode = sprintf "G1 %s%.5f F%.3f ; pressure discharge\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue