Acceleration control. #185

This commit is contained in:
Alessandro Ranellucci 2012-02-10 14:53:44 +01:00
parent ad8c9d4ea1
commit 74c71b4ef2
5 changed files with 38 additions and 1 deletions

View File

@ -68,6 +68,11 @@ our $solid_infill_speed = 60; # mm/sec
our $bridge_speed = 60; # mm/sec
our $bottom_layer_speed_ratio = 0.3;
# acceleration options
our $acceleration = 0;
our $perimeter_acceleration = 25; # mm/sec^2
our $infill_acceleration = 50; # mm/sec^2
# accuracy options
our $resolution = 0.00000001;
our $small_perimeter_area = (5 / $resolution) ** 2;

View File

@ -133,6 +133,23 @@ our $Options = {
type => 'f',
},
# acceleration options
'acceleration' => {
label => 'Enable acceleration control',
cli => 'acceleration',
type => 'bool',
},
'perimeter_acceleration' => {
label => 'Perimeters (mm/s^2)',
cli => 'perimeter-acceleration',
type => 'f',
},
'infill_acceleration' => {
label => 'Infill (mm/s^2)',
cli => 'infill-acceleration',
type => 'f',
},
# accuracy options
'layer_height' => {
label => 'Layer height (mm)',

View File

@ -233,6 +233,15 @@ sub unretract {
return $gcode;
}
sub set_acceleration {
my $self = shift;
my ($acceleration) = @_;
return unless $Slic3r::acceleration;
return sprintf "M201 E%s%s\n",
$acceleration, ($Slic3r::gcode_comments ? ' ; adjust acceleration' : '');
}
sub G0 {
my $self = shift;
return $self->G1(@_) if !$Slic3r::g0;

View File

@ -35,6 +35,10 @@ sub new {
title => 'Other speed settings',
options => [qw(travel_speed bottom_layer_speed_ratio)],
},
acceleration => {
title => 'Acceleration settings',
options => [qw(acceleration perimeter_acceleration infill_acceleration)],
},
accuracy => {
title => 'Accuracy',
options => [qw(layer_height first_layer_height_ratio infill_every_layers)],
@ -101,7 +105,7 @@ sub new {
my @tabs = (
$make_tab->([qw(transform accuracy skirt)], [qw(print retract)]),
$make_tab->([qw(printer filament)], [qw(print_speed speed)]),
$make_tab->([qw(printer filament)], [qw(print_speed speed acceleration)]),
$make_tab->([qw(gcode)]),
$make_tab->([qw(notes)]),
$make_tab->([qw(extrusion)], [qw(output)]),

View File

@ -502,12 +502,14 @@ sub export_gcode {
print $fh $extruder->change_layer($layer);
# extrude skirts
print $fh $extruder->set_acceleration($Slic3r::perimeter_acceleration);
print $fh $extruder->extrude_loop($_, 'skirt') for @{ $layer->skirts };
# extrude perimeters
print $fh $extruder->extrude($_, 'perimeter') for @{ $layer->perimeters };
# extrude fills
print $fh $extruder->set_acceleration($Slic3r::infill_acceleration);
for my $fill (@{ $layer->fills }) {
print $fh $extruder->extrude_path($_, 'fill')
for $fill->shortest_path($extruder->last_pos);