mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 18:42:24 +00:00
Merge branch 'main' into bugfox/bed-shape-orientation
This commit is contained in:
@@ -1038,6 +1038,10 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
if (machine_max_jerk_e != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_jerk_e.values = machine_max_jerk_e->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_junction_deviation = config.option<ConfigOptionFloats>("machine_max_junction_deviation");
|
||||
if (machine_max_junction_deviation != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_junction_deviation.values = machine_max_junction_deviation->values;
|
||||
|
||||
const ConfigOptionFloats* machine_max_acceleration_extruding = config.option<ConfigOptionFloats>("machine_max_acceleration_extruding");
|
||||
if (machine_max_acceleration_extruding != nullptr)
|
||||
m_time_processor.machine_limits.machine_max_acceleration_extruding.values = machine_max_acceleration_extruding->values;
|
||||
@@ -4598,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;
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1601,24 +1601,20 @@ void WipeTower2::save_on_last_wipe()
|
||||
auto& toolchange = m_layer_info->tool_changes[i];
|
||||
tool_change(toolchange.new_tool);
|
||||
|
||||
// Orca: allow calculation of the required depth and wipe volume for soluable toolchanges as well
|
||||
// NOTE: it's not clear if this is the right way, technically we should disable wipe tower if soluble filament is used as it
|
||||
// will will make the wipe tower unstable. Need to revist this in the future.
|
||||
if (i == idx) {
|
||||
float width = m_wipe_tower_width - 3*m_perimeter_width; // width we draw into
|
||||
|
||||
// if (i == idx) {
|
||||
float width = m_wipe_tower_width - 3*m_perimeter_width; // width we draw into
|
||||
float volume_to_save = length_to_volume(finish_layer().total_extrusion_length_in_plane(), m_perimeter_width, m_layer_info->height);
|
||||
float volume_left_to_wipe = std::max(m_filpar[toolchange.new_tool].filament_minimal_purge_on_wipe_tower, toolchange.wipe_volume_total - volume_to_save);
|
||||
float volume_we_need_depth_for = std::max(0.f, volume_left_to_wipe - length_to_volume(toolchange.first_wipe_line, m_perimeter_width*m_extra_flow, m_layer_info->height));
|
||||
float depth_to_wipe = get_wipe_depth(volume_we_need_depth_for, m_layer_info->height, m_perimeter_width, m_extra_flow, m_extra_spacing_wipe, width);
|
||||
|
||||
float volume_to_save = length_to_volume(finish_layer().total_extrusion_length_in_plane(), m_perimeter_width, m_layer_info->height);
|
||||
float volume_left_to_wipe = std::max(m_filpar[toolchange.new_tool].filament_minimal_purge_on_wipe_tower, toolchange.wipe_volume_total - volume_to_save);
|
||||
float volume_we_need_depth_for = std::max(0.f, volume_left_to_wipe - length_to_volume(toolchange.first_wipe_line, m_perimeter_width*m_extra_flow, m_layer_info->height));
|
||||
float depth_to_wipe = get_wipe_depth(volume_we_need_depth_for, m_layer_info->height, m_perimeter_width, m_extra_flow, m_extra_spacing_wipe, width);
|
||||
|
||||
toolchange.required_depth = toolchange.ramming_depth + depth_to_wipe;
|
||||
toolchange.wipe_volume = volume_left_to_wipe;
|
||||
// }
|
||||
toolchange.required_depth = toolchange.ramming_depth + depth_to_wipe;
|
||||
toolchange.wipe_volume = volume_left_to_wipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return index of first toolchange that switches to non-soluble extruder
|
||||
@@ -1626,10 +1622,14 @@ void WipeTower2::save_on_last_wipe()
|
||||
int WipeTower2::first_toolchange_to_nonsoluble(
|
||||
const std::vector<WipeTowerInfo::ToolChange>& tool_changes) const
|
||||
{
|
||||
for (size_t idx=0; idx<tool_changes.size(); ++idx)
|
||||
if (! m_filpar[tool_changes[idx].new_tool].is_soluble)
|
||||
return idx;
|
||||
return -1;
|
||||
// Orca: allow calculation of the required depth and wipe volume for soluable toolchanges as well
|
||||
// NOTE: it's not clear if this is the right way, technically we should disable wipe tower if soluble filament is used as it
|
||||
// will will make the wipe tower unstable. Need to revist this in the future.
|
||||
return tool_changes.empty() ? -1 : 0;
|
||||
//for (size_t idx=0; idx<tool_changes.size(); ++idx)
|
||||
// if (! m_filpar[tool_changes[idx].new_tool].is_soluble)
|
||||
// return idx;
|
||||
//return -1;
|
||||
}
|
||||
|
||||
static WipeTower::ToolChangeResult merge_tcr(WipeTower::ToolChangeResult& first,
|
||||
|
||||
Reference in New Issue
Block a user