After issuing the color change custom G-code, which is most likely

just M600, reset the internal retract counter, so that a retract
will happen after the firmware returns from M600 to the initial position.

Fixes "Blobs on print after manual color change #6362"
This commit is contained in:
Vojtech Bubnik 2021-04-15 16:29:30 +02:00 committed by remi durand
parent 573d2d8a22
commit f1ef8a013f
2 changed files with 7 additions and 2 deletions

View File

@ -1905,6 +1905,7 @@ std::vector<GCode::InstanceToPrint> GCode::sort_print_object_instances(
}
std::string GCode::emit_custom_gcode_per_print_z(
GCode &gcodegen,
const CustomGCode::Item *custom_gcode,
// ID of the first extruder printing this layer.
uint16_t first_extruder_id,
@ -1966,6 +1967,10 @@ std::string GCode::emit_custom_gcode_per_print_z(
} else {
gcode += print.config().color_change_gcode;//ColorChangeCode;
gcode += "\n";
//FIXME Tell G-code writer that M600 filled the extruder, thus the G-code writer shall reset the extruder to unretracted state after
// return from M600. Thus the G-code generated by the following line is ignored.
// see GH issue #6362
gcodegen.writer().unretract();
}
} else {
if (gcode_type == CustomGCode::PausePrint) // Pause print
@ -2186,7 +2191,7 @@ void GCode::process_layer(
if (single_object_instance_idx == size_t(-1)) {
// Normal (non-sequential) print.
gcode += this->emit_custom_gcode_per_print_z(layer_tools.custom_gcode, first_extruder_id, print, print_stat);
gcode += this->emit_custom_gcode_per_print_z(*this, layer_tools.custom_gcode, first_extruder_id, print, print_stat);
}
// Extrude skirt at the print_z of the raft layers and normal object layers
// not at the print_z of the interlaced support material layers.

View File

@ -183,7 +183,7 @@ public:
static void append_full_config(const Print& print, std::string& str);
// called by porcess_layer, do the color change / custom gcode
std::string emit_custom_gcode_per_print_z(const CustomGCode::Item* custom_gcode, uint16_t first_extruder_id, const Print& print, PrintStatistics& stats);
std::string emit_custom_gcode_per_print_z(GCode& gcodegen, const CustomGCode::Item* custom_gcode, uint16_t first_extruder_id, const Print& print, PrintStatistics& stats);
// Object and support extrusions of the same PrintObject at the same print_z.
// public, so that it could be accessed by free helper functions from GCode.cpp