diff options
author | bubnikv <bubnikv@gmail.com> | 2017-06-22 13:59:23 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-06-22 13:59:23 +0300 |
commit | 0454cc95f949f1d7818566c466b313f56c352ca4 (patch) | |
tree | ec8c4694908a0ab0a2e7b06cb19c25c0505f9418 /xs/src/libslic3r/GCode.hpp | |
parent | c1146e298b8ff96bd029bad494627c5a6b547f56 (diff) |
Ported the cooling changes from @alexrj: Don't slow down the external
perimeters if not necessary, don't take the bridging time into account
when slowing down the print.
Removed Extruder & GCodeWriter Perl bindings.
Improved Extruder for constness.
Refactored GCode::m_elapsed_time to struct ElapsedTime.
Diffstat (limited to 'xs/src/libslic3r/GCode.hpp')
-rw-r--r-- | xs/src/libslic3r/GCode.hpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/xs/src/libslic3r/GCode.hpp b/xs/src/libslic3r/GCode.hpp index baf37e9c6..9509cf6ab 100644 --- a/xs/src/libslic3r/GCode.hpp +++ b/xs/src/libslic3r/GCode.hpp @@ -107,6 +107,27 @@ private: bool m_brim_done; }; +struct ElapsedTime +{ + ElapsedTime() { this->reset(); } + void reset() { total = bridges = external_perimeters = travel = other = 0.f; } + + ElapsedTime& operator+=(const ElapsedTime &rhs) { + this->total += rhs.total; + this->bridges += rhs.bridges; + this->external_perimeters += rhs.external_perimeters; + this->travel += rhs.travel; + this->other += rhs.other; + return *this; + } + + float total; + float bridges; + float external_perimeters; + float travel; + float other; +}; + class GCode { public: GCode() : @@ -117,7 +138,6 @@ public: m_layer_count(0), m_layer_index(-1), m_layer(nullptr), - m_elapsed_time(0.0), m_volumetric_speed(0), m_last_pos_defined(false), m_last_extrusion_role(erNone), @@ -140,13 +160,13 @@ public: const Layer* layer() const { return m_layer; } GCodeWriter& writer() { return m_writer; } bool enable_cooling_markers() const { return m_enable_cooling_markers; } - float get_reset_elapsed_time() { float t = m_elapsed_time; m_elapsed_time = 0.f; return t; } + ElapsedTime get_reset_elapsed_time() { ElapsedTime et = this->m_elapsed_time; this->m_elapsed_time.reset(); return et; } // For Perl bindings, to be used exclusively by unit tests. unsigned int layer_count() const { return m_layer_count; } void set_layer_count(unsigned int value) { m_layer_count = value; } - float elapsed_time() const { return m_elapsed_time; } - void set_elapsed_time(float value) { m_elapsed_time = value; } + float elapsed_time() const { return m_elapsed_time.total; } + void set_elapsed_time(float value) { m_elapsed_time.total = value; } void apply_print_config(const PrintConfig &print_config); protected: @@ -247,7 +267,7 @@ protected: // This value is not quite precise. First it only accouts for extrusion moves and travel moves, // it does not account for wipe, retract / unretract moves. // second it does not account for the velocity profiles of the printer. - float m_elapsed_time; // seconds + ElapsedTime m_elapsed_time; double m_volumetric_speed; // Support for the extrusion role markers. Which marker is active? ExtrusionRole m_last_extrusion_role; |