Skip to content

Commit

Permalink
Fix layer time slowdown
Browse files Browse the repository at this point in the history
The recent GCode writer changes which put the speed changes on a line of
their own have caused the layer time slowdown to be ignored by the regex
in CoolingBuffer.pm.

Fixes: #3134
  • Loading branch information
hyperair committed Apr 10, 2016
1 parent 82b07a0 commit 2e2e4e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/Slic3r/GCode/CoolingBuffer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sub flush {
Slic3r::debugf " fan = %d%%, speed = %d%%\n", $fan_speed, $speed_factor * 100;

if ($speed_factor < 1) {
$gcode =~ s/^(?=.*? [XY])(?=.*? E)(?!;_WIPE)(?<!;_BRIDGE_FAN_START\n)(G1 .*?F)(\d+(?:\.\d+)?)/
$gcode =~ s/^(?=.*?;_EXTRUDE_SET_SPEED)(?!.*?;_WIPE)(?<!;_BRIDGE_FAN_START\n)(G1\sF)(\d+(?:\.\d+)?)/
my $new_speed = $2 * $speed_factor;
$1 . sprintf("%.3f", $new_speed < $self->min_print_speed ? $self->min_print_speed : $new_speed)
/gexm;
Expand All @@ -73,6 +73,7 @@ sub flush {
$gcode =~ s/^;_BRIDGE_FAN_END\n/ $self->gcodegen->writer->set_fan($fan_speed, 1) /gmex;
}
$gcode =~ s/;_WIPE//g;
$gcode =~ s/;_EXTRUDE_SET_SPEED//g;

return $gcode;
}
Expand Down
6 changes: 3 additions & 3 deletions xs/src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
/* 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) */
double dE = length * (segment_length / wipe_dist) * 0.95;
gcode += gcodegen.writer.set_speed(wipe_speed*60);
gcode += gcodegen.writer.set_speed(wipe_speed*60, gcodegen.enable_cooling_markers ? ";_WIPE" : "");
gcode += gcodegen.writer.extrude_to_xy(
gcodegen.point_to_gcode(line->b),
-dE,
(std::string)"wipe and retract" + (gcodegen.enable_cooling_markers ? ";_WIPE" : "")
"wipe and retract"
);
retracted += dE;
}
Expand Down Expand Up @@ -562,7 +562,7 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
// extrude arc or line
if (path.is_bridge() && this->enable_cooling_markers)
gcode += ";_BRIDGE_FAN_START\n";
gcode += this->writer.set_speed(F);
gcode += this->writer.set_speed(F, this->enable_cooling_markers ? ";_EXTRUDE_SET_SPEED" : "");
double path_length = 0;
{
std::string comment = this->config.gcode_comments ? description : "";
Expand Down

0 comments on commit 2e2e4e6

Please sign in to comment.