diff options
author | Sebastianv650 <sebastian_v650@kabelmail.de> | 2017-01-26 05:27:10 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-02-21 15:09:12 +0300 |
commit | b8ece2af066f3b82fcd601ee6fb4c83cc4ea23b7 (patch) | |
tree | eeb484324bb0aa07a4ef9c4a9f7c29b2175623b0 /lib | |
parent | 27a1a6609fb2b745f5397f66a690691f88ca118d (diff) |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Slic3r/GCode/PressureRegulator.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Slic3r/GCode/PressureRegulator.pm b/lib/Slic3r/GCode/PressureRegulator.pm index 725cfb83a..19c10a62f 100644 --- a/lib/Slic3r/GCode/PressureRegulator.pm +++ b/lib/Slic3r/GCode/PressureRegulator.pm @@ -38,8 +38,8 @@ sub process { } elsif ($info->{extruding} && $info->{dist_XY} > 0) { # This is a print move. my $F = $args->{F} // $reader->F; - if ($F != $self->_last_print_F) { - # We are setting a (potentially) new speed, so we calculate the new advance amount. + if ($F != $self->_last_print_F || ($F == $self->_last_print_F && $self->_advance == 0)) { + # 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) my $rel_flow_rate = $info->{dist_E} / $info->{dist_XY}; @@ -56,6 +56,7 @@ sub process { $self->_extrusion_axis, $new_E, $self->_unretract_speed; $new_gcode .= sprintf "G92 %s%.5f ; restore E\n", $self->_extrusion_axis, $reader->E if !$self->config->use_relative_e_distances; + $new_gcode .= sprintf "G1 F%.3f ; restore F\n", $F; $self->_advance($new_advance); } @@ -63,7 +64,7 @@ sub process { } } elsif (($info->{retracting} || $cmd eq 'G10') && $self->_advance != 0) { # 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"; @@ -77,7 +78,7 @@ sub process { } 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 $gcode = sprintf "G1 %s%.5f F%.3f ; pressure discharge\n", |