Skip to content

Commit d62119e

Browse files
committedJan 12, 2023
🔧 Input Shaping sanity checks

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed
 

‎Marlin/src/inc/SanityCheck.h

+39-21
Original file line numberDiff line numberDiff line change
@@ -4312,34 +4312,52 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
43124312
#error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload."
43134313
#endif
43144314

4315-
// Check requirements for Input Shaping
4316-
#if HAS_SHAPING && defined(__AVR__)
4317-
#ifdef SHAPING_MIN_FREQ
4318-
static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0.");
4319-
#else
4320-
TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set."));
4321-
TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set."));
4315+
/**
4316+
* Input Shaping requirements
4317+
*/
4318+
#if HAS_SHAPING
4319+
#if ENABLED(DELTA)
4320+
#error "Input Shaping is not compatible with DELTA kinematics."
4321+
#elif ENABLED(SCARA)
4322+
#error "Input Shaping is not compatible with SCARA kinematics."
4323+
#elif ENABLED(TPARA)
4324+
#error "Input Shaping is not compatible with TPARA kinematics."
4325+
#elif ENABLED(POLAR)
4326+
#error "Input Shaping is not compatible with POLAR kinematics."
4327+
#elif ENABLED(POLARGRAPH)
4328+
#error "Input Shaping is not compatible with POLARGRAPH kinematics."
4329+
#elif ENABLED(DIRECT_STEPPING)
4330+
#error "Input Shaping is not compatible with DIRECT_STEPPING."
4331+
#elif ENABLED(INPUT_SHAPING_X) && ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX)
4332+
#error "INPUT_SHAPING_X is not supported with COREXY, COREYX, COREXZ, COREZX, or MARKFORGED_*."
4333+
#elif ENABLED(INPUT_SHAPING_Y) && ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY, MARKFORGED_YX)
4334+
#error "INPUT_SHAPING_Y is not supported with COREXY, COREYX, COREYZ, COREZY, or MARKFORGED_*."
43224335
#endif
4323-
#if ENABLED(INPUT_SHAPING_X)
4324-
#if F_CPU > 16000000
4325-
static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz.");
4336+
4337+
#ifdef __AVR__
4338+
#ifdef SHAPING_MIN_FREQ
4339+
static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0.");
43264340
#else
4327-
static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz.");
4341+
TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set."));
4342+
TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set."));
43284343
#endif
4329-
#endif
4330-
#if ENABLED(INPUT_SHAPING_Y)
4331-
#if F_CPU > 16000000
4332-
static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz.");
4333-
#else
4334-
static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz.");
4344+
#if ENABLED(INPUT_SHAPING_X)
4345+
#if F_CPU > 16000000
4346+
static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz.");
4347+
#else
4348+
static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz.");
4349+
#endif
4350+
#endif
4351+
#if ENABLED(INPUT_SHAPING_Y)
4352+
#if F_CPU > 16000000
4353+
static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz.");
4354+
#else
4355+
static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz.");
4356+
#endif
43354357
#endif
43364358
#endif
43374359
#endif
43384360

4339-
#if BOTH(HAS_SHAPING, DIRECT_STEPPING)
4340-
#error "INPUT_SHAPING_[XY] cannot currently be used with DIRECT_STEPPING."
4341-
#endif
4342-
43434361
// Misc. Cleanup
43444362
#undef _TEST_PWM
43454363
#undef _NUM_AXES_STR

0 commit comments

Comments
 (0)
Please sign in to comment.