mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 14:37:36 -06:00
Fix #6839 with final tool preheating on multitool machines causing in appropriate temp settings Seems like Orca is trying to preheat the next tool in a multitool print, and ends up calling a heater off command in the last 30 seconds of any print. This happens because there's no handling to check if the next active tool is an actual valid tool index, or its a T-1 command to end the print since we're using the last tool. Simply moved the preheat commands into the conditional IF that automatically fixes this issue since the tool index is now properly evaluated. Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
e395ba18ad
commit
d9c27f3dee
1 changed files with 48 additions and 47 deletions
|
@ -4602,55 +4602,56 @@ void GCodeProcessor::run_post_process()
|
|||
if (m_print != nullptr)
|
||||
m_print->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning);
|
||||
}
|
||||
}
|
||||
export_lines.insert_lines(
|
||||
backtrace, cmd,
|
||||
// line inserter
|
||||
[tool_number, this](unsigned int id, const std::vector<float>& time_diffs) {
|
||||
const int temperature = int(m_layer_id != 1 ? m_extruder_temps_config[tool_number] :
|
||||
m_extruder_temps_first_layer_config[tool_number]);
|
||||
// Orca: M104.1 for XL printers, I can't find the documentation for this so I copied the C++ comments from
|
||||
// Prusa-Firmware-Buddy here
|
||||
/**
|
||||
* M104.1: Early Set Hotend Temperature (preheat, and with stealth mode support)
|
||||
*
|
||||
* This GCode is used to tell the XL printer the time estimate when a tool will be used next,
|
||||
* so that the printer can start preheating the tool in advance.
|
||||
*
|
||||
* ## Parameters
|
||||
* - `P` - <number> - time in seconds till the temperature S is required (in standard mode)
|
||||
* - `Q` - <number> - time in seconds till the temperature S is required (in stealth mode)
|
||||
* The rest is same as M104
|
||||
*/
|
||||
if (this->m_is_XL_printer) {
|
||||
std::string out = "M104.1 T" + std::to_string(tool_number);
|
||||
if (time_diffs.size() > 0)
|
||||
out += " P" + std::to_string(int(std::round(time_diffs[0])));
|
||||
if (time_diffs.size() > 1)
|
||||
out += " Q" + std::to_string(int(std::round(time_diffs[1])));
|
||||
out += " S" + std::to_string(temperature) + "\n";
|
||||
return out;
|
||||
} else {
|
||||
std::string comment = "preheat T" + std::to_string(tool_number) +
|
||||
" time: " + std::to_string((int) std::round(time_diffs[0])) + "s";
|
||||
return GCodeWriter::set_temperature(temperature, this->m_flavor, false, tool_number, comment);
|
||||
}
|
||||
},
|
||||
// line replacer
|
||||
[this, tool_number](const std::string& line) {
|
||||
if (GCodeReader::GCodeLine::cmd_is(line, "M104")) {
|
||||
GCodeReader::GCodeLine gline;
|
||||
GCodeReader reader;
|
||||
reader.parse_line(line, [&gline](GCodeReader& reader, const GCodeReader::GCodeLine& l) { gline = l; });
|
||||
|
||||
float val;
|
||||
if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos) {
|
||||
if (static_cast<int>(val) == tool_number)
|
||||
return std::string("; removed M104\n");
|
||||
export_lines.insert_lines(
|
||||
backtrace, cmd,
|
||||
// line inserter
|
||||
[tool_number, this](unsigned int id, const std::vector<float>& time_diffs) {
|
||||
const int temperature = int(m_layer_id != 1 ? m_extruder_temps_config[tool_number] :
|
||||
m_extruder_temps_first_layer_config[tool_number]);
|
||||
// Orca: M104.1 for XL printers, I can't find the documentation for this so I copied the C++ comments from
|
||||
// Prusa-Firmware-Buddy here
|
||||
/**
|
||||
* M104.1: Early Set Hotend Temperature (preheat, and with stealth mode support)
|
||||
*
|
||||
* This GCode is used to tell the XL printer the time estimate when a tool will be used next,
|
||||
* so that the printer can start preheating the tool in advance.
|
||||
*
|
||||
* ## Parameters
|
||||
* - `P` - <number> - time in seconds till the temperature S is required (in standard mode)
|
||||
* - `Q` - <number> - time in seconds till the temperature S is required (in stealth mode)
|
||||
* The rest is same as M104
|
||||
*/
|
||||
if (this->m_is_XL_printer) {
|
||||
std::string out = "M104.1 T" + std::to_string(tool_number);
|
||||
if (time_diffs.size() > 0)
|
||||
out += " P" + std::to_string(int(std::round(time_diffs[0])));
|
||||
if (time_diffs.size() > 1)
|
||||
out += " Q" + std::to_string(int(std::round(time_diffs[1])));
|
||||
out += " S" + std::to_string(temperature) + "\n";
|
||||
return out;
|
||||
} else {
|
||||
std::string comment = "preheat T" + std::to_string(tool_number) +
|
||||
" time: " + std::to_string((int) std::round(time_diffs[0])) + "s";
|
||||
return GCodeWriter::set_temperature(temperature, this->m_flavor, false, tool_number, comment);
|
||||
}
|
||||
},
|
||||
// line replacer
|
||||
[this, tool_number](const std::string& line) {
|
||||
if (GCodeReader::GCodeLine::cmd_is(line, "M104")) {
|
||||
GCodeReader::GCodeLine gline;
|
||||
GCodeReader reader;
|
||||
reader.parse_line(line, [&gline](GCodeReader& reader, const GCodeReader::GCodeLine& l) { gline = l; });
|
||||
|
||||
float val;
|
||||
if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos) {
|
||||
if (static_cast<int>(val) == tool_number)
|
||||
return std::string("; removed M104\n");
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
return line;
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue