Simplify stepper driver per-axis selection

This commit is contained in:
teemuatlut
2018-07-14 14:13:06 +03:00
committed by Scott Lahteine
parent e5c0b490c8
commit fbcdf5eaeb
26 changed files with 744 additions and 837 deletions

View File

@ -426,6 +426,63 @@
#define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__)
#define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
/**
* Driver Timings
* NOTE: Driver timing order is longest-to-shortest duration.
* Preserve this ordering when adding new drivers.
*/
#ifndef MINIMUM_STEPPER_DIR_DELAY
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_DIR_DELAY 15000
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_DIR_DELAY 1500
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_DIR_DELAY 650
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_DIR_DELAY 500
#elif HAS_DRIVER(A4988)
#define MINIMUM_STEPPER_DIR_DELAY 200
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MINIMUM_STEPPER_DIR_DELAY 20
#else
#define MINIMUM_STEPPER_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire
#endif
#endif
#ifndef MINIMUM_STEPPER_PULSE
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_PULSE 30
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_PULSE 3
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_PULSE 2
#elif HAS_DRIVER(A4988) || HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_PULSE 1
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MINIMUM_STEPPER_PULSE 0
#else
#define MINIMUM_STEPPER_PULSE 2
#endif
#endif
#ifndef MAXIMUM_STEPPER_RATE
#if HAS_DRIVER(TB6560)
#define MAXIMUM_STEPPER_RATE 15000
#elif HAS_DRIVER(LV8729)
#define MAXIMUM_STEPPER_RATE 130000
#elif HAS_DRIVER(TB6600)
#define MAXIMUM_STEPPER_RATE 150000
#elif HAS_DRIVER(DRV8825)
#define MAXIMUM_STEPPER_RATE 250000
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MAXIMUM_STEPPER_RATE 400000
#elif HAS_DRIVER(A4988)
#define MAXIMUM_STEPPER_RATE 500000
#else
#define MAXIMUM_STEPPER_RATE 250000
#endif
#endif
/**
* X_DUAL_ENDSTOPS endstop reassignment
*/
@ -711,27 +768,19 @@
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
// Trinamic Stepper Drivers
#define HAS_TRINAMIC (ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208) || ENABLED(IS_TRAMS))
#define X_IS_TRINAMIC (ENABLED( X_IS_TMC2130) || ENABLED( X_IS_TMC2208) || ENABLED(IS_TRAMS))
#define X2_IS_TRINAMIC (ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208))
#define Y_IS_TRINAMIC (ENABLED( Y_IS_TMC2130) || ENABLED( Y_IS_TMC2208) || ENABLED(IS_TRAMS))
#define Y2_IS_TRINAMIC (ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208))
#define Z_IS_TRINAMIC (ENABLED( Z_IS_TMC2130) || ENABLED( Z_IS_TMC2208) || ENABLED(IS_TRAMS))
#define Z2_IS_TRINAMIC (ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208))
#define E0_IS_TRINAMIC (ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208) || ENABLED(IS_TRAMS))
#define E1_IS_TRINAMIC (ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208))
#define E2_IS_TRINAMIC (ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208))
#define E3_IS_TRINAMIC (ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208))
#define E4_IS_TRINAMIC (ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208))
#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
#define HAS_STALLGUARD (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660))
#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
#define AXIS_HAS_STALLGUARD(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660) )
#if ENABLED(SENSORLESS_HOMING)
// Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE
#undef Z_HOMING_SENSITIVITY
#endif
#define X_SENSORLESS (ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY))
#define Y_SENSORLESS (ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY))
#define Z_SENSORLESS (ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY))
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY))
#endif
// Endstops and bed probe

View File

@ -29,6 +29,7 @@
#include "../core/types.h"
#include "Version.h"
#include "../../Configuration.h"
#include "../core/drivers.h"
#include "Conditionals_LCD.h"
#include "../../Configuration_adv.h"
#include "Conditionals_adv.h"

View File

@ -265,10 +265,28 @@
#elif defined(MEASURED_LOWER_LIMIT) || defined(MEASURED_UPPER_LIMIT)
#error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN. Please update your configuration."
#elif defined(HAVE_TMCDRIVER)
#error "HAVE_TMCDRIVER is now HAVE_TMC26X. Please update your Configuration_adv.h."
#error "HAVE_TMCDRIVER is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(HAVE_TMC26X)
#error "HAVE_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(HAVE_TMC2130)
#error "HAVE_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130. Please update your Configuration.h."
#elif defined(HAVE_L6470DRIVER)
#error "HAVE_L6470DRIVER is now [AXIS]_DRIVER_TYPE L6470. Please update your Configuration.h."
#elif defined(X_IS_TMC) || defined(X2_IS_TMC) || defined(Y_IS_TMC) || defined(Y2_IS_TMC) || defined(Z_IS_TMC) || defined(Z2_IS_TMC) \
|| defined(E0_IS_TMC) || defined(E1_IS_TMC) || defined(E2_IS_TMC) || defined(E3_IS_TMC) || defined(E4_IS_TMC)
#error "[AXIS]_IS_TMC is now [AXIS]_IS_TMC26X. Please update your Configuration_adv.h."
#error "[AXIS]_IS_TMC is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(X_IS_TMC26X) || defined(X2_IS_TMC26X) || defined(Y_IS_TMC26X) || defined(Y2_IS_TMC26X) || defined(Z_IS_TMC26X) || defined(Z2_IS_TMC26X) \
|| defined(E0_IS_TMC26X) || defined(E1_IS_TMC26X) || defined(E2_IS_TMC26X) || defined(E3_IS_TMC26X) || defined(E4_IS_TMC26X)
#error "[AXIS]_IS_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(X_IS_TMC2130) || defined(X2_IS_TMC2130) || defined(Y_IS_TMC2130) || defined(Y2_IS_TMC2130) || defined(Z_IS_TMC2130) || defined(Z2_IS_TMC2130) \
|| defined(E0_IS_TMC2130) || defined(E1_IS_TMC2130) || defined(E2_IS_TMC2130) || defined(E3_IS_TMC2130) || defined(E4_IS_TMC2130)
#error "[AXIS]_IS_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130. Please update your Configuration.h."
#elif defined(X_IS_TMC2208) || defined(X2_IS_TMC2208) || defined(Y_IS_TMC2208) || defined(Y2_IS_TMC2208) || defined(Z_IS_TMC2208) || defined(Z2_IS_TMC2208) \
|| defined(E0_IS_TMC2208) || defined(E1_IS_TMC2208) || defined(E2_IS_TMC2208) || defined(E3_IS_TMC2208) || defined(E4_IS_TMC2208)
#error "[AXIS]_IS_TMC2208 is now [AXIS]_DRIVER_TYPE TMC2208. Please update your Configuration.h."
#elif defined(X_IS_L6470) || defined(X2_IS_L6470) || defined(Y_IS_L6470) || defined(Y2_IS_L6470) || defined(Z_IS_L6470) || defined(Z2_IS_L6470) \
|| defined(E0_IS_L6470) || defined(E1_IS_L6470) || defined(E2_IS_L6470) || defined(E3_IS_L6470) || defined(E4_IS_L6470)
#error "[AXIS]_IS_L6470 is now [AXIS]_DRIVER_TYPE L6470. Please update your Configuration.h."
#elif defined(AUTOMATIC_CURRENT_CONTROL)
#error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration."
#elif defined(FILAMENT_CHANGE_LOAD_LENGTH)
@ -974,15 +992,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
*/
#if ENABLED(Z_SAFE_HOMING)
#if HAS_BED_PROBE
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, MIN_PROBE_X, MAX_PROBE_X),
"Z_SAFE_HOMING_X_POINT is outside the probe region.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, MIN_PROBE_Y, MAX_PROBE_Y),
"Z_SAFE_HOMING_Y_POINT is outside the probe region.");
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, MIN_PROBE_X, MAX_PROBE_X), "Z_SAFE_HOMING_X_POINT is outside the probe region.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, MIN_PROBE_Y, MAX_PROBE_Y), "Z_SAFE_HOMING_Y_POINT is outside the probe region.");
#else
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS),
"Z_SAFE_HOMING_X_POINT can't be reached by the nozzle.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS),
"Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS), "Z_SAFE_HOMING_X_POINT can't be reached by the nozzle.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS), "Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
#endif
#endif // Z_SAFE_HOMING
@ -1458,128 +1472,36 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#endif
/**
* Make sure HAVE_TMC26X is warranted
* Check existing CS pins against enabled TMC SPI drivers.
*/
#if ENABLED(HAVE_TMC26X) && !( \
ENABLED( X_IS_TMC26X ) \
|| ENABLED( X2_IS_TMC26X ) \
|| ENABLED( Y_IS_TMC26X ) \
|| ENABLED( Y2_IS_TMC26X ) \
|| ENABLED( Z_IS_TMC26X ) \
|| ENABLED( Z2_IS_TMC26X ) \
|| ENABLED( E0_IS_TMC26X ) \
|| ENABLED( E1_IS_TMC26X ) \
|| ENABLED( E2_IS_TMC26X ) \
|| ENABLED( E3_IS_TMC26X ) \
|| ENABLED( E4_IS_TMC26X ) \
)
#error "HAVE_TMC26X requires at least one TMC26X stepper to be set."
#endif
/**
* Make sure HAVE_TMC2130 is warranted
*/
#if ENABLED(HAVE_TMC2130)
#if !( ENABLED( X_IS_TMC2130 ) \
|| ENABLED( X2_IS_TMC2130 ) \
|| ENABLED( Y_IS_TMC2130 ) \
|| ENABLED( Y2_IS_TMC2130 ) \
|| ENABLED( Z_IS_TMC2130 ) \
|| ENABLED( Z2_IS_TMC2130 ) \
|| ENABLED( E0_IS_TMC2130 ) \
|| ENABLED( E1_IS_TMC2130 ) \
|| ENABLED( E2_IS_TMC2130 ) \
|| ENABLED( E3_IS_TMC2130 ) \
|| ENABLED( E4_IS_TMC2130 ) )
#error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
#elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif
#if ENABLED(X_IS_TMC2130) && !PIN_EXISTS(X_CS)
#error "X_CS_PIN is required for X_IS_TMC2130. Define X_CS_PIN in Configuration_adv.h."
#elif ENABLED(X2_IS_TMC2130) && !PIN_EXISTS(X2_CS)
#error "X2_CS_PIN is required for X2_IS_TMC2130. Define X2_CS_PIN in Configuration_adv.h."
#elif ENABLED(Y_IS_TMC2130) && !PIN_EXISTS(Y_CS)
#error "Y_CS_PIN is required for Y_IS_TMC2130. Define Y_CS_PIN in Configuration_adv.h."
#elif ENABLED(Y2_IS_TMC2130) && !PIN_EXISTS(Y2_CS)
#error "Y2_CS_PIN is required for Y2_IS_TMC2130. Define Y2_CS_PIN in Configuration_adv.h."
#elif ENABLED(Z_IS_TMC2130) && !PIN_EXISTS(Z_CS)
#error "Z_CS_PIN is required for Z_IS_TMC2130. Define Z_CS_PIN in Configuration_adv.h."
#elif ENABLED(Z2_IS_TMC2130) && !PIN_EXISTS(Z2_CS)
#error "Z2_CS_PIN is required for Z2_IS_TMC2130. Define Z2_CS_PIN in Configuration_adv.h."
#elif ENABLED(E0_IS_TMC2130) && !PIN_EXISTS(E0_CS)
#error "E0_CS_PIN is required for E0_IS_TMC2130. Define E0_CS_PIN in Configuration_adv.h."
#elif ENABLED(E1_IS_TMC2130) && !PIN_EXISTS(E1_CS)
#error "E1_CS_PIN is required for E1_IS_TMC2130. Define E1_CS_PIN in Configuration_adv.h."
#elif ENABLED(E2_IS_TMC2130) && !PIN_EXISTS(E2_CS)
#error "E2_CS_PIN is required for E2_IS_TMC2130. Define E2_CS_PIN in Configuration_adv.h."
#elif ENABLED(E3_IS_TMC2130) && !PIN_EXISTS(E3_CS)
#error "E3_CS_PIN is required for E3_IS_TMC2130. Define E3_CS_PIN in Configuration_adv.h."
#elif ENABLED(E4_IS_TMC2130) && !PIN_EXISTS(E4_CS)
#error "E4_CS_PIN is required for E4_IS_TMC2130. Define E4_CS_PIN in Configuration_adv.h."
#endif
#if ENABLED(SENSORLESS_HOMING)
// Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
// is necessary in order to reset the stallGuard indication between the initial movement of all three
// towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
// clearing the stallGuard activated status is found.
#if ENABLED(DELTA) && !ENABLED(STEALTHCHOP)
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP."
#elif X_SENSORLESS && X_HOME_DIR == -1 && (DISABLED(X_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR == 1 && (DISABLED(X_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (DISABLED(Y_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (DISABLED(Y_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (DISABLED(Z_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENABLED(ENDSTOP_NOISE_FILTER)
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_FILTER."
#endif
#endif
// Sensorless homing is required for both combined steppers in an H-bot
#if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
#error "CoreXY requires both X and Y to use sensorless homing if either does."
#elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS
#error "CoreXZ requires both X and Z to use sensorless homing if either does."
#elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS
#error "CoreYZ requires both Y and Z to use sensorless homing if either does."
#endif
#elif ENABLED(SENSORLESS_HOMING)
#error "SENSORLESS_HOMING requires TMC2130 stepper drivers."
#endif
/**
* Make sure HAVE_TMC2208 is warranted
*/
#if ENABLED(HAVE_TMC2208) && !( \
ENABLED( X_IS_TMC2208 ) \
|| ENABLED( X2_IS_TMC2208 ) \
|| ENABLED( Y_IS_TMC2208 ) \
|| ENABLED( Y2_IS_TMC2208 ) \
|| ENABLED( Z_IS_TMC2208 ) \
|| ENABLED( Z2_IS_TMC2208 ) \
|| ENABLED( E0_IS_TMC2208 ) \
|| ENABLED( E1_IS_TMC2208 ) \
|| ENABLED( E2_IS_TMC2208 ) \
|| ENABLED( E3_IS_TMC2208 ) )
#error "HAVE_TMC2208 requires at least one TMC2208 stepper to be set."
#if AXIS_DRIVER_TYPE(X, TMC2130) && !PIN_EXISTS(X_CS)
#error "X_CS_PIN is required for TMC2130. Define X_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(X2, TMC2130) && !PIN_EXISTS(X2_CS)
#error "X2_CS_PIN is required for X2. Define X2_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(Y, TMC2130) && !PIN_EXISTS(Y_CS)
#error "Y_CS_PIN is required for TMC2130. Define Y_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(Y2, TMC2130) && !PIN_EXISTS(Y2_CS)
#error "Y2_CS_PIN is required for TMC2130. Define Y2_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(Z, TMC2130) && !PIN_EXISTS(Z_CS)
#error "Z_CS_PIN is required for TMC2130. Define Z_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(Z2, TMC2130) && !PIN_EXISTS(Z2_CS)
#error "Z2_CS_PIN is required for TMC2130. Define Z2_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(E0, TMC2130) && !PIN_EXISTS(E0_CS)
#error "E0_CS_PIN is required for TMC2130. Define E0_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(E1, TMC2130) && !PIN_EXISTS(E1_CS)
#error "E1_CS_PIN is required for TMC2130. Define E1_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(E2, TMC2130) && !PIN_EXISTS(E2_CS)
#error "E2_CS_PIN is required for TMC2130. Define E2_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(E3, TMC2130) && !PIN_EXISTS(E3_CS)
#error "E3_CS_PIN is required for TMC2130. Define E3_CS_PIN in Configuration_adv.h."
#elif AXIS_DRIVER_TYPE(E4, TMC2130) && !PIN_EXISTS(E4_CS)
#error "E4_CS_PIN is required for TMC2130. Define E4_CS_PIN in Configuration_adv.h."
#endif
/**
* TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
*/
#if ENABLED(HAVE_TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
#if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
defined(X_HARDWARE_SERIAL ) \
|| defined(X2_HARDWARE_SERIAL) \
|| defined(Y_HARDWARE_SERIAL ) \
@ -1594,113 +1516,52 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE."
#endif
#if ENABLED(SENSORLESS_HOMING)
// Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
// is necessary in order to reset the stallGuard indication between the initial movement of all three
// towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
// clearing the stallGuard activated status is found.
#if ENABLED(DELTA) && !ENABLED(STEALTHCHOP)
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP."
#elif X_SENSORLESS && X_HOME_DIR == -1 && (DISABLED(X_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR == 1 && (DISABLED(X_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (DISABLED(Y_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (DISABLED(Y_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (DISABLED(Z_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENABLED(ENDSTOP_NOISE_FILTER)
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_FILTER."
#endif
#endif
// Sensorless homing is required for both combined steppers in an H-bot
#if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
#error "CoreXY requires both X and Y to use sensorless homing if either does."
#elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS
#error "CoreXZ requires both X and Z to use sensorless homing if either does."
#elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS
#error "CoreYZ requires both Y and Z to use sensorless homing if either does."
#endif
#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif
#if ENABLED(TMC_Z_CALIBRATION) && !Z_IS_TRINAMIC && !Z2_IS_TRINAMIC
#if ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2)
#error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis"
#endif
/**
* Make sure HAVE_L6470DRIVER is warranted
*/
#if ENABLED(HAVE_L6470DRIVER) && !( \
ENABLED( X_IS_L6470 ) \
|| ENABLED( X2_IS_L6470 ) \
|| ENABLED( Y_IS_L6470 ) \
|| ENABLED( Y2_IS_L6470 ) \
|| ENABLED( Z_IS_L6470 ) \
|| ENABLED( Z2_IS_L6470 ) \
|| ENABLED( E0_IS_L6470 ) \
|| ENABLED( E1_IS_L6470 ) \
|| ENABLED( E2_IS_L6470 ) \
|| ENABLED( E3_IS_L6470 ) \
|| ENABLED( E4_IS_L6470 ) \
)
#error "HAVE_L6470DRIVER requires at least one L6470 stepper to be set."
#endif
/**
* Check that each axis has only one driver selected
*/
#if 1 < 0 \
+ ENABLED(X_IS_TMC26X) \
+ ENABLED(X_IS_TMC2130) \
+ ENABLED(X_IS_TMC2208) \
+ ENABLED(X_IS_L6470)
#error "Please enable only one stepper driver for the X axis."
#endif
#if 1 < 0 \
+ ENABLED(X2_IS_TMC26X) \
+ ENABLED(X2_IS_TMC2130) \
+ ENABLED(X2_IS_TMC2208) \
+ ENABLED(X2_IS_L6470)
#error "Please enable only one stepper driver for the X2 axis."
#endif
#if 1 < 0 \
+ ENABLED(Y_IS_TMC26X) \
+ ENABLED(Y_IS_TMC2130) \
+ ENABLED(Y_IS_TMC2208) \
+ ENABLED(Y_IS_L6470)
#error "Please enable only one stepper driver for the Y axis."
#endif
#if 1 < 0 \
+ ENABLED(Y2_IS_TMC26X) \
+ ENABLED(Y2_IS_TMC2130) \
+ ENABLED(Y2_IS_TMC2208) \
+ ENABLED(Y2_IS_L6470)
#error "Please enable only one stepper driver for the Y2 axis."
#endif
#if 1 < 0 \
+ ENABLED(Z_IS_TMC26X) \
+ ENABLED(Z_IS_TMC2130) \
+ ENABLED(Z_IS_TMC2208) \
+ ENABLED(Z_IS_L6470)
#error "Please enable only one stepper driver for the Z axis."
#endif
#if 1 < 0 \
+ ENABLED(Z2_IS_TMC26X) \
+ ENABLED(Z2_IS_TMC2130) \
+ ENABLED(Z2_IS_TMC2208) \
+ ENABLED(Z2_IS_L6470)
#error "Please enable only one stepper driver for the Z2 axis."
#endif
#if 1 < 0 \
+ ENABLED(E0_IS_TMC26X) \
+ ENABLED(E0_IS_TMC2130) \
+ ENABLED(E0_IS_TMC2208) \
+ ENABLED(E0_IS_L6470)
#error "Please enable only one stepper driver for the E0 axis."
#endif
#if 1 < 0 \
+ ENABLED(E1_IS_TMC26X) \
+ ENABLED(E1_IS_TMC2130) \
+ ENABLED(E1_IS_TMC2208) \
+ ENABLED(E1_IS_L6470)
#error "Please enable only one stepper driver for the E1 axis."
#endif
#if 1 < 0 \
+ ENABLED(E2_IS_TMC26X) \
+ ENABLED(E2_IS_TMC2130) \
+ ENABLED(E2_IS_TMC2208) \
+ ENABLED(E2_IS_L6470)
#error "Please enable only one stepper driver for the E2 axis."
#endif
#if 1 < 0 \
+ ENABLED(E3_IS_TMC26X) \
+ ENABLED(E3_IS_TMC2130) \
+ ENABLED(E3_IS_TMC2208) \
+ ENABLED(E3_IS_L6470)
#error "Please enable only one stepper driver for the E3 axis."
#endif
#if 1 < 0 \
+ ENABLED(E4_IS_TMC26X) \
+ ENABLED(E4_IS_TMC2130) \
+ ENABLED(E4_IS_TMC2208) \
+ ENABLED(E4_IS_L6470)
#error "Please enable only one stepper driver for the E4 axis."
#if ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
#error "SENSORLESS_HOMING requires TMC2130 or TMC2660 stepper drivers."
#endif
#if ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
#error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
#endif
/**
* Digipot requirement