Minor code cleanup

This commit is contained in:
Alessandro Ranellucci 2012-10-30 15:53:01 +01:00
parent 92ab53868e
commit d4ccd39ad3

View File

@ -26,18 +26,14 @@ has 'dec' => (is => 'ro', default => sub { 3 } );
# calculate speeds (mm/min) # calculate speeds (mm/min)
has 'speeds' => ( has 'speeds' => (
is => 'ro', is => 'ro',
default => sub {{ default => sub {+{
travel => 60 * $Slic3r::Config->get_value('travel_speed'), map { $_ => 60 * $Slic3r::Config->get_value("${_}_speed") }
perimeter => 60 * $Slic3r::Config->get_value('perimeter_speed'), qw(travel perimeter small_perimeter external_perimeter infill
small_perimeter => 60 * $Slic3r::Config->get_value('small_perimeter_speed'), solid_infill top_solid_infill bridge),
external_perimeter => 60 * $Slic3r::Config->get_value('external_perimeter_speed'),
infill => 60 * $Slic3r::Config->get_value('infill_speed'),
solid_infill => 60 * $Slic3r::Config->get_value('solid_infill_speed'),
top_solid_infill => 60 * $Slic3r::Config->get_value('top_solid_infill_speed'),
bridge => 60 * $Slic3r::Config->get_value('bridge_speed'),
}}, }},
); );
# assign speeds to roles
my %role_speeds = ( my %role_speeds = (
&EXTR_ROLE_PERIMETER => 'perimeter', &EXTR_ROLE_PERIMETER => 'perimeter',
&EXTR_ROLE_SMALLPERIMETER => 'small_perimeter', &EXTR_ROLE_SMALLPERIMETER => 'small_perimeter',
@ -56,10 +52,9 @@ sub move_z {
my $self = shift; my $self = shift;
my ($z, $comment) = @_; my ($z, $comment) = @_;
$z = $z * &Slic3r::SCALING_FACTOR; $z *= &Slic3r::SCALING_FACTOR;
my $gcode = ""; my $gcode = "";
my $current_z = $self->z; my $current_z = $self->z;
if (!defined $current_z || $current_z != ($z + $self->lifted)) { if (!defined $current_z || $current_z != ($z + $self->lifted)) {
$gcode .= $self->retract(move_z => $z); $gcode .= $self->retract(move_z => $z);