From b1b8161447b0bc835fc563fab64faacef1e90965 Mon Sep 17 00:00:00 2001 From: ellensp Date: Wed, 21 Oct 2020 09:01:46 +1300 Subject: [PATCH] Handle dependent Stepper Driver defaults later (#19820) Co-authored-by: Scott Lahteine --- Marlin/src/inc/Conditionals_LCD.h | 52 +++++++++++++------------------ Marlin/src/inc/Conditionals_adv.h | 27 +++++++++++++--- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index d4cae0b64c..b22c608658 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -781,77 +781,67 @@ #define HAS_ETHERNET 1 #endif -// Fallback Stepper Driver types +// Fallback Stepper Driver types that don't depend on Configuration_adv.h #ifndef X_DRIVER_TYPE - #define X_DRIVER_TYPE A4988 + #define X_DRIVER_TYPE A4988 #endif -#ifndef Y_DRIVER_TYPE - #define Y_DRIVER_TYPE A4988 -#endif -#ifndef Z_DRIVER_TYPE - #define Z_DRIVER_TYPE A4988 -#endif -#if NONE(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) - #undef X2_DRIVER_TYPE -#elif !defined(X2_DRIVER_TYPE) +#ifndef X2_DRIVER_TYPE #define X2_DRIVER_TYPE A4988 #endif -#if DISABLED(Y_DUAL_STEPPER_DRIVERS) - #undef Y2_DRIVER_TYPE -#elif !defined(Y2_DRIVER_TYPE) +#ifndef Y_DRIVER_TYPE + #define Y_DRIVER_TYPE A4988 +#endif +#ifndef Y2_DRIVER_TYPE #define Y2_DRIVER_TYPE A4988 #endif -#if NUM_Z_STEPPER_DRIVERS < 2 - #undef Z2_DRIVER_TYPE -#elif !defined(Z2_DRIVER_TYPE) +#ifndef Z_DRIVER_TYPE + #define Z_DRIVER_TYPE A4988 +#endif +#ifndef Z2_DRIVER_TYPE #define Z2_DRIVER_TYPE A4988 #endif -#if NUM_Z_STEPPER_DRIVERS < 3 - #undef Z3_DRIVER_TYPE -#elif !defined(Z3_DRIVER_TYPE) +#ifndef Z3_DRIVER_TYPE #define Z3_DRIVER_TYPE A4988 #endif -#if NUM_Z_STEPPER_DRIVERS < 4 - #undef Z4_DRIVER_TYPE -#elif !defined(Z4_DRIVER_TYPE) +#ifndef Z4_DRIVER_TYPE #define Z4_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 1 +#if E_STEPPERS <= 0 #undef E0_DRIVER_TYPE #elif !defined(E0_DRIVER_TYPE) #define E0_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 2 +#if E_STEPPERS <= 1 #undef E1_DRIVER_TYPE #elif !defined(E1_DRIVER_TYPE) #define E1_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 3 +#if E_STEPPERS <= 2 #undef E2_DRIVER_TYPE #elif !defined(E2_DRIVER_TYPE) #define E2_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 4 +#if E_STEPPERS <= 3 #undef E3_DRIVER_TYPE #elif !defined(E3_DRIVER_TYPE) #define E3_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 5 +#if E_STEPPERS <= 4 #undef E4_DRIVER_TYPE #elif !defined(E4_DRIVER_TYPE) #define E4_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 6 +#if E_STEPPERS <= 5 #undef E5_DRIVER_TYPE #elif !defined(E5_DRIVER_TYPE) #define E5_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 7 +#if E_STEPPERS <= 6 #undef E6_DRIVER_TYPE #elif !defined(E6_DRIVER_TYPE) #define E6_DRIVER_TYPE A4988 #endif -#if E_STEPPERS < 8 +#if E_STEPPERS <= 7 #undef E7_DRIVER_TYPE #elif !defined(E7_DRIVER_TYPE) #define E7_DRIVER_TYPE A4988 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 78c014865c..05935be549 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -178,16 +178,35 @@ #define HAS_MOTOR_CURRENT_I2C 1 #endif +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) + #undef Z_STEPPER_ALIGN_AMP + #endif + #ifndef Z_STEPPER_ALIGN_AMP + #define Z_STEPPER_ALIGN_AMP 1.0 + #endif +#endif + // Multiple Z steppers #ifndef NUM_Z_STEPPER_DRIVERS #define NUM_Z_STEPPER_DRIVERS 1 #endif -#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) - #undef Z_STEPPER_ALIGN_AMP +// Fallback Stepper Driver types that depend on Configuration_adv.h +#if NONE(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) + #undef X2_DRIVER_TYPE +#endif +#if DISABLED(Y_DUAL_STEPPER_DRIVERS) + #undef Y2_DRIVER_TYPE +#endif +#if NUM_Z_STEPPER_DRIVERS < 2 + #undef Z2_DRIVER_TYPE +#endif +#if NUM_Z_STEPPER_DRIVERS < 3 + #undef Z3_DRIVER_TYPE #endif -#ifndef Z_STEPPER_ALIGN_AMP - #define Z_STEPPER_ALIGN_AMP 1.0 +#if NUM_Z_STEPPER_DRIVERS < 4 + #undef Z4_DRIVER_TYPE #endif //