Acceleration control. #185

This commit is contained in:
Alessandro Ranellucci 2013-01-10 15:29:40 +01:00
parent 34e047205a
commit 32fd58d531
6 changed files with 44 additions and 10 deletions

View File

@ -153,6 +153,17 @@ The author of the Silk icon set is Mark James.
--first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
value or as a percentage over normal speeds (default: 30%)
Acceleration options:
--perimeter-acceleration
Overrides firmware's default acceleration for perimeters. (mm/s^2, set zero
to disable; default: 0)
--infill-acceleration
Overrides firmware's default acceleration for infill. (mm/s^2, set zero
to disable; default: 0)
--default-acceleration
Acceleration will be reset to this value after the specific settings above
have been applied. (mm/s^2, set zero to disable; default: 130)
Accuracy options:
--layer-height Layer height in mm (default: 0.4)
--first-layer-height Layer height for first layer (mm or %, default: 100%)

View File

@ -6,7 +6,7 @@ use utf8;
use List::Util qw(first);
# cemetery of old config settings
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y support_material_tool);
our @Ignore = qw(duplicate_x duplicate_y multiply_x multiply_y support_material_tool acceleration);
my $serialize_comma = sub { join ',', @{$_[0]} };
my $deserialize_comma = sub { [ split /,/, $_[0] ] };
@ -319,25 +319,29 @@ our $Options = {
},
# acceleration options
'acceleration' => {
label => 'Enable acceleration control',
cli => 'acceleration!',
type => 'bool',
'default_acceleration' => {
label => 'Default',
tooltip => 'This is the acceleration your printer will be reset to after the role-specific acceleration values are used (perimeter/infill). Set zero to prevent resetting acceleration at all.',
sidetext => 'mm/s²',
cli => 'default-acceleration',
type => 'f',
default => 0,
},
'perimeter_acceleration' => {
label => 'Perimeters',
tooltip => 'This is the acceleration your printer will use for perimeters. A high value like 9000 usually gives good results if your hardware is up to the job. Set zero to disable acceleration control for perimeters.',
sidetext => 'mm/s²',
cli => 'perimeter-acceleration',
type => 'f',
default => 25,
default => 0,
},
'infill_acceleration' => {
label => 'Infill',
tooltip => 'This is the acceleration your printer will use for infill. Set zero to disable acceleration control for infill.',
sidetext => 'mm/s²',
cli => 'infill-acceleration',
type => 'f',
default => 50,
default => 0,
},
# accuracy options

View File

@ -323,9 +323,9 @@ sub reset_e {
sub set_acceleration {
my $self = shift;
my ($acceleration) = @_;
return "" unless $Slic3r::Config->acceleration;
return "" if !$acceleration;
return sprintf "M201 E%s%s\n",
return sprintf "M204 S%s%s\n",
$acceleration, ($Slic3r::Config->gcode_comments ? ' ; adjust acceleration' : '');
}

View File

@ -430,6 +430,10 @@ sub build {
title => 'Modifiers',
options => [qw(first_layer_speed)],
},
{
title => 'Acceleration control (advanced)',
options => [qw(perimeter_acceleration infill_acceleration default_acceleration)],
},
]);
$self->add_options_page('Skirt and brim', 'box.png', optgroups => [

View File

@ -748,7 +748,6 @@ sub write_gcode {
$gcodegen->set_shift(@shift);
$gcode .= $gcodegen->set_extruder($self->extruders->[0]); # move_z requires extruder
$gcode .= $gcodegen->move_z($gcodegen->layer->print_z);
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
# skip skirt if we have a large brim
if ($layer_id < $Slic3r::Config->skirt_height) {
# distribute skirt loops across all extruders
@ -807,7 +806,10 @@ sub write_gcode {
# extrude perimeters
if (@{ $layerm->perimeters }) {
$gcode .= $gcodegen->set_extruder($region->extruders->{perimeter});
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
$gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layerm->perimeters };
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->default_acceleration)
if $Slic3r::Config->perimeter_acceleration;
}
# extrude fills
@ -822,6 +824,8 @@ sub write_gcode {
$gcode .= $gcodegen->extrude($fill, 'fill') ;
}
}
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->default_acceleration)
if $Slic3r::Config->infill_acceleration;
}
}
}

View File

@ -201,6 +201,17 @@ $j
--first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
value or as a percentage over normal speeds (default: $config->{first_layer_speed})
Acceleration options:
--perimeter-acceleration
Overrides firmware's default acceleration for perimeters. (mm/s^2, set zero
to disable; default: $config->{perimeter_acceleration})
--infill-acceleration
Overrides firmware's default acceleration for infill. (mm/s^2, set zero
to disable; default: $config->{infill_acceleration})
--default-acceleration
Acceleration will be reset to this value after the specific settings above
have been applied. (mm/s^2, set zero to disable; default: $config->{travel_speed})
Accuracy options:
--layer-height Layer height in mm (default: $config->{layer_height})
--first-layer-height Layer height for first layer (mm or %, default: $config->{first_layer_height})