Skip to content

Commit

Permalink
Merge pull request #3373 from lordofhyphens/smoothie-flavor
Browse files Browse the repository at this point in the history
Adds Smoothieware flavor to Gcode
  • Loading branch information
lordofhyphens committed Jun 24, 2016
2 parents 3623134 + 0673389 commit cb72967
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -132,7 +132,7 @@ The author of the Silk icon set is Mark James.
(default: 100,100)
--z-offset Additional height in mm to add to vertical coordinates
(+/-, 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)
--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)
Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/Config.pm
Expand Up @@ -236,7 +236,7 @@ sub validate {
if !first { $_ eq $self->gcode_flavor } @{$Options->{gcode_flavor}{values}};

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"
if $self->use_firmware_retraction && first {$_} @{$self->wipe};
Expand Down
2 changes: 1 addition & 1 deletion slic3r.pl
Expand Up @@ -296,7 +296,7 @@ sub usage {
(default: 100,100)
--z-offset Additional height in mm to add to vertical coordinates
(+/-, 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})
--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)
Expand Down
6 changes: 4 additions & 2 deletions xs/src/libslic3r/GCode.cpp
Expand Up @@ -4,6 +4,8 @@
#include <cstdlib>
#include <math.h>

#define FLAVOR_IS(val) this->config.gcode_flavor == val

namespace Slic3r {

AvoidCrossingPerimeters::AvoidCrossingPerimeters()
Expand Down Expand Up @@ -700,8 +702,8 @@ GCode::retract(bool toolchange)
methods even if we performed wipe, since this will ensure the entire retraction
length is honored in case wipe path was too short. */
gcode += toolchange ? this->writer.retract_for_toolchange() : this->writer.retract();

gcode += this->writer.reset_e();
if (!(FLAVOR_IS(gcfSmoothie) && this->config.use_firmware_retraction))
gcode += this->writer.reset_e();
if (this->writer.extruder()->retract_length() > 0 || this->config.use_firmware_retraction)
gcode += this->writer.lift();

Expand Down
4 changes: 2 additions & 2 deletions xs/src/libslic3r/GCodeWriter.cpp
Expand Up @@ -54,7 +54,7 @@ GCodeWriter::preamble()
gcode << "G21 ; set units to millimeters\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) {
gcode << "M83 ; use relative distances for extrusion\n";
} else {
Expand Down Expand Up @@ -441,7 +441,7 @@ GCodeWriter::_retract(double length, double restart_extra, const std::string &co
length = length * area;
restart_extra = restart_extra * area;
}

double dE = this->_extruder->retract(length, restart_extra);
if (dE != 0) {
if (this->config.use_firmware_retraction) {
Expand Down
2 changes: 2 additions & 0 deletions xs/src/libslic3r/PrintConfig.cpp
Expand Up @@ -468,13 +468,15 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("sailfish");
def->enum_values.push_back("mach3");
def->enum_values.push_back("machinekit");
def->enum_values.push_back("smoothie");
def->enum_values.push_back("no-extrusion");
def->enum_labels.push_back("RepRap (Marlin/Sprinter/Repetier)");
def->enum_labels.push_back("Teacup");
def->enum_labels.push_back("MakerWare (MakerBot)");
def->enum_labels.push_back("Sailfish (MakerBot)");
def->enum_labels.push_back("Mach3/LinuxCNC");
def->enum_labels.push_back("Machinekit");
def->enum_labels.push_back("Smoothieware");
def->enum_labels.push_back("No extrusion");
def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap);

Expand Down
3 changes: 2 additions & 1 deletion xs/src/libslic3r/PrintConfig.hpp
Expand Up @@ -9,7 +9,7 @@
namespace Slic3r {

enum GCodeFlavor {
gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion,
gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfSmoothie,
};

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

Expand Down

0 comments on commit cb72967

Please sign in to comment.