Bugfix: extruder temperature only changes when the temperature differs from the one last set (wipe tower)

This commit is contained in:
Lukas Matena 2018-05-11 17:35:42 +02:00
parent 71b4337036
commit b6db3767a2
2 changed files with 8 additions and 10 deletions

View File

@ -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;

View File

@ -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;