bugfix #136 (wait_for_toolchange_temp from skinnydip)

This commit is contained in:
supermerill 2020-01-09 20:23:56 +01:00
parent c5fbfae095
commit 2530af7a9f

View File

@ -326,14 +326,12 @@ public:
{ {
char all[128]; char all[128];
if (fan_on == true){ if (fan_on == true){
sprintf(all, "M106 S%u ;Part fan on to cool hotend\n",(unsigned int)(255.0 * fan_speed / 100.0)); set_fan(fan_speed, " ;Part fan on to cool hotend");
this->append(all);
} }
sprintf(all, "M109 S%d ;SKINNYDIP TOOLCHANGE WAIT FOR TEMP %s\n", tc_temp, fast ? "FAST MODE":"NORMAL MODE"); sprintf(all, "M109 S%d ;SKINNYDIP TOOLCHANGE WAIT FOR TEMP %s\n", tc_temp, fast ? "FAST MODE":"NORMAL MODE");
this->append(all); this->append(all);
if (fan_on == true){ if (fan_on == true){
sprintf(all, "M106 S0 ;Fan off\n"); //turn off fan set_fan(m_last_fan_speed, " ;restore cooling");
this->append(all);
} }
return *this; return *this;
} }
@ -429,14 +427,14 @@ public:
} }
WipeTowerWriter& set_fan(unsigned speed) WipeTowerWriter& set_fan(unsigned speed, const std::string &comment)
{ {
if (speed == m_last_fan_speed) if (speed == m_last_fan_speed)
return *this; return *this;
if (speed == 0) if (speed == 0)
m_gcode += "M107\n"; m_gcode += "M107\n";
else else
m_gcode += "M106 S" + std::to_string(unsigned(255.0 * speed / 100.0)) + "\n"; m_gcode += "M106 S" + std::to_string(unsigned(255.0 * speed / 100.0)) + comment + "\n";
m_last_fan_speed = speed; m_last_fan_speed = speed;
return *this; return *this;
} }