Follow-up of 15c32d636d -> Small refactoring

This commit is contained in:
enricoturri1966 2021-05-04 13:31:07 +02:00
parent 15c32d636d
commit cb294e0b3e

View File

@ -2405,16 +2405,16 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
} }
#if ENABLE_SEAMS_VISUALIZATION #if ENABLE_SEAMS_VISUALIZATION
if (m_seams_detector.is_active()) {
// check for seam starting vertex // check for seam starting vertex
if (type == EMoveType::Extrude && m_extrusion_role == erExternalPerimeter && m_seams_detector.is_active() && !m_seams_detector.has_first_vertex()) if (type == EMoveType::Extrude && m_extrusion_role == erExternalPerimeter && !m_seams_detector.has_first_vertex())
m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id]); m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id]);
// check for seam ending vertex and store the resulting move // check for seam ending vertex and store the resulting move
else if ((type != EMoveType::Extrude || m_extrusion_role != erExternalPerimeter) && m_seams_detector.is_active() && m_seams_detector.has_first_vertex()) { else if ((type != EMoveType::Extrude || m_extrusion_role != erExternalPerimeter) && m_seams_detector.has_first_vertex()) {
auto set_end_position = [this](const Vec3f& pos) { auto set_end_position = [this](const Vec3f& pos) {
m_end_position[X] = pos.x(); m_end_position[Y] = pos.y(); m_end_position[Z] = pos.z(); m_end_position[X] = pos.x(); m_end_position[Y] = pos.y(); m_end_position[Z] = pos.z();
}; };
assert(m_seams_detector.has_first_vertex());
const Vec3f curr_pos(m_end_position[X], m_end_position[Y], m_end_position[Z]); const Vec3f curr_pos(m_end_position[X], m_end_position[Y], m_end_position[Z]);
const Vec3f new_pos = m_result.moves.back().position - m_extruder_offsets[m_extruder_id]; const Vec3f new_pos = m_result.moves.back().position - m_extruder_offsets[m_extruder_id];
const std::optional<Vec3f> first_vertex = m_seams_detector.get_first_vertex(); const std::optional<Vec3f> first_vertex = m_seams_detector.get_first_vertex();
@ -2427,6 +2427,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
m_seams_detector.activate(false); m_seams_detector.activate(false);
} }
}
#endif // ENABLE_SEAMS_VISUALIZATION #endif // ENABLE_SEAMS_VISUALIZATION
// store move // store move