Fix wipe before ramping travel

This commit is contained in:
Martin Šach 2024-02-15 14:30:28 +01:00
parent 12755cd374
commit e5656a80c2
2 changed files with 12 additions and 4 deletions

View File

@ -2145,13 +2145,13 @@ std::string GCodeGenerator::get_layer_change_gcode(const Vec3d& from, const Vec3
)}; )};
std::string travel_gcode; std::string travel_gcode;
if (this->m_config.retract_before_travel.get_at(extruder_id) < (to - from).norm()) { if (!this->m_config.retract_layer_change.get_at(extruder_id) && this->m_config.retract_before_travel.get_at(extruder_id) < (to - from).norm()) {
travel_gcode += this->retract_and_wipe(); travel_gcode += m_layer_change_wipe;
} }
Vec3d previous_point{this->point_to_gcode(travel.front())}; Vec3d previous_point{this->point_to_gcode(travel.front())};
for (const Vec3crd& point : tcb::span{travel}.subspan(1)) { for (const Vec3crd& point : tcb::span{travel}.subspan(1)) {
const Vec3d gcode_point{this->point_to_gcode(point)}; const Vec3d gcode_point{this->point_to_gcode(point)};
travel_gcode += this->m_writer.get_travel_to_xyz_gcode(previous_point, gcode_point, "layer change"); travel_gcode += this->m_writer.get_travel_to_xyz_gcode(previous_point, gcode_point, "ramping layer change");
previous_point = gcode_point; previous_point = gcode_point;
} }
return travel_gcode; return travel_gcode;
@ -2743,8 +2743,15 @@ std::string GCodeGenerator::change_layer(
// Increment a progress bar indicator. // Increment a progress bar indicator.
gcode += m_writer.update_progress(++ m_layer_index, m_layer_count); gcode += m_writer.update_progress(++ m_layer_index, m_layer_count);
if (EXTRUDER_CONFIG(retract_layer_change)) if (EXTRUDER_CONFIG(retract_layer_change)) {
gcode += this->retract_and_wipe(); gcode += this->retract_and_wipe();
} else {
const GCodeWriter saved_writer{this->writer()};
const std::optional<Point> saved_last_position{this->last_position};
this->m_layer_change_wipe = this->retract_and_wipe();
this->m_writer = saved_writer;
this->last_position = saved_last_position;
}
Vec3d new_position = this->writer().get_position(); Vec3d new_position = this->writer().get_position();
new_position.z() = print_z; new_position.z() = print_z;

View File

@ -386,6 +386,7 @@ private:
OozePrevention m_ooze_prevention; OozePrevention m_ooze_prevention;
GCode::Wipe m_wipe; GCode::Wipe m_wipe;
std::string m_layer_change_wipe;
GCode::LabelObjects m_label_objects; GCode::LabelObjects m_label_objects;
AvoidCrossingPerimeters m_avoid_crossing_perimeters; AvoidCrossingPerimeters m_avoid_crossing_perimeters;
JPSPathFinder m_avoid_crossing_curled_overhangs; JPSPathFinder m_avoid_crossing_curled_overhangs;