Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 50 additions & 33 deletions Marlin/src/gcode/feature/ft_motion/M493.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void say_shaper_type(const AxisEnum a, bool &sep, const char axis_name) {
SERIAL_CHAR(axis_name, '=');
switch (ftMotion.cfg.shaper[a]) {
default: break;
case ftMotionShaper_NONE: SERIAL_ECHOPGM("None"); break;
TERN_(FTM_SHAPER_ZV, case ftMotionShaper_ZV: SERIAL_ECHOPGM("ZV"); break);
TERN_(FTM_SHAPER_ZVD, case ftMotionShaper_ZVD: SERIAL_ECHOPGM("ZVD"); break);
TERN_(FTM_SHAPER_ZVDD, case ftMotionShaper_ZVDD: SERIAL_ECHOPGM("ZVDD"); break);
Expand All @@ -57,7 +58,7 @@ void say_shaping() {
bool sep = false;
if (is_shaping) {
#define STEPPER_E_NAME 'E'
#define _SAY_SHAPER(A) if (AXIS_IS_SHAPING(A)) say_shaper_type(_AXIS(A), sep, STEPPER_##A##_NAME);
#define _SAY_SHAPER(A) say_shaper_type(_AXIS(A), sep, STEPPER_##A##_NAME);
SERIAL_ECHOPGM(" (");
SHAPED_CODE(_SAY_SHAPER(A), _SAY_SHAPER(B), _SAY_SHAPER(C), _SAY_SHAPER(E));
SERIAL_CHAR(')');
Expand Down Expand Up @@ -86,43 +87,51 @@ void say_shaping() {
#endif

#if HAS_X_AXIS
SERIAL_CHAR(STEPPER_A_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.x, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.x, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
if (ftMotion.cfg.shaper[X_AXIS]) {
SERIAL_CHAR(STEPPER_A_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.x, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.x, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
}
#endif

#if HAS_Y_AXIS
SERIAL_CHAR(STEPPER_B_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.y, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.y, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
if (ftMotion.cfg.shaper[Y_AXIS]) {
SERIAL_CHAR(STEPPER_B_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.y, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.y, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
}
#endif

#if ENABLED(FTM_SHAPER_Z)
SERIAL_CHAR(STEPPER_C_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.z, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.z, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
if (ftMotion.cfg.shaper[Z_AXIS]) {
SERIAL_CHAR(STEPPER_C_NAME);
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.z, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.z, 2), F("Hz/"), z_based ? F("mm") : F("g"));
# endif
SERIAL_EOL();
}
#endif

#if ENABLED(FTM_SHAPER_E)
SERIAL_CHAR('E');
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.e, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.e, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
if (ftMotion.cfg.shaper[E_AXIS]) {
SERIAL_CHAR('E');
SERIAL_ECHO_TERNARY(dynamic, " ", "base dynamic", "static", " shaper frequency: ");
SERIAL_ECHO(p_float_t(c.baseFreq.e, 2), F(" Hz"));
#if HAS_DYNAMIC_FREQ
if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(c.dynFreqK.e, 2), F("Hz/"), z_based ? F("mm") : F("g"));
#endif
SERIAL_EOL();
}
#endif
}
}
Expand Down Expand Up @@ -250,10 +259,6 @@ void GcodeSuite::M493() {
if (c.setShaper(axis, newsh))
flag.update = flag.report = true;
};
if (seenC) {
#define _SET_SHAPER(A) set_shaper(_AXIS(A), shaperVal);
SHAPED_MAP(_SET_SHAPER);
}

#endif // NUM_AXES_SHAPED > 0

Expand Down Expand Up @@ -317,6 +322,9 @@ void GcodeSuite::M493() {

if (apply_xy || parser.seen_test('X')) {

// Set shaper if given
if (seenC) set_shaper(X_AXIS, shaperVal);

// Parse X frequency parameter
if (seenA) {
if (AXIS_IS_SHAPING(X)) {
Expand Down Expand Up @@ -363,6 +371,9 @@ void GcodeSuite::M493() {

if (apply_xy || parser.seen_test('Y')) {

// Set shaper if given
if (seenC) set_shaper(Y_AXIS, shaperVal);

// Parse Y frequency parameter
if (seenA) {
if (AXIS_IS_SHAPING(Y)) {
Expand Down Expand Up @@ -408,6 +419,9 @@ void GcodeSuite::M493() {

if (parser.seen_test('Z')) {

// Set shaper if given
if (seenC) set_shaper(Z_AXIS, shaperVal);

// Parse Z frequency parameter
if (seenA) {
if (AXIS_IS_SHAPING(Z)) {
Expand Down Expand Up @@ -453,6 +467,9 @@ void GcodeSuite::M493() {

if (parser.seen_test('E')) {

// Set shaper if given
if (seenC) set_shaper(E_AXIS, shaperVal);

// Parse E frequency parameter
if (seenA) {
if (AXIS_IS_SHAPING(E)) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/ft_motion/trajectory_trapezoidal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TrapezoidalTrajectoryGenerator : public TrajectoryGenerator {
TrapezoidalTrajectoryGenerator() = default;

void plan(const float initial_speed_in, const float final_speed_in, const float acceleration_in, const float nominal_speed_in, const float distance_in) override {

initial_speed = initial_speed_in;
acceleration = acceleration_in;
nominal_speed = nominal_speed_in;
Expand Down
Loading