Browse Source

Ensure A4988 for unspecified driver type (#19798)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
ellensp 4 years ago
parent
commit
ea80b2c8fc
No account linked to committer's email address

+ 4
- 4
Marlin/Configuration.h View File

@@ -678,15 +678,15 @@
678 678
  *          TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
679 679
  * :['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']
680 680
  */
681
-//#define X_DRIVER_TYPE  A4988
682
-//#define Y_DRIVER_TYPE  A4988
683
-//#define Z_DRIVER_TYPE  A4988
681
+#define X_DRIVER_TYPE  A4988
682
+#define Y_DRIVER_TYPE  A4988
683
+#define Z_DRIVER_TYPE  A4988
684 684
 //#define X2_DRIVER_TYPE A4988
685 685
 //#define Y2_DRIVER_TYPE A4988
686 686
 //#define Z2_DRIVER_TYPE A4988
687 687
 //#define Z3_DRIVER_TYPE A4988
688 688
 //#define Z4_DRIVER_TYPE A4988
689
-//#define E0_DRIVER_TYPE A4988
689
+#define E0_DRIVER_TYPE A4988
690 690
 //#define E1_DRIVER_TYPE A4988
691 691
 //#define E2_DRIVER_TYPE A4988
692 692
 //#define E3_DRIVER_TYPE A4988

+ 96
- 17
Marlin/src/inc/Conditionals_LCD.h View File

@@ -755,19 +755,7 @@
755 755
   #define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y)
756 756
 #endif
757 757
 
758
-#ifndef INVERT_X_DIR
759
-  #define INVERT_X_DIR false
760
-#endif
761
-#ifndef INVERT_Y_DIR
762
-  #define INVERT_Y_DIR false
763
-#endif
764
-#ifndef INVERT_Z_DIR
765
-  #define INVERT_Z_DIR false
766
-#endif
767
-#ifndef INVERT_E_DIR
768
-  #define INVERT_E_DIR false
769
-#endif
770
-
758
+// Slim menu optimizations
771 759
 #if ENABLED(SLIM_LCD_MENUS)
772 760
   #define BOOT_MARLIN_LOGO_SMALL
773 761
 #endif
@@ -786,14 +774,105 @@
786 774
   #define HAS_CLASSIC_E_JERK 1
787 775
 #endif
788 776
 
789
-#ifndef SPI_SPEED
790
-  #define SPI_SPEED SPI_FULL_SPEED
791
-#endif
792
-
793 777
 #if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1
794 778
   #define HAS_USB_SERIAL 1
795 779
 #endif
796 780
 
781
+// Fallback Stepper Driver types
782
+#ifndef X_DRIVER_TYPE
783
+  #define X_DRIVER_TYPE A4988
784
+#endif
785
+#ifndef Y_DRIVER_TYPE
786
+  #define Y_DRIVER_TYPE A4988
787
+#endif
788
+#ifndef Z_DRIVER_TYPE
789
+  #define Z_DRIVER_TYPE A4988
790
+#endif
791
+#if NONE(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
792
+  #undef X2_DRIVER_TYPE
793
+#elif !defined(X2_DRIVER_TYPE)
794
+  #define X2_DRIVER_TYPE A4988
795
+#endif
796
+#if DISABLED(Y_DUAL_STEPPER_DRIVERS)
797
+  #undef Y2_DRIVER_TYPE
798
+#elif !defined(Y2_DRIVER_TYPE)
799
+  #define Y2_DRIVER_TYPE A4988
800
+#endif
801
+#if NUM_Z_STEPPER_DRIVERS < 2
802
+  #undef Z2_DRIVER_TYPE
803
+#elif !defined(Z2_DRIVER_TYPE)
804
+  #define Z2_DRIVER_TYPE A4988
805
+#endif
806
+#if NUM_Z_STEPPER_DRIVERS < 3
807
+  #undef Z3_DRIVER_TYPE
808
+#elif !defined(Z3_DRIVER_TYPE)
809
+  #define Z3_DRIVER_TYPE A4988
810
+#endif
811
+#if NUM_Z_STEPPER_DRIVERS < 4
812
+  #undef Z4_DRIVER_TYPE
813
+#elif !defined(Z4_DRIVER_TYPE)
814
+  #define Z4_DRIVER_TYPE A4988
815
+#endif
816
+#if E_STEPPERS < 1
817
+  #undef E0_DRIVER_TYPE
818
+#elif !defined(E0_DRIVER_TYPE)
819
+  #define E0_DRIVER_TYPE A4988
820
+#endif
821
+#if E_STEPPERS < 2
822
+  #undef E1_DRIVER_TYPE
823
+#elif !defined(E1_DRIVER_TYPE)
824
+  #define E1_DRIVER_TYPE A4988
825
+#endif
826
+#if E_STEPPERS < 3
827
+  #undef E2_DRIVER_TYPE
828
+#elif !defined(E2_DRIVER_TYPE)
829
+  #define E2_DRIVER_TYPE A4988
830
+#endif
831
+#if E_STEPPERS < 4
832
+  #undef E3_DRIVER_TYPE
833
+#elif !defined(E3_DRIVER_TYPE)
834
+  #define E3_DRIVER_TYPE A4988
835
+#endif
836
+#if E_STEPPERS < 5
837
+  #undef E4_DRIVER_TYPE
838
+#elif !defined(E4_DRIVER_TYPE)
839
+  #define E4_DRIVER_TYPE A4988
840
+#endif
841
+#if E_STEPPERS < 6
842
+  #undef E5_DRIVER_TYPE
843
+#elif !defined(E5_DRIVER_TYPE)
844
+  #define E5_DRIVER_TYPE A4988
845
+#endif
846
+#if E_STEPPERS < 7
847
+  #undef E6_DRIVER_TYPE
848
+#elif !defined(E6_DRIVER_TYPE)
849
+  #define E6_DRIVER_TYPE A4988
850
+#endif
851
+#if E_STEPPERS < 8
852
+  #undef E7_DRIVER_TYPE
853
+#elif !defined(E7_DRIVER_TYPE)
854
+  #define E7_DRIVER_TYPE A4988
855
+#endif
856
+
857
+// Fallback axis inverting
858
+#ifndef INVERT_X_DIR
859
+  #define INVERT_X_DIR false
860
+#endif
861
+#ifndef INVERT_Y_DIR
862
+  #define INVERT_Y_DIR false
863
+#endif
864
+#ifndef INVERT_Z_DIR
865
+  #define INVERT_Z_DIR false
866
+#endif
867
+#ifndef INVERT_E_DIR
868
+  #define INVERT_E_DIR false
869
+#endif
870
+
871
+// Fallback SPI Speed
872
+#ifndef SPI_SPEED
873
+  #define SPI_SPEED SPI_FULL_SPEED
874
+#endif
875
+
797 876
 /**
798 877
  * This setting is also used by M109 when trying to calculate
799 878
  * a ballpark safe margin to prevent wait-forever situation.

+ 54
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -3179,5 +3179,59 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
3179 3179
   #endif
3180 3180
 #endif
3181 3181
 
3182
+/**
3183
+ * Sanity check for valid stepper driver types
3184
+ */
3185
+#define _BAD_DRIVER(A) (defined(A##_DRIVER_TYPE) && !_DRIVER_ID(A##_DRIVER_TYPE))
3186
+#if _BAD_DRIVER(X)
3187
+  #error "X_DRIVER_TYPE is not recognized."
3188
+#endif
3189
+#if _BAD_DRIVER(Y)
3190
+  #error "Y_DRIVER_TYPE is not recognized."
3191
+#endif
3192
+#if _BAD_DRIVER(Z)
3193
+  #error "Z_DRIVER_TYPE is not recognized."
3194
+#endif
3195
+#if _BAD_DRIVER(X2)
3196
+  #error "X2_DRIVER_TYPE is not recognized."
3197
+#endif
3198
+#if _BAD_DRIVER(Y2)
3199
+  #error "Y2_DRIVER_TYPE is not recognized."
3200
+#endif
3201
+#if _BAD_DRIVER(Z2)
3202
+  #error "Z2_DRIVER_TYPE is not recognized."
3203
+#endif
3204
+#if _BAD_DRIVER(Z3)
3205
+  #error "Z3_DRIVER_TYPE is not recognized."
3206
+#endif
3207
+#if _BAD_DRIVER(Z4)
3208
+  #error "Z4_DRIVER_TYPE is not recognized."
3209
+#endif
3210
+#if _BAD_DRIVER(E0)
3211
+  #error "E0_DRIVER_TYPE is not recognized."
3212
+#endif
3213
+#if _BAD_DRIVER(E1)
3214
+  #error "E1_DRIVER_TYPE is not recognized."
3215
+#endif
3216
+#if _BAD_DRIVER(E2)
3217
+  #error "E2_DRIVER_TYPE is not recognized."
3218
+#endif
3219
+#if _BAD_DRIVER(E3)
3220
+  #error "E3_DRIVER_TYPE is not recognized."
3221
+#endif
3222
+#if _BAD_DRIVER(E4)
3223
+  #error "E4_DRIVER_TYPE is not recognized."
3224
+#endif
3225
+#if _BAD_DRIVER(E5)
3226
+  #error "E5_DRIVER_TYPE is not recognized."
3227
+#endif
3228
+#if _BAD_DRIVER(E6)
3229
+  #error "E6_DRIVER_TYPE is not recognized."
3230
+#endif
3231
+#if _BAD_DRIVER(E7)
3232
+  #error "E7_DRIVER_TYPE is not recognized."
3233
+#endif
3234
+#undef _BAD_DRIVER
3235
+
3182 3236
 // Misc. Cleanup
3183 3237
 #undef _TEST_PWM

+ 1
- 2
buildroot/tests/teensy35-tests View File

@@ -112,11 +112,10 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ"
112 112
 #
113 113
 restore_configs
114 114
 opt_set MOTHERBOARD BOARD_TEENSY35_36
115
-opt_enable Z_MULTI_ENDSTOPS
116 115
 opt_set NUM_Z_STEPPER_DRIVERS 2
116
+opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
117 117
 pins_set ramps/RAMPS X_MAX_PIN -1
118 118
 opt_add Z2_MAX_PIN 2
119
-opt_enable USE_XMAX_PLUG
120 119
 exec_test $1 $2 "Dual Z with Dual Z endstops"
121 120
 
122 121
 # Clean up

+ 1
- 2
buildroot/tests/teensy41-tests View File

@@ -113,11 +113,10 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ"
113 113
 #
114 114
 restore_configs
115 115
 opt_set MOTHERBOARD BOARD_TEENSY41
116
-opt_enable Z_MULTI_ENDSTOPS
116
+opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
117 117
 opt_set NUM_Z_STEPPER_DRIVERS 2
118 118
 pins_set ramps/RAMPS X_MAX_PIN -1
119 119
 opt_add Z2_MAX_PIN 2
120
-opt_enable USE_XMAX_PLUG
121 120
 exec_test $1 $2 "Dual Z with Dual Z endstops"
122 121
 
123 122
 # Clean up

Loading…
Cancel
Save