Merge pull request #3326 from hyperair/fix-cooldown-verbose

Fix cooling not working if !gcode_comments
This commit is contained in:
Joseph Lenox 2016-05-18 21:42:29 -05:00
commit 3d34bed0e3
3 changed files with 6 additions and 4 deletions

View File

@ -177,7 +177,7 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
due to rounding (TODO: test and/or better math for this) */ due to rounding (TODO: test and/or better math for this) */
double dE = length * (segment_length / wipe_dist) * 0.95; double dE = length * (segment_length / wipe_dist) * 0.95;
gcode += gcodegen.writer.set_speed(wipe_speed*60, gcodegen.enable_cooling_markers ? ";_WIPE" : ""); gcode += gcodegen.writer.set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers ? ";_WIPE" : "");
gcode += gcodegen.writer.extrude_to_xy( gcode += gcodegen.writer.extrude_to_xy(
gcodegen.point_to_gcode(line->b), gcodegen.point_to_gcode(line->b),
-dE, -dE,
@ -562,7 +562,7 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
// extrude arc or line // extrude arc or line
if (path.is_bridge() && this->enable_cooling_markers) if (path.is_bridge() && this->enable_cooling_markers)
gcode += ";_BRIDGE_FAN_START\n"; gcode += ";_BRIDGE_FAN_START\n";
gcode += this->writer.set_speed(F, this->enable_cooling_markers ? ";_EXTRUDE_SET_SPEED" : ""); gcode += this->writer.set_speed(F, "", this->enable_cooling_markers ? ";_EXTRUDE_SET_SPEED" : "");
double path_length = 0; double path_length = 0;
{ {
std::string comment = this->config.gcode_comments ? description : ""; std::string comment = this->config.gcode_comments ? description : "";

View File

@ -273,11 +273,13 @@ GCodeWriter::toolchange(unsigned int extruder_id)
} }
std::string std::string
GCodeWriter::set_speed(double F, const std::string &comment) const GCodeWriter::set_speed(double F, const std::string &comment,
const std::string &cooling_marker) const
{ {
std::ostringstream gcode; std::ostringstream gcode;
gcode << "G1 F" << F; gcode << "G1 F" << F;
COMMENT(comment); COMMENT(comment);
gcode << cooling_marker;
gcode << "\n"; gcode << "\n";
return gcode.str(); return gcode.str();
} }

View File

@ -34,7 +34,7 @@ class GCodeWriter {
bool need_toolchange(unsigned int extruder_id) const; bool need_toolchange(unsigned int extruder_id) const;
std::string set_extruder(unsigned int extruder_id); std::string set_extruder(unsigned int extruder_id);
std::string toolchange(unsigned int extruder_id); std::string toolchange(unsigned int extruder_id);
std::string set_speed(double F, const std::string &comment = std::string()) const; std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string()) const;
std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string()); std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string());
std::string travel_to_xyz(const Pointf3 &point, const std::string &comment = std::string()); std::string travel_to_xyz(const Pointf3 &point, const std::string &comment = std::string());
std::string travel_to_z(double z, const std::string &comment = std::string()); std::string travel_to_z(double z, const std::string &comment = std::string());