From e3b774c9de86aab99e349a6758f0756009753dea Mon Sep 17 00:00:00 2001 From: "BBL\\chuan.he" Date: Tue, 27 Aug 2024 18:09:43 +0800 Subject: [PATCH] fix:gcode line width check support scarf seam Change-Id: I502c82d8f6e9481cadedca4e830cd4545e67f21f jira:none --- .../bbs_gcode_checker/GCodeChecker.cpp | 17 ++++++++++++++++- bbs_test_tools/bbs_gcode_checker/GCodeChecker.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bbs_test_tools/bbs_gcode_checker/GCodeChecker.cpp b/bbs_test_tools/bbs_gcode_checker/GCodeChecker.cpp index 846a103dd..2b3163dd3 100644 --- a/bbs_test_tools/bbs_gcode_checker/GCodeChecker.cpp +++ b/bbs_test_tools/bbs_gcode_checker/GCodeChecker.cpp @@ -20,6 +20,7 @@ const std::string Wipe_End_Tag = " WIPE_END"; const std::string Layer_Change_Tag = " CHANGE_LAYER"; const std::string Height_Tag = " LAYER_HEIGHT: "; const std::string filament_flow_ratio_tag = " filament_flow_ratio"; +const std::string has_scarf_joint_seam_tag = " has_scarf_joint_seam"; const std::string nozzle_temperature_Tag = " nozzle_temperature ="; const std::string nozzle_temperature_initial_layer_Tag = " nozzle_temperature_initial_layer"; const std::string Z_HEIGHT_TAG = " Z_HEIGHT: "; @@ -162,6 +163,11 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line) return GCodeCheckResult::ParseFailed; } } + else if (starts_with(comment, has_scarf_joint_seam_tag)) + { + std::string str = comment.substr(has_scarf_joint_seam_tag.size() + 3); + has_scarf_joint_seam = (str == "1"); + } else if (starts_with(comment, nozzle_temperature_Tag)) { std::string str = comment.substr(nozzle_temperature_Tag.size() + 1); if (!parse_double_from_str(str, nozzle_temperature)) { @@ -638,7 +644,16 @@ GCodeCheckResult GCodeChecker::check_G0_G1_width(const GCodeLine& line) bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill; if (!is_bridge) { - double width_real = calculate_G1_width(source, target, delta_pos[E], m_height, is_bridge); + double real_height = m_height; + if (line.has(Z) && has_scarf_joint_seam && line.get(Z) != 0) + { + if (line.get(Z) == z_height) + { + return GCodeCheckResult::Success; + } + real_height = line.get(Z) - (z_height - m_height); + } + double width_real = calculate_G1_width(source, target, delta_pos[E], real_height, is_bridge); if (fabs(width_real - m_width) > WIDTH_THRESHOLD) { std::cout << "Invalid G0_G1 because has abnormal line width." << std::endl; std::cout << "Width: " << m_width << " Width_real: " << width_real << std::endl; diff --git a/bbs_test_tools/bbs_gcode_checker/GCodeChecker.h b/bbs_test_tools/bbs_gcode_checker/GCodeChecker.h index 1c73df5b2..72ea23b17 100644 --- a/bbs_test_tools/bbs_gcode_checker/GCodeChecker.h +++ b/bbs_test_tools/bbs_gcode_checker/GCodeChecker.h @@ -218,6 +218,7 @@ private: std::vector filament_flow_ratio; std::vector nozzle_temperature; std::vector nozzle_temperature_initial_layer; + bool has_scarf_joint_seam = false; }; }