Merge pull request #3373 from lordofhyphens/smoothie-flavor

Adds Smoothieware flavor to Gcode
This commit is contained in:
Joseph Lenox 2016-06-23 19:13:26 -05:00 committed by GitHub
commit cb72967fd8
7 changed files with 13 additions and 8 deletions

View File

@ -132,7 +132,7 @@ The author of the Silk icon set is Mark James.
(default: 100,100) (default: 100,100)
--z-offset Additional height in mm to add to vertical coordinates --z-offset Additional height in mm to add to vertical coordinates
(+/-, default: 0) (+/-, default: 0)
--gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/no-extrusion, --gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
default: reprap) default: reprap)
--use-relative-e-distances Enable this to get relative E values (default: no) --use-relative-e-distances Enable this to get relative E values (default: no)
--use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no) --use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no)

View File

@ -236,7 +236,7 @@ sub validate {
if !first { $_ eq $self->gcode_flavor } @{$Options->{gcode_flavor}{values}}; if !first { $_ eq $self->gcode_flavor } @{$Options->{gcode_flavor}{values}};
die "--use-firmware-retraction is only supported by Marlin firmware\n" die "--use-firmware-retraction is only supported by Marlin firmware\n"
if $self->use_firmware_retraction && $self->gcode_flavor ne 'reprap' && $self->gcode_flavor ne 'machinekit'; if $self->use_firmware_retraction && $self->gcode_flavor ne 'smoothie' && $self->gcode_flavor ne 'reprap' && $self->gcode_flavor ne 'machinekit';
die "--use-firmware-retraction is not compatible with --wipe\n" die "--use-firmware-retraction is not compatible with --wipe\n"
if $self->use_firmware_retraction && first {$_} @{$self->wipe}; if $self->use_firmware_retraction && first {$_} @{$self->wipe};

View File

@ -296,7 +296,7 @@ $j
(default: 100,100) (default: 100,100)
--z-offset Additional height in mm to add to vertical coordinates --z-offset Additional height in mm to add to vertical coordinates
(+/-, default: $config->{z_offset}) (+/-, default: $config->{z_offset})
--gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/no-extrusion, --gcode-flavor The type of G-code to generate (reprap/teacup/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
default: $config->{gcode_flavor}) default: $config->{gcode_flavor})
--use-relative-e-distances Enable this to get relative E values (default: no) --use-relative-e-distances Enable this to get relative E values (default: no)
--use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no) --use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no)

View File

@ -4,6 +4,8 @@
#include <cstdlib> #include <cstdlib>
#include <math.h> #include <math.h>
#define FLAVOR_IS(val) this->config.gcode_flavor == val
namespace Slic3r { namespace Slic3r {
AvoidCrossingPerimeters::AvoidCrossingPerimeters() AvoidCrossingPerimeters::AvoidCrossingPerimeters()
@ -700,8 +702,8 @@ GCode::retract(bool toolchange)
methods even if we performed wipe, since this will ensure the entire retraction methods even if we performed wipe, since this will ensure the entire retraction
length is honored in case wipe path was too short. */ length is honored in case wipe path was too short. */
gcode += toolchange ? this->writer.retract_for_toolchange() : this->writer.retract(); gcode += toolchange ? this->writer.retract_for_toolchange() : this->writer.retract();
if (!(FLAVOR_IS(gcfSmoothie) && this->config.use_firmware_retraction))
gcode += this->writer.reset_e(); gcode += this->writer.reset_e();
if (this->writer.extruder()->retract_length() > 0 || this->config.use_firmware_retraction) if (this->writer.extruder()->retract_length() > 0 || this->config.use_firmware_retraction)
gcode += this->writer.lift(); gcode += this->writer.lift();

View File

@ -54,7 +54,7 @@ GCodeWriter::preamble()
gcode << "G21 ; set units to millimeters\n"; gcode << "G21 ; set units to millimeters\n";
gcode << "G90 ; use absolute coordinates\n"; gcode << "G90 ; use absolute coordinates\n";
} }
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup)) { if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfSmoothie)) {
if (this->config.use_relative_e_distances) { if (this->config.use_relative_e_distances) {
gcode << "M83 ; use relative distances for extrusion\n"; gcode << "M83 ; use relative distances for extrusion\n";
} else { } else {
@ -441,7 +441,7 @@ GCodeWriter::_retract(double length, double restart_extra, const std::string &co
length = length * area; length = length * area;
restart_extra = restart_extra * area; restart_extra = restart_extra * area;
} }
double dE = this->_extruder->retract(length, restart_extra); double dE = this->_extruder->retract(length, restart_extra);
if (dE != 0) { if (dE != 0) {
if (this->config.use_firmware_retraction) { if (this->config.use_firmware_retraction) {

View File

@ -468,6 +468,7 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("sailfish"); def->enum_values.push_back("sailfish");
def->enum_values.push_back("mach3"); def->enum_values.push_back("mach3");
def->enum_values.push_back("machinekit"); def->enum_values.push_back("machinekit");
def->enum_values.push_back("smoothie");
def->enum_values.push_back("no-extrusion"); def->enum_values.push_back("no-extrusion");
def->enum_labels.push_back("RepRap (Marlin/Sprinter/Repetier)"); def->enum_labels.push_back("RepRap (Marlin/Sprinter/Repetier)");
def->enum_labels.push_back("Teacup"); def->enum_labels.push_back("Teacup");
@ -475,6 +476,7 @@ PrintConfigDef::PrintConfigDef()
def->enum_labels.push_back("Sailfish (MakerBot)"); def->enum_labels.push_back("Sailfish (MakerBot)");
def->enum_labels.push_back("Mach3/LinuxCNC"); def->enum_labels.push_back("Mach3/LinuxCNC");
def->enum_labels.push_back("Machinekit"); def->enum_labels.push_back("Machinekit");
def->enum_labels.push_back("Smoothieware");
def->enum_labels.push_back("No extrusion"); def->enum_labels.push_back("No extrusion");
def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap); def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap);

View File

@ -9,7 +9,7 @@
namespace Slic3r { namespace Slic3r {
enum GCodeFlavor { enum GCodeFlavor {
gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfSmoothie,
}; };
enum InfillPattern { enum InfillPattern {
@ -34,6 +34,7 @@ template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_v
keys_map["mach3"] = gcfMach3; keys_map["mach3"] = gcfMach3;
keys_map["machinekit"] = gcfMachinekit; keys_map["machinekit"] = gcfMachinekit;
keys_map["no-extrusion"] = gcfNoExtrusion; keys_map["no-extrusion"] = gcfNoExtrusion;
keys_map["smoothie"] = gcfSmoothie;
return keys_map; return keys_map;
} }