Fix reset on layer change by keeping it all the time

This commit is contained in:
Martin Šach 2024-03-06 15:42:31 +01:00 committed by Lukas Matena
parent d556969b2b
commit 1c2e3aed74
2 changed files with 8 additions and 4 deletions

View File

@ -2816,8 +2816,9 @@ std::string GCodeGenerator::change_layer(
std::optional{to_3d(this->point_to_gcode(*this->last_position), previous_layer_z)} :
std::nullopt;
gcode += GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change_Retraction_Start);
gcode += this->retract_and_wipe();
gcode += this->retract_and_wipe(false, false);
gcode += GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change_Retraction_End);
gcode += m_writer.reset_e();
}
Vec3d new_position = this->writer().get_position();
@ -3589,7 +3590,7 @@ std::string GCodeGenerator::travel_to(
return wipe_retract_gcode + generate_travel_gcode(travel, comment, insert_gcode);
}
std::string GCodeGenerator::retract_and_wipe(bool toolchange)
std::string GCodeGenerator::retract_and_wipe(bool toolchange, bool reset_e)
{
std::string gcode;
@ -3607,7 +3608,10 @@ std::string GCodeGenerator::retract_and_wipe(bool toolchange)
methods even if we performed wipe, since this will ensure the entire retraction
length is honored in case wipe path was too short. */
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
gcode += m_writer.reset_e();
if (reset_e) {
gcode += m_writer.reset_e();
}
return gcode;
}

View File

@ -340,7 +340,7 @@ private:
bool needs_retraction(const Polyline &travel, ExtrusionRole role = ExtrusionRole::None);
std::string retract_and_wipe(bool toolchange = false);
std::string retract_and_wipe(bool toolchange = false, bool reset_e = true);
std::string unretract() { return m_writer.unretract(); }
std::string set_extruder(unsigned int extruder_id, double print_z);
bool line_distancer_is_required(const std::vector<unsigned int>& extruder_ids);