Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-01-06 20:49:28 +0300
committerbubnikv <bubnikv@gmail.com>2018-01-06 20:49:28 +0300
commitfec1fcdca8805cd6db95095abdaea5952e22d513 (patch)
tree7d6946c2b8386ff0606e5a3dbc430ff6ebfc9e63 /xs/src/libslic3r
parent60a6e7ba8e88e43a9b5234cac0855d2b77875988 (diff)
Separated the Marlin G-code flavor from the RepRap G-code flavor
due to the differences in the M203 code (RepRap firmware has it in mm/min, Marlin in mm/sec). This difference is important to the G-code time estimator. Changed the g-code flavor to Marlin for all Prusa3D bundled profiles.
Diffstat (limited to 'xs/src/libslic3r')
-rw-r--r--xs/src/libslic3r/GCode.cpp1
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.cpp26
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.hpp18
-rw-r--r--xs/src/libslic3r/GCodeWriter.cpp2
-rw-r--r--xs/src/libslic3r/Print.cpp4
-rw-r--r--xs/src/libslic3r/PrintConfig.cpp7
-rw-r--r--xs/src/libslic3r/PrintConfig.hpp4
7 files changed, 29 insertions, 33 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index e85b21f80..d22040799 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -400,6 +400,7 @@ void GCode::_do_export(Print &print, FILE *file)
// resets time estimator
m_time_estimator.reset();
+ m_time_estimator.set_dialect(print.config.gcode_flavor);
// How many times will be change_layer() called?
// change_layer() in turn increments the progress bar status.
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp
index 2ebeb9fd2..2edbfeac5 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.cpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp
@@ -302,12 +302,12 @@ namespace Slic3r {
return _state.extrude_factor_override_percentage;
}
- void GCodeTimeEstimator::set_dialect(GCodeTimeEstimator::EDialect dialect)
+ void GCodeTimeEstimator::set_dialect(GCodeFlavor dialect)
{
_state.dialect = dialect;
}
- GCodeTimeEstimator::EDialect GCodeTimeEstimator::get_dialect() const
+ GCodeFlavor GCodeTimeEstimator::get_dialect() const
{
return _state.dialect;
}
@@ -360,7 +360,7 @@ namespace Slic3r {
void GCodeTimeEstimator::set_default()
{
set_units(Millimeters);
- set_dialect(Unknown);
+ set_dialect(gcfRepRap);
set_positioning_xyz_type(Absolute);
set_positioning_e_type(Relative);
@@ -738,17 +738,17 @@ namespace Slic3r {
void GCodeTimeEstimator::_processG4(const GCodeReader::GCodeLine& line)
{
- EDialect dialect = get_dialect();
+ GCodeFlavor dialect = get_dialect();
float value;
if (line.has_value('P', value))
add_additional_time(value * MILLISEC_TO_SEC);
// see: http://reprap.org/wiki/G-code#G4:_Dwell
- if ((dialect == Repetier) ||
- (dialect == Marlin) ||
- (dialect == Smoothieware) ||
- (dialect == RepRapFirmware))
+ if ((dialect == gcfRepetier) ||
+ (dialect == gcfMarlin) ||
+ (dialect == gcfSmoothie) ||
+ (dialect == gcfRepRap))
{
if (line.has_value('S', value))
add_additional_time(value);
@@ -846,10 +846,10 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM201(const GCodeReader::GCodeLine& line)
{
- EDialect dialect = get_dialect();
+ GCodeFlavor dialect = get_dialect();
// see http://reprap.org/wiki/G-code#M201:_Set_max_printing_acceleration
- float factor = ((dialect != RepRapFirmware) && (get_units() == GCodeTimeEstimator::Inches)) ? INCHES_TO_MM : 1.0f;
+ float factor = ((dialect != gcfRepRap) && (get_units() == GCodeTimeEstimator::Inches)) ? INCHES_TO_MM : 1.0f;
if (line.has_x())
set_axis_max_acceleration(X, line.x() * factor);
@@ -866,14 +866,14 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM203(const GCodeReader::GCodeLine& line)
{
- EDialect dialect = get_dialect();
+ GCodeFlavor dialect = get_dialect();
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
- if (dialect == Repetier)
+ if (dialect == gcfRepetier)
return;
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
- float factor = (dialect == Marlin) ? 1.0f : MMMIN_TO_MMSEC;
+ float factor = (dialect == gcfMarlin) ? 1.0f : MMMIN_TO_MMSEC;
if (line.has_x())
set_axis_max_feedrate(X, line.x() * factor);
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.hpp b/xs/src/libslic3r/GCodeTimeEstimator.hpp
index 46f866972..9e429462e 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.hpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.hpp
@@ -2,6 +2,7 @@
#define slic3r_GCodeTimeEstimator_hpp_
#include "libslic3r.h"
+#include "PrintConfig.hpp"
#include "GCodeReader.hpp"
namespace Slic3r {
@@ -24,17 +25,6 @@ namespace Slic3r {
Num_Axis
};
- enum EDialect : unsigned char
- {
- Unknown,
- Marlin,
- Repetier,
- Smoothieware,
- RepRapFirmware,
- Teacup,
- Num_Dialects
- };
-
enum EPositioningType : unsigned char
{
Absolute,
@@ -62,7 +52,7 @@ namespace Slic3r {
struct State
{
- EDialect dialect;
+ GCodeFlavor dialect;
EUnits units;
EPositioningType positioning_xyz_type;
EPositioningType positioning_e_type;
@@ -222,8 +212,8 @@ namespace Slic3r {
void set_extrude_factor_override_percentage(float percentage);
float get_extrude_factor_override_percentage() const;
- void set_dialect(EDialect dialect);
- EDialect get_dialect() const;
+ void set_dialect(GCodeFlavor dialect);
+ GCodeFlavor get_dialect() const;
void set_units(EUnits units);
EUnits get_units() const;
diff --git a/xs/src/libslic3r/GCodeWriter.cpp b/xs/src/libslic3r/GCodeWriter.cpp
index abf55114b..cbe94f317 100644
--- a/xs/src/libslic3r/GCodeWriter.cpp
+++ b/xs/src/libslic3r/GCodeWriter.cpp
@@ -42,7 +42,7 @@ std::string GCodeWriter::preamble()
gcode << "G21 ; set units to millimeters\n";
gcode << "G90 ; use absolute coordinates\n";
}
- if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)) {
+ if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfMarlin) || 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 {
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 773998394..0bc63f2f3 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -567,8 +567,8 @@ std::string Print::validate() const
if (std::abs(dmr - 0.4) > EPSILON)
return "The Wipe Tower is currently only supported for the 0.4mm nozzle diameter.";
#endif
- if (this->config.gcode_flavor != gcfRepRap)
- return "The Wipe Tower is currently only supported for the RepRap (Marlin / Sprinter) G-code flavor.";
+ if (this->config.gcode_flavor != gcfRepRap && this->config.gcode_flavor != gcfMarlin)
+ return "The Wipe Tower is currently only supported for the Marlin and RepRap/Sprinter G-code flavors.";
if (! this->config.use_relative_e_distances)
return "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).";
SlicingParameters slicing_params0 = this->objects.front()->slicing_parameters();
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index 902914536..0dc6c9d43 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -653,21 +653,23 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("repetier");
def->enum_values.push_back("teacup");
def->enum_values.push_back("makerware");
+ def->enum_values.push_back("marlin");
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)");
+ def->enum_labels.push_back("RepRap/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("Marlin");
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("Smoothie");
def->enum_labels.push_back("No extrusion");
- def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap);
+ def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfMarlin);
def = this->add("infill_acceleration", coFloat);
def->label = "Infill";
@@ -1919,6 +1921,7 @@ std::string FullPrintConfig::validate()
if (this->use_firmware_retraction.value &&
this->gcode_flavor.value != gcfSmoothie &&
this->gcode_flavor.value != gcfRepRap &&
+ this->gcode_flavor.value != gcfMarlin &&
this->gcode_flavor.value != gcfMachinekit &&
this->gcode_flavor.value != gcfRepetier)
return "--use-firmware-retraction is only supported by Marlin, Smoothie, Repetier and Machinekit firmware";
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index ab58aa356..4394fcac1 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -23,7 +23,8 @@
namespace Slic3r {
enum GCodeFlavor {
- gcfRepRap, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit, gcfNoExtrusion, gcfSmoothie, gcfRepetier,
+ gcfRepRap, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfSailfish, gcfMach3, gcfMachinekit,
+ gcfSmoothie, gcfNoExtrusion,
};
enum InfillPattern {
@@ -50,6 +51,7 @@ template<> inline t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get_enum_
keys_map["repetier"] = gcfRepetier;
keys_map["teacup"] = gcfTeacup;
keys_map["makerware"] = gcfMakerWare;
+ keys_map["marlin"] = gcfMarlin;
keys_map["sailfish"] = gcfSailfish;
keys_map["smoothie"] = gcfSmoothie;
keys_map["mach3"] = gcfMach3;