mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 05:19:06 +08:00
Minor fix to pressure management: support the case where speed is set before printing commands with a dedicated G1 Fx line
This commit is contained in:
parent
ff9b53260d
commit
43cbad8867
@ -6,6 +6,7 @@ has 'enable' => (is => 'rw', default => sub { 0 });
|
|||||||
has 'reader' => (is => 'ro', default => sub { Slic3r::GCode::Reader->new });
|
has 'reader' => (is => 'ro', default => sub { Slic3r::GCode::Reader->new });
|
||||||
has '_extrusion_axis' => (is => 'rw', default => sub { "E" });
|
has '_extrusion_axis' => (is => 'rw', default => sub { "E" });
|
||||||
has '_tool' => (is => 'rw', default => sub { 0 });
|
has '_tool' => (is => 'rw', default => sub { 0 });
|
||||||
|
has '_last_print_F' => (is => 'rw', default => sub { 0 });
|
||||||
has '_advance' => (is => 'rw', default => sub { 0 }); # extra E injected
|
has '_advance' => (is => 'rw', default => sub { 0 }); # extra E injected
|
||||||
|
|
||||||
use Slic3r::Geometry qw(epsilon);
|
use Slic3r::Geometry qw(epsilon);
|
||||||
@ -34,7 +35,8 @@ sub process {
|
|||||||
$self->_tool($1);
|
$self->_tool($1);
|
||||||
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# This is a print move.
|
# This is a print move.
|
||||||
if (exists $args->{F}) {
|
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.
|
# We are setting a (potentially) new speed, 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)
|
||||||
@ -54,6 +56,8 @@ sub process {
|
|||||||
if !$self->config->use_relative_e_distances;
|
if !$self->config->use_relative_e_distances;
|
||||||
$self->_advance($new_advance);
|
$self->_advance($new_advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->_last_print_F($F);
|
||||||
}
|
}
|
||||||
} 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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user