From b6db3767a2dfca86cbf275e543da6ce00d035f91 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 11 May 2018 17:35:42 +0200 Subject: [PATCH] Bugfix: extruder temperature only changes when the temperature differs from the one last set (wipe tower) --- xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp | 17 +++++++---------- xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp index 80d4fdf074..f328d839f8 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp @@ -275,12 +275,9 @@ public: // Set extruder temperature, don't wait by default. Writer& set_extruder_temp(int temperature, bool wait = false) { - if (temperature != current_temp) { - char buf[128]; - sprintf(buf, "M%d S%d\n", wait ? 109 : 104, temperature); - m_gcode += buf; - current_temp = temperature; - } + char buf[128]; + sprintf(buf, "M%d S%d\n", wait ? 109 : 104, temperature); + m_gcode += buf; return *this; }; @@ -395,10 +392,8 @@ private: float m_wipe_tower_width = 0.f; float m_wipe_tower_depth = 0.f; float m_last_fan_speed = 0.f; - int current_temp = -1; - std::string - set_format_X(float x) + std::string set_format_X(float x) { char buf[64]; sprintf(buf, " X%.3f", x); @@ -810,8 +805,10 @@ void WipeTowerPrusaMM::toolchange_Unload( .travel(old_x, writer.y()) // in case previous move was shortened to limit feedrate .resume_preview(); - if (new_temperature != 0) // Set the extruder temperature, but don't wait. + if (new_temperature != 0 && new_temperature != m_old_temperature ) { // Set the extruder temperature, but don't wait. writer.set_extruder_temp(new_temperature, false); + m_old_temperature = new_temperature; + } // Cooling: const int& number_of_moves = m_filpar[m_current_tool].cooling_moves; diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp index 6744aa917d..ea1c1f631e 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp @@ -196,6 +196,7 @@ private: float m_layer_height = 0.f; // Current layer height. size_t m_max_color_changes = 0; // Maximum number of color changes per layer. bool m_is_first_layer = false;// Is this the 1st layer of the print? If so, print the brim around the waste tower. + int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary) // G-code generator parameters. float m_cooling_tube_retraction = 0.f;