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:
authorEnrico Turri <enricoturri@seznam.cz>2017-12-12 15:44:52 +0300
committerEnrico Turri <enricoturri@seznam.cz>2017-12-12 15:44:52 +0300
commit20234c94eee03e7e361a91fafedf5c1a753baed5 (patch)
treee88d4802732178fc975be4c94e38fab0f2821174 /xs/src/libslic3r
parente199d0532c04087eedd99c5104230d61332d4156 (diff)
GCodeTimeEstimator - added retract_acceleration, minimum_travel_feedrate members and process of M201 gcode
Diffstat (limited to 'xs/src/libslic3r')
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.cpp92
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.hpp19
2 files changed, 92 insertions, 19 deletions
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp
index b0dd62713..b6caaf79e 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.cpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp
@@ -6,16 +6,14 @@ static const std::string AXIS_STR = "XYZE";
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
static const float MILLISEC_TO_SEC = 0.001f;
static const float INCHES_TO_MM = 25.4f;
-static const float DEFAULT_FEEDRATE = 0.0f; // <<<<<<<<< FIND A PROPER VALUE
-static const float DEFAULT_ACCELERATION = 3000.0f;
-static const float DEFAULT_AXIS_MAX_FEEDRATE[] = { 600.0f, 600.0f, 40.0f, 25.0f };
-static const float DEFAULT_AXIS_MAX_ACCELERATION[] = { 9000.0f, 9000.0f, 100.0f, 10000.0f };
-
-static const float DEFAULT_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.2f, 2.5f }; // from Firmware
-//static const float DEFAULT_AXIS_MAX_JERK[] = { 20.0f, 20.0f, 0.4f, 5.0f }; // from Cura
-
-static const float DEFAULT_MINIMUM_FEEDRATE = 0.0f; // from Firmware
-//static const float DEFAULT_MINIMUM_FEEDRATE = 0.01f; // from Cura
+static const float DEFAULT_FEEDRATE = 1500.0f; // from Prusa Firmware (Marlin_main.cpp)
+static const float DEFAULT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2
+static const float DEFAULT_RETRACT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2
+static const float DEFAULT_AXIS_MAX_FEEDRATE[] = { 500.0f, 500.0f, 12.0f, 120.0f }; // Prusa Firmware 1_75mm_MK2
+static const float DEFAULT_AXIS_MAX_ACCELERATION[] = { 9000.0f, 9000.0f, 500.0f, 10000.0f }; // Prusa Firmware 1_75mm_MK2
+static const float DEFAULT_AXIS_MAX_JERK[] = { 10.0f, 10.0f, 0.2f, 2.5f }; // from Prusa Firmware (Configuration.h)
+static const float DEFAULT_MINIMUM_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h)
+static const float DEFAULT_MINIMUM_TRAVEL_FEEDRATE = 0.0f; // from Prusa Firmware (Configuration_adv.h)
#if USE_CURA_JUNCTION_VMAX
static const float MINIMUM_PLANNER_SPEED = 0.05f; // from Cura <<<<<<<< WHAT IS THIS ???
@@ -69,6 +67,16 @@ namespace Slic3r {
return (length > 0.0f) ? length : ::abs(delta_pos[E]);
}
+ float GCodeTimeEstimator::Block::is_extruder_only_move() const
+ {
+ return (delta_pos[X] == 0.0f) && (delta_pos[Y] == 0.0f) && (delta_pos[Z] == 0.0f) && (delta_pos[E] != 0.0f);
+ }
+
+ float GCodeTimeEstimator::Block::is_travel_move() const
+ {
+ return delta_pos[E] == 0.0f;
+ }
+
float GCodeTimeEstimator::Block::acceleration_time() const
{
return trapezoid.acceleration_time(acceleration);
@@ -210,9 +218,9 @@ namespace Slic3r {
return _state.feedrate;
}
- void GCodeTimeEstimator::set_acceleration(float acceleration)
+ void GCodeTimeEstimator::set_acceleration(float acceleration_mm_sec2)
{
- _state.acceleration = acceleration;
+ _state.acceleration = acceleration_mm_sec2;
}
float GCodeTimeEstimator::get_acceleration() const
@@ -220,6 +228,16 @@ namespace Slic3r {
return _state.acceleration;
}
+ void GCodeTimeEstimator::set_retract_acceleration(float acceleration_mm_sec2)
+ {
+ _state.retract_acceleration = acceleration_mm_sec2;
+ }
+
+ float GCodeTimeEstimator::get_retract_acceleration() const
+ {
+ return _state.retract_acceleration;
+ }
+
void GCodeTimeEstimator::set_minimum_feedrate(float feedrate_mm_sec)
{
_state.minimum_feedrate = feedrate_mm_sec;
@@ -230,6 +248,16 @@ namespace Slic3r {
return _state.minimum_feedrate;
}
+ void GCodeTimeEstimator::set_minimum_travel_feedrate(float feedrate_mm_sec)
+ {
+ _state.minimum_travel_feedrate = feedrate_mm_sec;
+ }
+
+ float GCodeTimeEstimator::get_minimum_travel_feedrate() const
+ {
+ return _state.minimum_travel_feedrate;
+ }
+
void GCodeTimeEstimator::set_dialect(GCodeTimeEstimator::EDialect dialect)
{
_state.dialect = dialect;
@@ -294,7 +322,9 @@ namespace Slic3r {
set_feedrate(DEFAULT_FEEDRATE);
set_acceleration(DEFAULT_ACCELERATION);
+ set_retract_acceleration(DEFAULT_RETRACT_ACCELERATION);
set_minimum_feedrate(DEFAULT_MINIMUM_FEEDRATE);
+ set_minimum_travel_feedrate(DEFAULT_MINIMUM_TRAVEL_FEEDRATE);
for (unsigned char a = X; a < Num_Axis; ++a)
{
@@ -432,6 +462,11 @@ namespace Slic3r {
_processM109(line);
break;
}
+ case 201: // Set max printing acceleration
+ {
+ _processM201(line);
+ break;
+ }
case 203: // Set maximum feedrate
{
_processM203(line);
@@ -503,7 +538,7 @@ namespace Slic3r {
return;
// calculates block feedrate
- _curr.feedrate = std::max(get_feedrate(), get_minimum_feedrate());
+ _curr.feedrate = std::max(get_feedrate(), block.is_travel_move() ? get_minimum_travel_feedrate() : get_minimum_feedrate());
float distance = block.move_length();
float invDistance = 1.0f / distance;
@@ -526,7 +561,7 @@ namespace Slic3r {
}
// calculates block acceleration
- float acceleration = get_acceleration();
+ float acceleration = block.is_extruder_only_move() ? get_retract_acceleration() : get_acceleration();
for (unsigned char a = X; a < Num_Axis; ++a)
{
@@ -766,6 +801,26 @@ namespace Slic3r {
// todo
}
+ void GCodeTimeEstimator::_processM201(const GCodeReader::GCodeLine& line)
+ {
+ EDialect 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;
+
+ if (line.has('X'))
+ set_axis_max_acceleration(X, line.get_float('X') * factor);
+
+ if (line.has('Y'))
+ set_axis_max_acceleration(Y, line.get_float('Y') * factor);
+
+ if (line.has('Z'))
+ set_axis_max_acceleration(Z, line.get_float('Z') * factor);
+
+ if (line.has('E'))
+ set_axis_max_acceleration(E, line.get_float('E') * factor);
+ }
+
void GCodeTimeEstimator::_processM203(const GCodeReader::GCodeLine& line)
{
EDialect dialect = get_dialect();
@@ -793,12 +848,10 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM204(const GCodeReader::GCodeLine& line)
{
if (line.has('S'))
- set_acceleration(line.get_float('S')); // <<<< Is this correct ?
+ set_acceleration(line.get_float('S'));
if (line.has('T'))
- {
- // what to do ?
- }
+ set_retract_acceleration(line.get_float('T'));
}
void GCodeTimeEstimator::_processM205(const GCodeReader::GCodeLine& line)
@@ -821,6 +874,9 @@ namespace Slic3r {
if (line.has('S'))
set_minimum_feedrate(line.get_float('S'));
+
+ if (line.has('T'))
+ set_minimum_travel_feedrate(line.get_float('T'));
}
void GCodeTimeEstimator::_processM566(const GCodeReader::GCodeLine& line)
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.hpp b/xs/src/libslic3r/GCodeTimeEstimator.hpp
index 36d66f435..e173ab413 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.hpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.hpp
@@ -72,8 +72,10 @@ namespace Slic3r {
Axis axis[Num_Axis];
float feedrate; // mm/s
float acceleration; // mm/s^2
+ float retract_acceleration; // mm/s^2
float additional_time; // s
float minimum_feedrate; // mm/s
+ float minimum_travel_feedrate; // mm/s
};
public:
@@ -128,6 +130,12 @@ namespace Slic3r {
// Returns the length of the move covered by this block, in mm
float move_length() const;
+ // Returns true if this block is a retract/unretract move only
+ float is_extruder_only_move() const;
+
+ // Returns true if this block is a move with no extrusion
+ float is_travel_move() const;
+
// Returns the time spent accelerating toward cruise speed, in seconds
float acceleration_time() const;
@@ -199,12 +207,18 @@ namespace Slic3r {
void set_feedrate(float feedrate_mm_sec);
float get_feedrate() const;
- void set_acceleration(float acceleration);
+ void set_acceleration(float acceleration_mm_sec2);
float get_acceleration() const;
+ void set_retract_acceleration(float acceleration_mm_sec2);
+ float get_retract_acceleration() const;
+
void set_minimum_feedrate(float feedrate_mm_sec);
float get_minimum_feedrate() const;
+ void set_minimum_travel_feedrate(float feedrate_mm_sec);
+ float get_minimum_travel_feedrate() const;
+
void set_dialect(EDialect dialect);
EDialect get_dialect() const;
@@ -274,6 +288,9 @@ namespace Slic3r {
// Set Extruder Temperature and Wait
void _processM109(const GCodeReader::GCodeLine& line);
+ // Set max printing acceleration
+ void _processM201(const GCodeReader::GCodeLine& line);
+
// Set maximum feedrate
void _processM203(const GCodeReader::GCodeLine& line);