From b9703fdf3666f14c8a7754e10e9f5517a7ac8e2c Mon Sep 17 00:00:00 2001 From: ManuelMcLure Date: Sun, 10 Nov 2019 17:04:28 -0800 Subject: [PATCH] Ensure TMC + LIN_ADVANCE pulse length (#15807) --- Marlin/src/core/drivers.h | 13 +++++++++++++ Marlin/src/inc/Conditionals_post.h | 8 ++++++-- Marlin/src/inc/SanityCheck.h | 8 ++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index 005ffb7da5..4400e0d785 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -121,6 +121,19 @@ || AXIS_DRIVER_TYPE(A,TMC5130) \ || AXIS_DRIVER_TYPE(A,TMC5160) ) +#define HAS_TMC_E_DRIVER ( HAS_E_DRIVER(TMC2130) \ + || HAS_E_DRIVER(TMC2160) \ + || HAS_E_DRIVER(TMC2660) \ + || HAS_E_DRIVER(TMC2209) \ + || HAS_E_DRIVER(TMC5130) \ + || HAS_E_DRIVER(TMC5160) ) + +#define HAS_TMC_STANDALONE_E_DRIVER ( HAS_E_DRIVER(TMC2130_STANDALONE) \ + || HAS_E_DRIVER(TMC2160_STANDALONE) \ + || HAS_E_DRIVER(TMC2660_STANDALONE) \ + || HAS_E_DRIVER(TMC2209_STANDALONE) \ + || HAS_E_DRIVER(TMC5130_STANDALONE) \ + || HAS_E_DRIVER(TMC5160_STANDALONE) ) // // Stretching 'drivers.h' to include LPC/SAMD51 SD options // diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 7510e22d5b..0cbb35776e 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -578,9 +578,13 @@ #define MINIMUM_STEPPER_PULSE 2 #elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984) #define MINIMUM_STEPPER_PULSE 1 - #elif HAS_DRIVER(LV8729) - #define MINIMUM_STEPPER_PULSE 0 #elif TRINAMICS + #if ENABLED(LIN_ADVANCE) && (HAS_TMC_STANDALONE_E_DRIVER || (HAS_TMC_E_DRIVER && DISABLED(SQUARE_WAVE_STEPPING))) + #define MINIMUM_STEPPER_PULSE 1 + #else + #define MINIMUM_STEPPER_PULSE 0 + #endif + #elif HAS_DRIVER(LV8729) #define MINIMUM_STEPPER_PULSE 0 #else #define MINIMUM_STEPPER_PULSE 2 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 62bbe979d9..8eaf10a75f 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2546,3 +2546,11 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "SHOW_REMAINING_TIME currently requires a Graphical LCD." #endif #endif + +#if ENABLED(LIN_ADVANCE) && MINIMUM_STEPPER_PULSE < 1 + #if HAS_TMC_STANDALONE_E_DRIVER + #error "LIN_ADVANCE with TMC standalone driver on extruder requires MIMIMUM_STEPPER_PULSE >= 1" + #elif HAS_TMC_E_DRIVER && DISABLED(SQUARE_WAVE_STEPPING) + #error "LIN_ADVANCE with TMC driver on extruder requires SQUARE_WAVE_STEPPING or MINIMUM_STEPPER_PULSE >= 1" + #endif +#endif