diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 722daf49c9..a666737b1b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1191,6 +1191,15 @@ // smoothing acceleration peaks, which may also smooth curved surfaces. #endif + #define FTM_TRAJECTORY_TYPE TRAPEZOIDAL // Block acceleration profile (TRAPEZOIDAL, POLY5, POLY6) + // TRAPEZOIDAL: Continuous Velocity. Max acceleration is respected. + // POLY5: Like POLY6 with 1.5x but cpu cheaper. + // POLY6: Continuous Acceleration (aka S_CURVE). + // POLY trajectories not only reduce resonances without rounding corners, but also + // reduce extruder strain due to linear advance. + + #define FTM_POLY6_ACCELERATION_OVERSHOOT 1.875f // Max acceleration overshoot factor for POLY6 (1.25 to 1.875) + /** * Advanced configuration */ diff --git a/Marlin/src/gcode/feature/ft_motion/M494.cpp b/Marlin/src/gcode/feature/ft_motion/M494.cpp index 04580ee53e..10856be280 100644 --- a/Marlin/src/gcode/feature/ft_motion/M494.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M494.cpp @@ -21,44 +21,65 @@ */ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(FTM_SMOOTHING) +#if ENABLED(FT_MOTION) #include "../../gcode.h" #include "../../../module/ft_motion.h" #include "../../../module/stepper.h" +#include "../../../module/planner.h" -void say_smoothing() { - #if HAS_X_AXIS - SERIAL_ECHOLN(F(" "), C('X'), F(" smoothing time: "), p_float_t(ftMotion.cfg.smoothingTime.X, 3), C('s')); - #endif - #if HAS_Y_AXIS - SERIAL_ECHOLN(F(" "), C('Y'), F(" smoothing time: "), p_float_t(ftMotion.cfg.smoothingTime.Y, 3), C('s')); - #endif - #if HAS_Z_AXIS - SERIAL_ECHOLN(F(" "), C('Z'), F(" smoothing time: "), p_float_t(ftMotion.cfg.smoothingTime.Z, 3), C('s')); - #endif - #if HAS_EXTRUDERS - SERIAL_ECHOLN(F(" "), C('E'), F(" smoothing time: "), p_float_t(ftMotion.cfg.smoothingTime.E, 3), C('s')); +static FSTR_P get_trajectory_type_name() { + switch (ftMotion.getTrajectoryType()) { + default: + case TrajectoryType::TRAPEZOIDAL: return GET_TEXT_F(MSG_FTM_TRAPEZOIDAL); + case TrajectoryType::POLY5: return GET_TEXT_F(MSG_FTM_POLY5); + case TrajectoryType::POLY6: return GET_TEXT_F(MSG_FTM_POLY6); + } +} + +void say_ftm_settings() { + SERIAL_ECHOLN(F(" Trajectory: "), get_trajectory_type_name(), C('('), (uint8_t)ftMotion.getTrajectoryType(), C(')')); + + const ft_config_t &c = ftMotion.cfg; + + if (ftMotion.getTrajectoryType() == TrajectoryType::POLY6) + SERIAL_ECHOLNPGM(" Poly6 Overshoot: ", p_float_t(c.poly6_acceleration_overshoot, 3)); + + #if ENABLED(FTM_SMOOTHING) + #define _SMOO_REPORT(A) SERIAL_ECHOLN(F(" "), C(IAXIS_CHAR(_AXIS(A))), F(" smoothing time: "), p_float_t(c.smoothingTime.A, 3), C('s')); + CARTES_MAP(_SMOO_REPORT); #endif } void GcodeSuite::M494_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - report_heading_etc(forReplay, F("FTM Smoothing")); const ft_config_t &c = ftMotion.cfg; - SERIAL_ECHOLN(F(" M494") - CARTES_COMMA CARTES_PAIRED_LIST( - F(" X"), c.smoothingTime.X, F(" Y"), c.smoothingTime.Y, - F(" Z"), c.smoothingTime.Z, F(" E"), c.smoothingTime.E - ) - ); + + report_heading_etc(forReplay, F("FT Motion")); + SERIAL_ECHOPGM(" M494 T", (uint8_t)ftMotion.getTrajectoryType()); + + #if ENABLED(FTM_SMOOTHING) + SERIAL_ECHOPGM( + CARTES_PAIRED_LIST( + " X", c.smoothingTime.X, " Y", c.smoothingTime.Y, + " Z", c.smoothingTime.Z, " E", c.smoothingTime.E + ) + ); + #endif + + if (ftMotion.getTrajectoryType() == TrajectoryType::POLY6) + SERIAL_ECHOPGM(" O", c.poly6_acceleration_overshoot); + + SERIAL_EOL(); } /** - * M494: Set Fixed-time Motion Control Smoothing parameters + * M494: Set Fixed-time Motion Control parameters * * Parameters: + * T Set trajectory generator type (0=TRAPEZOIDAL, 1=POLY5, 2=POLY6) + * O Set acceleration overshoot for POLY6 (1.25-1.875) * X