0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 14:12:52 +00:00

🔧 Update multi-stepper axis conditionals (#25798)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2023-05-10 08:37:34 +12:00 committed by GitHub
parent 3a8809c1a7
commit d52d26b4ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 142 additions and 124 deletions

View file

@ -859,7 +859,7 @@
#endif
#endif
#if HAS_DUAL_Y_STEPPERS
#if HAS_Y2_STEPPER
//#define INVERT_Y2_VS_Y_DIR // Y2 direction signal is the opposite of Y
//#define Y_DUAL_ENDSTOPS // Y2 has its own endstop
#if ENABLED(Y_DUAL_ENDSTOPS)

View file

@ -64,7 +64,7 @@
#define AXIS_DRIVER_TYPE_W(T) _AXIS_DRIVER_TYPE(W,T)
#define AXIS_DRIVER_TYPE_X2(T) (HAS_X2_STEPPER && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (HAS_DUAL_Y_STEPPERS && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (HAS_Y2_STEPPER && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T))
#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T))

View file

@ -803,33 +803,34 @@
#endif
#if NUM_AXES >= 1
#define HAS_X_AXIS 1
#endif
#if NUM_AXES >= XY
#define HAS_Y_AXIS 1
#endif
#if NUM_AXES >= XYZ
#define HAS_Z_AXIS 1
#endif
#if NUM_AXES >= 4
#define HAS_I_AXIS 1
#endif
#if NUM_AXES >= 5
#define HAS_J_AXIS 1
#endif
#if NUM_AXES >= 6
#define HAS_K_AXIS 1
#endif
#if NUM_AXES >= 7
#define HAS_U_AXIS 1
#endif
#if NUM_AXES >= 8
#define HAS_V_AXIS 1
#endif
#if NUM_AXES >= 9
#define HAS_W_AXIS 1
#if NUM_AXES >= XY
#define HAS_Y_AXIS 1
#if NUM_AXES >= XYZ
#define HAS_Z_AXIS 1
#if NUM_AXES >= 4
#define HAS_I_AXIS 1
#if NUM_AXES >= 5
#define HAS_J_AXIS 1
#if NUM_AXES >= 6
#define HAS_K_AXIS 1
#if NUM_AXES >= 7
#define HAS_U_AXIS 1
#if NUM_AXES >= 8
#define HAS_V_AXIS 1
#if NUM_AXES >= 9
#define HAS_W_AXIS 1
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#if !HAS_X_AXIS
#undef AVOID_OBSTACLES
#undef ENDSTOPPULLUP_XMIN
#undef ENDSTOPPULLUP_XMAX
#undef X_MIN_ENDSTOP_INVERTING
@ -1001,11 +1002,9 @@
#ifdef X2_DRIVER_TYPE
#define HAS_X2_STEPPER 1
// Dual X Carriage isn't known yet. TODO: Consider moving it to Configuration.h.
#endif
#ifdef Y2_DRIVER_TYPE
#define HAS_Y2_STEPPER 1
#define HAS_DUAL_Y_STEPPERS 1
#endif
/**

View file

@ -882,17 +882,28 @@
#define HAS_MOTOR_CURRENT_I2C 1
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#ifdef Z_STEPPER_ALIGN_STEPPER_XY
#define HAS_Z_STEPPER_ALIGN_STEPPER_XY 1
#undef Z_STEPPER_ALIGN_AMP
#endif
#ifndef Z_STEPPER_ALIGN_AMP
#define Z_STEPPER_ALIGN_AMP 1.0
#endif
// X2 but not IDEX => Dual Synchronized X Steppers
#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
#define HAS_SYNCED_X_STEPPERS 1
#endif
// Y2 Stepper => Dual Synchronized Y Steppers
#ifdef Y2_DRIVER_TYPE
#define HAS_SYNCED_Y_STEPPERS 1
#endif
// Multiple Z steppers
#ifdef INVERT_Z_DIR
#if NUM_Z_STEPPERS >= 2 && !defined(INVERT_Z2_DIR)
#define INVERT_Z2_DIR INVERT_Z_DIR
#if NUM_Z_STEPPERS >= 3 && !defined(INVERT_Z3_DIR)
#define INVERT_Z3_DIR INVERT_Z_DIR
#if NUM_Z_STEPPERS >= 4 && !defined(INVERT_Z4_DIR)
#define INVERT_Z4_DIR INVERT_Z_DIR
#endif
#endif
#endif
#endif
#if NUM_Z_STEPPERS < 4
#undef INVERT_Z4_VS_Z_DIR
#if NUM_Z_STEPPERS < 3
@ -903,8 +914,15 @@
#endif
#endif
#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
#define HAS_DUAL_X_STEPPERS 1
// Z Stepper Auto-align
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#ifdef Z_STEPPER_ALIGN_STEPPER_XY
#define HAS_Z_STEPPER_ALIGN_STEPPER_XY 1
#undef Z_STEPPER_ALIGN_AMP
#endif
#ifndef Z_STEPPER_ALIGN_AMP
#define Z_STEPPER_ALIGN_AMP 1.0
#endif
#endif
//

View file

@ -1077,17 +1077,19 @@
#define HAS_Y_MS_PINS 1
#endif
#if PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))
#define HAS_Y2_ENABLE 1
#endif
#if PIN_EXISTS(Y2_DIR)
#define HAS_Y2_DIR 1
#endif
#if PIN_EXISTS(Y2_STEP)
#define HAS_Y2_STEP 1
#endif
#if PIN_EXISTS(Y2_MS1)
#define HAS_Y2_MS_PINS 1
#if HAS_Y2_STEPPER
#if PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))
#define HAS_Y2_ENABLE 1
#endif
#if PIN_EXISTS(Y2_DIR)
#define HAS_Y2_DIR 1
#endif
#if PIN_EXISTS(Y2_STEP)
#define HAS_Y2_STEP 1
#endif
#if PIN_EXISTS(Y2_MS1)
#define HAS_Y2_MS_PINS 1
#endif
#endif
#endif
@ -1439,7 +1441,6 @@
#define X_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(X2)
#if defined(X2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)
#define X2_SENSORLESS 1
@ -1477,22 +1478,22 @@
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 0
#endif
#if HAS_DUAL_Y_STEPPERS
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
#define Y2_HAS_STEALTHCHOP 1
#endif
#ifndef Y2_INTERPOLATE
#define Y2_INTERPOLATE Y_INTERPOLATE
#endif
#ifndef Y2_HOLD_MULTIPLIER
#define Y2_HOLD_MULTIPLIER Y_HOLD_MULTIPLIER
#endif
#ifndef Y2_SLAVE_ADDRESS
#define Y2_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(Y2)
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
#define Y2_HAS_STEALTHCHOP 1
#endif
#ifndef Y2_INTERPOLATE
#define Y2_INTERPOLATE Y_INTERPOLATE
#endif
#ifndef Y2_HOLD_MULTIPLIER
#define Y2_HOLD_MULTIPLIER Y_HOLD_MULTIPLIER
#endif
#ifndef Y2_SLAVE_ADDRESS
#define Y2_SLAVE_ADDRESS 0
#endif
#endif
@ -1515,56 +1516,56 @@
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 0
#endif
#if NUM_Z_STEPPERS >= 2
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
#define Z2_HAS_STEALTHCHOP 1
#endif
#ifndef Z2_INTERPOLATE
#define Z2_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z2_HOLD_MULTIPLIER
#define Z2_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z2_SLAVE_ADDRESS
#define Z2_SLAVE_ADDRESS 0
#endif
#endif
#if NUM_Z_STEPPERS >= 2 && AXIS_IS_TMC(Z2)
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#endif
#if NUM_Z_STEPPERS >= 3
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
#define Z3_HAS_STEALTHCHOP 1
#endif
#ifndef Z3_INTERPOLATE
#define Z3_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z3_HOLD_MULTIPLIER
#define Z3_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z3_SLAVE_ADDRESS
#define Z3_SLAVE_ADDRESS 0
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
#define Z2_HAS_STEALTHCHOP 1
#endif
#if NUM_Z_STEPPERS >= 4
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z4)
#define Z4_HAS_STEALTHCHOP 1
#endif
#ifndef Z4_INTERPOLATE
#define Z4_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z4_HOLD_MULTIPLIER
#define Z4_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z4_SLAVE_ADDRESS
#define Z4_SLAVE_ADDRESS 0
#endif
#ifndef Z2_INTERPOLATE
#define Z2_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z2_HOLD_MULTIPLIER
#define Z2_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z2_SLAVE_ADDRESS
#define Z2_SLAVE_ADDRESS 0
#endif
#endif
#if NUM_Z_STEPPERS >= 3 && AXIS_IS_TMC(Z3)
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
#define Z3_HAS_STEALTHCHOP 1
#endif
#ifndef Z3_INTERPOLATE
#define Z3_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z3_HOLD_MULTIPLIER
#define Z3_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z3_SLAVE_ADDRESS
#define Z3_SLAVE_ADDRESS 0
#endif
#endif
#if NUM_Z_STEPPERS >= 4 && AXIS_IS_TMC(Z4)
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z4)
#define Z4_HAS_STEALTHCHOP 1
#endif
#ifndef Z4_INTERPOLATE
#define Z4_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z4_HOLD_MULTIPLIER
#define Z4_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Z4_SLAVE_ADDRESS
#define Z4_SLAVE_ADDRESS 0
#endif
#endif

View file

@ -243,7 +243,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#if HAS_X2_STEPPER && !GOOD_AXIS_PINS(X2)
#error "If X2_DRIVER_TYPE is defined, then X2 ENABLE/STEP/DIR pins are also needed."
#endif
#if HAS_DUAL_Y_STEPPERS && !GOOD_AXIS_PINS(Y2)
#if HAS_Y2_STEPPER && !GOOD_AXIS_PINS(Y2)
#error "If Y2_DRIVER_TYPE is defined, then Y2 ENABLE/STEP/DIR pins are also needed."
#endif
#if HAS_Z_AXIS
@ -4035,7 +4035,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
/**
* Fixed-Time Motion limitations
*/
#if ENABLED(FT_MOTION) && (NUM_AXES > 3 || E_STEPPERS > 1 || NUM_Z_STEPPERS > 1 || ANY(DUAL_X_CARRIAGE, HAS_DUAL_X_STEPPERS, HAS_DUAL_Y_STEPPERS, HAS_MULTI_EXTRUDER, MIXING_EXTRUDER))
#if ENABLED(FT_MOTION) && (NUM_AXES > 3 || E_STEPPERS > 1 || NUM_Z_STEPPERS > 1 || ANY(DUAL_X_CARRIAGE, HAS_SYNCED_X_STEPPERS, HAS_SYNCED_Y_STEPPERS, HAS_MULTI_EXTRUDER, MIXING_EXTRUDER))
#error "FT_MOTION is currently limited to machines with 3 linear axes and a single extruder."
#endif

View file

@ -382,7 +382,7 @@ xyze_int8_t Stepper::count_direction{0};
A##4_STEP_WRITE(V); \
}
#if HAS_DUAL_X_STEPPERS
#if HAS_SYNCED_X_STEPPERS
#define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE(INVERT_DIR(X2_VS_X, v)); }while(0)
#if ENABLED(X_DUAL_ENDSTOPS)
#define X_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(X,v)
@ -403,7 +403,7 @@ xyze_int8_t Stepper::count_direction{0};
#define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
#endif
#if HAS_DUAL_Y_STEPPERS
#if HAS_SYNCED_Y_STEPPERS
#define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE(INVERT_DIR(Y2_VS_Y, v)); }while(0)
#if ENABLED(Y_DUAL_ENDSTOPS)
#define Y_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Y,v)
@ -2892,7 +2892,7 @@ void Stepper::init() {
TERN_(HAS_X2_DIR, X2_DIR_INIT());
#if HAS_Y_DIR
Y_DIR_INIT();
#if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_DIR)
#if BOTH(HAS_Y2_STEPPER, HAS_Y2_DIR)
Y2_DIR_INIT();
#endif
#endif
@ -2955,7 +2955,7 @@ void Stepper::init() {
#endif
Y_ENABLE_INIT();
if (Y_ENABLE_INIT_STATE) Y_ENABLE_WRITE(Y_ENABLE_INIT_STATE);
#if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_ENABLE)
#if BOTH(HAS_Y2_STEPPER, HAS_Y2_ENABLE)
Y2_ENABLE_INIT();
if (Y_ENABLE_INIT_STATE) Y2_ENABLE_WRITE(Y_ENABLE_INIT_STATE);
#endif
@ -3084,7 +3084,7 @@ void Stepper::init() {
#endif
#if HAS_Y_STEP
#if HAS_DUAL_Y_STEPPERS
#if HAS_Y2_STEPPER
Y2_STEP_INIT();
Y2_STEP_WRITE(!STEP_STATE_Y);
#endif

View file

@ -794,14 +794,14 @@
#endif
// Y2 auto-assignment will use up an E stepper, but not if it's chained
#if HAS_DUAL_Y_STEPPERS && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN)
#if HAS_Y2_STEPPER && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN)
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
#else
#define Z2_E_INDEX Y2_E_INDEX
#endif
// The Y2 axis, if any, should be the next open extruder port
#if HAS_DUAL_Y_STEPPERS
#if HAS_Y2_STEPPER
#ifndef Y2_STEP_PIN
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)

View file

@ -785,7 +785,7 @@
#define _X2_PINS
#endif
#if HAS_DUAL_Y_STEPPERS
#if HAS_Y2_STEPPER
#if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2)
#define _Y2_CS Y2_CS_PIN,
#else