Add offset to the finalize wipe tower move

This commit is contained in:
Martin Šach 2024-02-29 14:51:19 +01:00 committed by Lukas Matena
parent 9b050bf52c
commit cdcd4da809

View File

@ -266,9 +266,10 @@ std::string WipeTowerIntegration::tool_change(GCodeGenerator &gcodegen, int extr
std::string WipeTowerIntegration::finalize(GCodeGenerator &gcodegen)
{
std::string gcode;
if (std::abs(gcodegen.writer().get_position().z() - m_final_purge.print_z) > EPSILON)
const double purge_z{m_final_purge.print_z + gcodegen.config().z_offset.value};
if (std::abs(gcodegen.writer().get_position().z() - purge_z) > EPSILON)
gcode += gcodegen.generate_travel_gcode(
{{gcodegen.last_position->x(), gcodegen.last_position->y(), scaled(m_final_purge.print_z)}},
{{gcodegen.last_position->x(), gcodegen.last_position->y(), scaled(purge_z)}},
"move to safe place for purging", [](){return "";}
);
gcode += append_tcr(gcodegen, m_final_purge, -1);