From b351fa3b5023bd34e10f7b01c917857e3b2ae631 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Tue, 10 Jun 2025 16:42:58 +0800 Subject: [PATCH] FIX: only meature m29 once in machine start GCode jira: NONE Signed-off-by: xun.zhang Change-Id: I3661159dd09f6d179eae3a0b1f2bbc14277be312 (cherry picked from commit 60492b7b0b57dc243cc8ac17f2cad638724aaca2) (cherry picked from commit 8555af21cacaa10e74715e771aa0866052a31bd6) --- src/libslic3r/GCode/GCodeProcessor.cpp | 32 +++++++++++++++++++++++--- src/libslic3r/GCode/GCodeProcessor.hpp | 4 ++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 7adf5828bf..221462fffe 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1641,7 +1641,9 @@ void GCodeProcessor::register_commands() {"VG1", [this](const GCodeReader::GCodeLine& line) { process_VG1(line); }}, {"VM104", [this](const GCodeReader::GCodeLine& line) { process_VM104(line); }}, - {"VM109", [this](const GCodeReader::GCodeLine& line) { process_VM109(line); }} + {"VM109", [this](const GCodeReader::GCodeLine& line) { process_VM109(line); }}, + {"M622", [this](const GCodeReader::GCodeLine& line) { process_M622(line);}}, + {"M623", [this](const GCodeReader::GCodeLine& line) { process_M623(line);}} }; std::unordered_setearly_quit_commands = { @@ -2128,7 +2130,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) if (machine_max_jerk_y != nullptr) m_time_processor.machine_limits.machine_max_jerk_y.values = machine_max_jerk_y->values; - const ConfigOptionFloats* machine_max_jerk_z = config.option("machine_max_jerkz"); + const ConfigOptionFloats* machine_max_jerk_z = config.option("machine_max_jerk_z"); if (machine_max_jerk_z != nullptr) m_time_processor.machine_limits.machine_max_jerk_z.values = machine_max_jerk_z->values; @@ -4860,7 +4862,13 @@ void GCodeProcessor::process_G29(const GCodeReader::GCodeLine& line) //BBS: hardcode 260 seconds for G29 //Todo: use a machine related setting when we have second kind of BBL printer const float value_s = 260.0; - simulate_st_synchronize(value_s); + if (s_IsBBLPrinter){ + if(m_measure_g29_time) + simulate_st_synchronize(value_s); + } + else{ + simulate_st_synchronize(value_s); + } } void GCodeProcessor::process_G10(const GCodeReader::GCodeLine& line) @@ -5285,6 +5293,24 @@ void GCodeProcessor::process_M221(const GCodeReader::GCodeLine& line) } } +void GCodeProcessor::process_M622(const GCodeReader::GCodeLine& line) +{ + float value_j; + if(line.has_value('J',value_j)){ + int interger_j = (int)(std::round(value_j)); + if(interger_j == 1 && !m_measure_g29_time) + m_measure_g29_time = true; + } + +} + +void GCodeProcessor::process_M623(const GCodeReader::GCodeLine& line) +{ + if(m_measure_g29_time) + m_measure_g29_time = false; +} + + void GCodeProcessor::process_M400(const GCodeReader::GCodeLine& line) { float value_s = 0.0; diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 23fa419494..82d1053722 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -797,6 +797,7 @@ class Print; size_t m_last_default_color_id; bool m_detect_layer_based_on_tag {false}; int m_seams_count; + bool m_measure_g29_time {false}; bool m_single_extruder_multi_material; float m_preheat_time; int m_preheat_steps; @@ -1030,6 +1031,9 @@ class Print; void process_T(const std::string_view command); void process_M1020(const GCodeReader::GCodeLine &line); + void process_M622(const GCodeReader::GCodeLine &line); + void process_M623(const GCodeReader::GCodeLine &line); + void process_filament_change(int id); // post process the file with the given filename to: