Merge branch 'main' into enh-spoolman-support

This commit is contained in:
Ocraftyone 2025-10-20 13:35:29 -04:00 committed by GitHub
commit 75b91c8638
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
426 changed files with 10830 additions and 3040 deletions

View file

@ -3800,23 +3800,31 @@ LayerResult GCode::process_layer(
}
case CalibMode::Calib_Input_shaping_freq: {
if (m_layer_index == 1){
gcode += writer().set_input_shaping('A', print.calib_params().start, 0.f);
gcode += writer().set_input_shaping('A', print.calib_params().start, 0.f, print.calib_params().shaper_type);
if (m_writer.get_gcode_flavor() == gcfKlipper) {
// Disable minimum cruise ratio to ensure consistent motion for calibration
gcode += "SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=0\n";
}
} else {
if (print.calib_params().freqStartX == print.calib_params().freqStartY && print.calib_params().freqEndX == print.calib_params().freqEndY) {
gcode += writer().set_input_shaping('A', 0.f, (print.calib_params().freqStartX) + ((print.calib_params().freqEndX)-(print.calib_params().freqStartX)) * (m_layer_index - 2) / (m_layer_count - 3));
gcode += writer().set_input_shaping('A', 0.f, (print.calib_params().freqStartX) + ((print.calib_params().freqEndX)-(print.calib_params().freqStartX)) * (m_layer_index - 2) / (m_layer_count - 3), "");
} else {
gcode += writer().set_input_shaping('X', 0.f, (print.calib_params().freqStartX) + ((print.calib_params().freqEndX)-(print.calib_params().freqStartX)) * (m_layer_index - 2) / (m_layer_count - 3));
gcode += writer().set_input_shaping('Y', 0.f, (print.calib_params().freqStartY) + ((print.calib_params().freqEndY)-(print.calib_params().freqStartY)) * (m_layer_index - 2) / (m_layer_count - 3));
gcode += writer().set_input_shaping('X', 0.f, (print.calib_params().freqStartX) + ((print.calib_params().freqEndX)-(print.calib_params().freqStartX)) * (m_layer_index - 2) / (m_layer_count - 3), "");
gcode += writer().set_input_shaping('Y', 0.f, (print.calib_params().freqStartY) + ((print.calib_params().freqEndY)-(print.calib_params().freqStartY)) * (m_layer_index - 2) / (m_layer_count - 3), "");
}
}
break;
}
case CalibMode::Calib_Input_shaping_damp: {
if (m_layer_index == 1){
gcode += writer().set_input_shaping('X', 0.f, print.calib_params().freqStartX);
gcode += writer().set_input_shaping('Y', 0.f, print.calib_params().freqStartY);
if (m_writer.get_gcode_flavor() == gcfKlipper) {
// Disable minimum cruise ratio to ensure consistent motion for calibration
gcode += "SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=0\n";
}
gcode += writer().set_input_shaping('X', 0.f, print.calib_params().freqStartX, print.calib_params().shaper_type);
gcode += writer().set_input_shaping('Y', 0.f, print.calib_params().freqStartY, print.calib_params().shaper_type);
} else {
gcode += writer().set_input_shaping('A', print.calib_params().start + ((print.calib_params().end)-(print.calib_params().start)) * (m_layer_index) / (m_layer_count), 0.f);
gcode += writer().set_input_shaping('A', print.calib_params().start + ((print.calib_params().end)-(print.calib_params().start)) * (m_layer_index) / (m_layer_count), 0.f, "");
}
break;
}
@ -5234,9 +5242,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
sloped == nullptr ? DBL_MAX : get_sloped_z(sloped->slope_begin.z_ratio)
);
m_need_change_layer_lift_z = false;
// Orca: force restore Z after unknown last pos
// Orca: ensure Z matches planned layer height
if (_last_pos_undefined && !slope_need_z_travel) {
gcode += this->writer().travel_to_z(m_last_layer_z, "force restore Z after unknown last pos", true);
gcode += this->writer().travel_to_z(m_nominal_z, "ensure Z matches planned layer height", true);
}
}
@ -5310,21 +5318,47 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
// We set _mm3_per_mm to effectove flow = Geometric volume * print flow ratio * filament flow ratio * role-based-flow-ratios
auto _mm3_per_mm = path.mm3_per_mm * this->config().print_flow_ratio;
_mm3_per_mm *= filament_flow_ratio;
if (path.role() == erTopSolidInfill)
if (path.role() == erTopSolidInfill) {
_mm3_per_mm *= m_config.top_solid_infill_flow_ratio;
else if (path.role() == erBottomSurface)
} else if (path.role() == erBottomSurface) {
_mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio;
else if (path.role() == erInternalBridgeInfill)
} else if (path.role() == erInternalBridgeInfill) {
_mm3_per_mm *= m_config.internal_bridge_flow;
else if(sloped)
} else if (sloped) {
_mm3_per_mm *= m_config.scarf_joint_flow_ratio;
}
if (m_config.set_other_flow_ratios) {
if (path.role() == erExternalPerimeter) {
_mm3_per_mm *= m_config.outer_wall_flow_ratio;
} else if (path.role() == erPerimeter) {
_mm3_per_mm *= m_config.inner_wall_flow_ratio;
} else if (path.role() == erOverhangPerimeter) {
_mm3_per_mm *= m_config.overhang_flow_ratio;
} else if (path.role() == erInternalInfill) {
_mm3_per_mm *= m_config.sparse_infill_flow_ratio;
} else if (path.role() == erSolidInfill) {
_mm3_per_mm *= m_config.internal_solid_infill_flow_ratio;
} else if (path.role() == erGapFill) {
_mm3_per_mm *= m_config.gap_fill_flow_ratio;
} else if (path.role() == erSupportMaterial) { // Should this condition also cover erSupportTransition?
_mm3_per_mm *= m_config.support_flow_ratio;
} else if (path.role() == erSupportMaterialInterface) {
_mm3_per_mm *= m_config.support_interface_flow_ratio;
}
// Additionally, adjust the value if we are on the first layer (except for brims and skirts)
if (this->on_first_layer() && (path.role() != erBrim && path.role() != erSkirt)) {
_mm3_per_mm *= m_config.first_layer_flow_ratio;
}
}
// Effective extrusion length per distance unit = (filament_flow_ratio/cross_section) * mm3_per_mm / print flow ratio
// m_writer.extruder()->e_per_mm3() below is (filament flow ratio / cross-sectional area)
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
e_per_mm /= filament_flow_ratio;
// set speed
if (speed == -1) {
if (path.role() == erPerimeter) {