Ensure A4988 for unspecified driver type (#19798)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2020-10-19 21:16:02 +13:00 committed by Scott Lahteine
parent e00745c548
commit cf0a817db1
5 changed files with 156 additions and 25 deletions

View file

@ -678,15 +678,15 @@
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
//#define X_DRIVER_TYPE A4988
//#define Y_DRIVER_TYPE A4988
//#define Z_DRIVER_TYPE A4988
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
//#define E0_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988

View file

@ -755,19 +755,7 @@
#define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y)
#endif
#ifndef INVERT_X_DIR
#define INVERT_X_DIR false
#endif
#ifndef INVERT_Y_DIR
#define INVERT_Y_DIR false
#endif
#ifndef INVERT_Z_DIR
#define INVERT_Z_DIR false
#endif
#ifndef INVERT_E_DIR
#define INVERT_E_DIR false
#endif
// Slim menu optimizations
#if ENABLED(SLIM_LCD_MENUS)
#define BOOT_MARLIN_LOGO_SMALL
#endif
@ -786,14 +774,105 @@
#define HAS_CLASSIC_E_JERK 1
#endif
#ifndef SPI_SPEED
#define SPI_SPEED SPI_FULL_SPEED
#endif
#if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
#define HAS_USB_SERIAL 1
#endif
// Fallback Stepper Driver types
#ifndef X_DRIVER_TYPE
#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)
#define X2_DRIVER_TYPE A4988
#endif
#if DISABLED(Y_DUAL_STEPPER_DRIVERS)
#undef Y2_DRIVER_TYPE
#elif !defined(Y2_DRIVER_TYPE)
#define Y2_DRIVER_TYPE A4988
#endif
#if NUM_Z_STEPPER_DRIVERS < 2
#undef Z2_DRIVER_TYPE
#elif !defined(Z2_DRIVER_TYPE)
#define Z2_DRIVER_TYPE A4988
#endif
#if NUM_Z_STEPPER_DRIVERS < 3
#undef Z3_DRIVER_TYPE
#elif !defined(Z3_DRIVER_TYPE)
#define Z3_DRIVER_TYPE A4988
#endif
#if NUM_Z_STEPPER_DRIVERS < 4
#undef Z4_DRIVER_TYPE
#elif !defined(Z4_DRIVER_TYPE)
#define Z4_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 1
#undef E0_DRIVER_TYPE
#elif !defined(E0_DRIVER_TYPE)
#define E0_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 2
#undef E1_DRIVER_TYPE
#elif !defined(E1_DRIVER_TYPE)
#define E1_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 3
#undef E2_DRIVER_TYPE
#elif !defined(E2_DRIVER_TYPE)
#define E2_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 4
#undef E3_DRIVER_TYPE
#elif !defined(E3_DRIVER_TYPE)
#define E3_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 5
#undef E4_DRIVER_TYPE
#elif !defined(E4_DRIVER_TYPE)
#define E4_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 6
#undef E5_DRIVER_TYPE
#elif !defined(E5_DRIVER_TYPE)
#define E5_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 7
#undef E6_DRIVER_TYPE
#elif !defined(E6_DRIVER_TYPE)
#define E6_DRIVER_TYPE A4988
#endif
#if E_STEPPERS < 8
#undef E7_DRIVER_TYPE
#elif !defined(E7_DRIVER_TYPE)
#define E7_DRIVER_TYPE A4988
#endif
// Fallback axis inverting
#ifndef INVERT_X_DIR
#define INVERT_X_DIR false
#endif
#ifndef INVERT_Y_DIR
#define INVERT_Y_DIR false
#endif
#ifndef INVERT_Z_DIR
#define INVERT_Z_DIR false
#endif
#ifndef INVERT_E_DIR
#define INVERT_E_DIR false
#endif
// Fallback SPI Speed
#ifndef SPI_SPEED
#define SPI_SPEED SPI_FULL_SPEED
#endif
/**
* This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation.

View file

@ -3179,5 +3179,59 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#endif
#endif
/**
* Sanity check for valid stepper driver types
*/
#define _BAD_DRIVER(A) (defined(A##_DRIVER_TYPE) && !_DRIVER_ID(A##_DRIVER_TYPE))
#if _BAD_DRIVER(X)
#error "X_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Y)
#error "Y_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Z)
#error "Z_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(X2)
#error "X2_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Y2)
#error "Y2_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Z2)
#error "Z2_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Z3)
#error "Z3_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(Z4)
#error "Z4_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E0)
#error "E0_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E1)
#error "E1_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E2)
#error "E2_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E3)
#error "E3_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E4)
#error "E4_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E5)
#error "E5_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E6)
#error "E6_DRIVER_TYPE is not recognized."
#endif
#if _BAD_DRIVER(E7)
#error "E7_DRIVER_TYPE is not recognized."
#endif
#undef _BAD_DRIVER
// Misc. Cleanup
#undef _TEST_PWM

View file

@ -112,11 +112,10 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ"
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY35_36
opt_enable Z_MULTI_ENDSTOPS
opt_set NUM_Z_STEPPER_DRIVERS 2
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
pins_set ramps/RAMPS X_MAX_PIN -1
opt_add Z2_MAX_PIN 2
opt_enable USE_XMAX_PLUG
exec_test $1 $2 "Dual Z with Dual Z endstops"
# Clean up

View file

@ -113,11 +113,10 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ"
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY41
opt_enable Z_MULTI_ENDSTOPS
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
opt_set NUM_Z_STEPPER_DRIVERS 2
pins_set ramps/RAMPS X_MAX_PIN -1
opt_add Z2_MAX_PIN 2
opt_enable USE_XMAX_PLUG
exec_test $1 $2 "Dual Z with Dual Z endstops"
# Clean up