From bd8d500e4e518d369937be4668ba4cf3d8f57c30 Mon Sep 17 00:00:00 2001 From: David Buezas Date: Mon, 22 Dec 2025 08:07:12 +0100 Subject: [PATCH] Optimize for no smoothing case --- Marlin/src/module/ft_motion.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index 128d2e0be7..d5b9b213a0 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -525,12 +525,14 @@ xyze_float_t FTMotion::calc_traj_point(const float dist) { // Approximate Gaussian smoothing via chained EMAs auto _smoothen = [&](const AxisEnum axis, axis_smoothing_t &smoo) { - float smooth_val = traj_coords[axis]; - for (uint8_t _i = 0; _i < FTM_SMOOTHING_ORDER; ++_i) { - smoo.smoothing_pass[_i] += (smooth_val - smoo.smoothing_pass[_i]) * smoo.alpha; - smooth_val = smoo.smoothing_pass[_i]; + if (smoo.alpha < 1) { + float smooth_val = traj_coords[axis]; + for (uint8_t _i = 0; _i < FTM_SMOOTHING_ORDER; ++_i) { + smoo.smoothing_pass[_i] += (smooth_val - smoo.smoothing_pass[_i]) * smoo.alpha; + smooth_val = smoo.smoothing_pass[_i]; + } + traj_coords[axis] = smooth_val; } - traj_coords[axis] = smooth_val; }; #define _SMOOTHEN(A) _smoothen(_AXIS(A), smoothing.A);