🐛 Fix FTM Linear Advance toggle (#28311)

This commit is contained in:
Kadin Le
2026-02-02 16:07:49 -08:00
committed by GitHub
parent 6179563e0b
commit 3f98310004

View File

@@ -478,35 +478,31 @@ xyze_float_t FTMotion::calc_traj_point(const float dist) {
LOGICAL_AXIS_MAP_LC(_SET_TRAJ);
#if FTM_HAS_LIN_ADVANCE
float traj_e = traj_coords.e;
// Apply LA/NLE only to printing (not retract/unretract) blocks
if (use_advance_lead) {
const float advK = planner.get_advance_k();
if (advK || TERN0(NONLINEAR_EXTRUSION, stepper.ne.settings.enabled)) {
float traj_e = traj_coords.e;
const float traj_e_delta = traj_e - prev_traj_e; // extruder delta in mm, always positive for use_advance_lead (printing moves)
const float e_rate = traj_e_delta * FTM_FS; // extruder velocity in mm/s
const float traj_e_delta = traj_e - prev_traj_e; // Extruder delta in mm, always positive for use_advance_lead (printing moves)
const float e_rate = traj_e_delta * (FTM_FS); // Extruder velocity in mm/s
traj_coords.e += e_rate * advK;
traj_coords.e += e_rate * planner.get_advance_k();
#if ENABLED(NONLINEAR_EXTRUSION)
if (stepper.ne.settings.enabled) {
const nonlinear_coeff_t &coeff = stepper.ne.settings.coeff;
const float multiplier = max(coeff.C, coeff.A * sq(e_rate) + coeff.B * e_rate + coeff.C),
nle_term = traj_e_delta * (multiplier - 1);
#if ENABLED(NONLINEAR_EXTRUSION)
if (stepper.ne.settings.enabled) {
const nonlinear_coeff_t &coeff = stepper.ne.settings.coeff;
const float multiplier = max(coeff.C, coeff.A * sq(e_rate) + coeff.B * e_rate + coeff.C),
nle_term = traj_e_delta * (multiplier - 1);
traj_coords.e += nle_term;
traj_e += nle_term;
startPos.e += nle_term;
endPos_prevBlock.e += nle_term;
}
#endif
prev_traj_e = traj_e;
}
traj_coords.e += nle_term;
traj_e += nle_term;
startPos.e += nle_term;
endPos_prevBlock.e += nle_term;
}
#endif
}
prev_traj_e = traj_e;
#endif // FTM_HAS_LIN_ADVANCE
// Update shaping parameters if needed.