SPE-1776: Stop backward adding M104 lines when commands G28/G29 are found, during postprocessing gcode

This commit is contained in:
enricoturri1966 2023-06-14 12:16:35 +02:00 committed by Lukas Matena
parent cb6262cb5f
commit 1338b78c8d

View File

@ -3605,14 +3605,16 @@ void GCodeProcessor::post_process()
auto rev_it = m_lines.rbegin() + rev_it_dist; auto rev_it = m_lines.rbegin() + rev_it_dist;
auto start_rev_it = rev_it; auto start_rev_it = rev_it;
std::string curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
// backtrace into the cache to find the place where to insert the line // backtrace into the cache to find the place where to insert the line
while (rev_it != m_lines.rend() && rev_it->time > time_threshold_i && GCodeReader::GCodeLine::extract_cmd(rev_it->line) != cmd) { while (rev_it != m_lines.rend() && rev_it->time > time_threshold_i && curr_cmd != cmd && curr_cmd != "G28" && curr_cmd != "G29") {
rev_it->line = line_replacer(rev_it->line); rev_it->line = line_replacer(rev_it->line);
++rev_it; ++rev_it;
curr_cmd = GCodeReader::GCodeLine::extract_cmd(rev_it->line);
} }
// we met the previous evenience of cmd. stop inserting lines // we met the previous evenience of cmd, or a G28/G29 command. stop inserting lines
if (rev_it != m_lines.rend() && GCodeReader::GCodeLine::extract_cmd(rev_it->line) == cmd) if (rev_it != m_lines.rend() && (curr_cmd == cmd || curr_cmd == "G28" || curr_cmd == "G29"))
break; break;
// insert the line for the current step // insert the line for the current step