Skip to content

Commit

Permalink
Added Repetier FW flavor, fixed accel gcode generation for it.
Browse files Browse the repository at this point in the history
Addresses slic3r#3426
  • Loading branch information
lordofhyphens committed Jul 16, 2016
1 parent eb49105 commit e0d8101
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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/smoothie/no-extrusion,
--gcode-flavor The type of G-code to generate (reprap/teacup/repetier/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 slic3r.pl
Original file line number Diff line number Diff line change
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/smoothie/no-extrusion,
--gcode-flavor The type of G-code to generate (reprap/teacup/repetier/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
2 changes: 1 addition & 1 deletion utils/zsh/functions/_slic3r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ _arguments -S \
'*--nozzle-diameter[specify nozzle diameter]:nozzle diameter in mm' \
'--print-center[specify print center coordinates]:print center coordinates in mm,mm' \
'--z-offset[specify Z-axis offset]:Z-axis offset in mm' \
'--gcode-flavor[specify the type of G-code to generate]:G-code flavor:(reprap teacup makerware sailfish mach3 machinekit no-extrusion)' \
'--gcode-flavor[specify the type of G-code to generate]:G-code flavor:(reprap teacup repetier makerware sailfish mach3 machinekit no-extrusion)' \
'(--use-relative-e-distances --no-use-relative-e-distances)'--{no-,}use-relative-e-distances'[disable/enable relative E values]' \
'--extrusion-axis[specify letter associated with the extrusion axis]:extrusion axis letter' \
'(--gcode-arcs --no-gcode-arcs)'--{no-,}gcode-arcs'[disable/enable G2/G3 commands for native arcs]' \
Expand Down
9 changes: 7 additions & 2 deletions xs/src/libslic3r/GCodeWriter.cpp
Original file line number Diff line number Diff line change
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) || FLAVOR_IS(gcfSmoothie)) {
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)) {
if (this->config.use_relative_e_distances) {
gcode << "M83 ; use relative distances for extrusion\n";
} else {
Expand Down Expand Up @@ -185,7 +185,12 @@ GCodeWriter::set_acceleration(unsigned int acceleration)
this->_last_acceleration = acceleration;

std::ostringstream gcode;
gcode << "M204 S" << acceleration;
if (FLAVOR_IS(gcfRepetier)) {
gcode << "M201 X" << acceleration << " Y" << acceleration;
gcode << "M202 X" << acceleration << " Y" << acceleration;
} else {
gcode << "M204 S" << acceleration;
}
if (this->config.gcode_comments) gcode << " ; adjust acceleration";
gcode << "\n";

Expand Down
4 changes: 3 additions & 1 deletion xs/src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,16 @@ PrintConfigDef::PrintConfigDef()
def->cli = "gcode-flavor=s";
def->enum_keys_map = ConfigOptionEnum<GCodeFlavor>::get_enum_values();
def->enum_values.push_back("reprap");
def->enum_values.push_back("repetier");
def->enum_values.push_back("teacup");
def->enum_values.push_back("makerware");
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("RepRap (Marlin/Sprinter)");
def->enum_labels.push_back("Repetier");
def->enum_labels.push_back("Teacup");
def->enum_labels.push_back("MakerWare (MakerBot)");
def->enum_labels.push_back("Sailfish (MakerBot)");
Expand Down
3 changes: 2 additions & 1 deletion xs/src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Slic3r {

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

enum InfillPattern {
Expand All @@ -28,6 +28,7 @@ enum SeamPosition {
template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
t_config_enum_values keys_map;
keys_map["reprap"] = gcfRepRap;
keys_map["repetier"] = gcfRepetier;
keys_map["teacup"] = gcfTeacup;
keys_map["makerware"] = gcfMakerWare;
keys_map["sailfish"] = gcfSailfish;
Expand Down

5 comments on commit e0d8101

@bubnikv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to add Smoothie to ConfigOptionEnum::get_enum_values()

@nebbian
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might have to test this, but when I was mucking around with a post processing script, just setting the X and Y acceleration wasn't enough. Setting X, Y, Z and e did the trick and actually made Repetier accept the acceleration values.

@nebbian
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I don't think that it's correct to use M202 with the same acceleration as M201. When printing I want slow printing acceleration, but fast travel moves.

@lordofhyphens
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look at it later tonight. I don't have a printer running Repetier fw myself so I was working from their documentation.

That it requires all of the items to set the acceleration is likely a bug in Repetier.

Setting both travel and print was a compromise. I was not about to add a separate acceleration item just for Repetier at the time. Slic3r changes the acceleration per print move type (and default).

I originally was going to not touch travel acceleration but that would break some assumptions about Slic3r's control of the acceleration.

@bubnikv this commit has nothing to do with Smoothie.

@lordofhyphens
Copy link
Owner Author

@lordofhyphens lordofhyphens commented on e0d8101 Feb 10, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.