bed temperature handling. TODO: gui elements

This commit is contained in:
Michael Moon 2012-03-01 14:08:07 +11:00 committed by Alessandro Ranellucci
parent 8566b4f910
commit 35e7877437
2 changed files with 23 additions and 0 deletions

View file

@ -96,12 +96,23 @@ our $Options = {
cli => 'first-layer-temperature=i',
type => 'i',
},
'first_layer_bed_temperature' => {
label => 'First layer bed temperature (°C)',
cli => 'first-layer-bed-temperature=i',
type => 'i',
},
'temperature' => {
label => 'Temperature (°C)',
cli => 'temperature=i',
type => 'i',
important => 1,
},
'bed_temperature' => {
label => 'Bed Temperature (°C)',
cli => 'bed-temperature=i',
type => 'i',
important => 1,
},
# speed options
'travel_speed' => {
@ -597,6 +608,12 @@ sub validate {
die "Invalid value for --bridge-flow-ratio\n"
if $Slic3r::bridge_flow_ratio <= 0;
# --first_layer_temperature
$Slic3r::first_layer_temperature = $Slic3r::temperature unless $Slic3r::first_layer_temperature;
# --first-layer-bed-temperature
$Slic3r::first_layer_bed_temperature = $Slic3r::bed_temperature unless $Slic3r::first_layer_bed_temperature;
# G-code flavors
$Slic3r::extrusion_axis = 'A' if $Slic3r::gcode_flavor eq 'mach3';

View file

@ -586,6 +586,9 @@ sub export_gcode {
print $fh "\n";
# write start commands to file
printf $fh "M190 %s%d ; set bed temperature\n",
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::first_layer_bed_temperature
if $Slic3r::first_layer_bed_temperature && $Slic3r::start_gcode !~ /M190/i;
printf $fh "M104 %s%d ; set temperature\n",
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::first_layer_temperature
if $Slic3r::first_layer_temperature;
@ -626,6 +629,9 @@ sub export_gcode {
printf $fh "M104 %s%d ; set temperature\n",
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature
if $Slic3r::temperature && $Slic3r::temperature != $Slic3r::first_layer_temperature;
printf $fh "M140 %s%d ; set bed temperature\n",
($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::bed_temperature
if $Slic3r::bed_temperature && $Slic3r::bed_temperature != $Slic3r::first_layer_bed_temperature;
}
# go to layer