New extruder temperature is only set when it differs from the old one

This commit is contained in:
Lukas Matena 2018-04-04 14:59:31 +02:00
parent 290e3e66c0
commit 706dd7020f

View File

@ -260,10 +260,13 @@ public:
// Set extruder temperature, don't wait by default. // Set extruder temperature, don't wait by default.
Writer& set_extruder_temp(int temperature, bool wait = false) Writer& set_extruder_temp(int temperature, bool wait = false)
{ {
char buf[128]; if (temperature != current_temp) {
sprintf(buf, "M%d S%d\n", wait ? 109 : 104, temperature); char buf[128];
m_gcode += buf; sprintf(buf, "M%d S%d\n", wait ? 109 : 104, temperature);
return *this; m_gcode += buf;
current_temp = temperature;
}
return *this;
}; };
// Wait for a period of time (seconds). // Wait for a period of time (seconds).
@ -377,6 +380,7 @@ private:
float m_wipe_tower_width = 0.f; float m_wipe_tower_width = 0.f;
float m_wipe_tower_depth = 0.f; float m_wipe_tower_depth = 0.f;
float m_last_fan_speed = 0.f; float m_last_fan_speed = 0.f;
int current_temp = -1;
std::string std::string
set_format_X(float x) set_format_X(float x)