Browse Source

🧑‍💻 Microsteps to stepper.cpp

Scott Lahteine 2 years ago
parent
commit
4f9ba7e991

+ 0
- 67
Marlin/src/inc/Conditionals_post.h View File

@@ -3124,73 +3124,6 @@
3124 3124
   #define HAS_MICROSTEPS 1
3125 3125
 #endif
3126 3126
 
3127
-#if HAS_MICROSTEPS
3128
-
3129
-  // MS1 MS2 MS3 Stepper Driver Microstepping mode table
3130
-  #ifndef MICROSTEP1
3131
-    #define MICROSTEP1 LOW,LOW,LOW
3132
-  #endif
3133
-  #if ENABLED(HEROIC_STEPPER_DRIVERS)
3134
-    #ifndef MICROSTEP128
3135
-      #define MICROSTEP128 LOW,HIGH,LOW
3136
-    #endif
3137
-  #else
3138
-    #ifndef MICROSTEP2
3139
-      #define MICROSTEP2 HIGH,LOW,LOW
3140
-    #endif
3141
-    #ifndef MICROSTEP4
3142
-      #define MICROSTEP4 LOW,HIGH,LOW
3143
-    #endif
3144
-  #endif
3145
-  #ifndef MICROSTEP8
3146
-    #define MICROSTEP8 HIGH,HIGH,LOW
3147
-  #endif
3148
-  #ifdef __SAM3X8E__
3149
-    #if MB(ALLIGATOR)
3150
-      #ifndef MICROSTEP16
3151
-        #define MICROSTEP16 LOW,LOW,LOW
3152
-      #endif
3153
-      #ifndef MICROSTEP32
3154
-        #define MICROSTEP32 HIGH,HIGH,LOW
3155
-      #endif
3156
-    #else
3157
-      #ifndef MICROSTEP16
3158
-        #define MICROSTEP16 HIGH,HIGH,LOW
3159
-      #endif
3160
-    #endif
3161
-  #else
3162
-    #ifndef MICROSTEP16
3163
-      #define MICROSTEP16 HIGH,HIGH,LOW
3164
-    #endif
3165
-  #endif
3166
-
3167
-  #ifdef MICROSTEP1
3168
-    #define HAS_MICROSTEP1 1
3169
-  #endif
3170
-  #ifdef MICROSTEP2
3171
-    #define HAS_MICROSTEP2 1
3172
-  #endif
3173
-  #ifdef MICROSTEP4
3174
-    #define HAS_MICROSTEP4 1
3175
-  #endif
3176
-  #ifdef MICROSTEP8
3177
-    #define HAS_MICROSTEP8 1
3178
-  #endif
3179
-  #ifdef MICROSTEP16
3180
-    #define HAS_MICROSTEP16 1
3181
-  #endif
3182
-  #ifdef MICROSTEP32
3183
-    #define HAS_MICROSTEP32 1
3184
-  #endif
3185
-  #ifdef MICROSTEP64
3186
-    #define HAS_MICROSTEP64 1
3187
-  #endif
3188
-  #ifdef MICROSTEP128
3189
-    #define HAS_MICROSTEP128 1
3190
-  #endif
3191
-
3192
-#endif // HAS_MICROSTEPS
3193
-
3194 3127
 /**
3195 3128
  * Heater signal inversion defaults
3196 3129
  */

+ 31
- 8
Marlin/src/module/stepper.cpp View File

@@ -3859,30 +3859,53 @@ void Stepper::report_positions() {
3859 3859
     }
3860 3860
   }
3861 3861
 
3862
+  // MS1 MS2 MS3 Stepper Driver Microstepping mode table
3863
+  #ifndef MICROSTEP1
3864
+    #define MICROSTEP1 LOW,LOW,LOW
3865
+  #endif
3866
+  #if ENABLED(HEROIC_STEPPER_DRIVERS)
3867
+    #ifndef MICROSTEP128
3868
+      #define MICROSTEP128 LOW,HIGH,LOW
3869
+    #endif
3870
+  #else
3871
+    #ifndef MICROSTEP2
3872
+      #define MICROSTEP2 HIGH,LOW,LOW
3873
+    #endif
3874
+    #ifndef MICROSTEP4
3875
+      #define MICROSTEP4 LOW,HIGH,LOW
3876
+    #endif
3877
+  #endif
3878
+  #ifndef MICROSTEP8
3879
+    #define MICROSTEP8 HIGH,HIGH,LOW
3880
+  #endif
3881
+  #ifndef MICROSTEP16
3882
+    #define MICROSTEP16 HIGH,HIGH,LOW
3883
+  #endif
3884
+
3862 3885
   void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) {
3863 3886
     switch (stepping_mode) {
3864
-      #if HAS_MICROSTEP1
3887
+      #ifdef MICROSTEP1
3865 3888
         case 1: microstep_ms(driver, MICROSTEP1); break;
3866 3889
       #endif
3867
-      #if HAS_MICROSTEP2
3890
+      #ifdef MICROSTEP2
3868 3891
         case 2: microstep_ms(driver, MICROSTEP2); break;
3869 3892
       #endif
3870
-      #if HAS_MICROSTEP4
3893
+      #ifdef MICROSTEP4
3871 3894
         case 4: microstep_ms(driver, MICROSTEP4); break;
3872 3895
       #endif
3873
-      #if HAS_MICROSTEP8
3896
+      #ifdef MICROSTEP8
3874 3897
         case 8: microstep_ms(driver, MICROSTEP8); break;
3875 3898
       #endif
3876
-      #if HAS_MICROSTEP16
3899
+      #ifdef MICROSTEP16
3877 3900
         case 16: microstep_ms(driver, MICROSTEP16); break;
3878 3901
       #endif
3879
-      #if HAS_MICROSTEP32
3902
+      #ifdef MICROSTEP32
3880 3903
         case 32: microstep_ms(driver, MICROSTEP32); break;
3881 3904
       #endif
3882
-      #if HAS_MICROSTEP64
3905
+      #ifdef MICROSTEP64
3883 3906
         case 64: microstep_ms(driver, MICROSTEP64); break;
3884 3907
       #endif
3885
-      #if HAS_MICROSTEP128
3908
+      #ifdef MICROSTEP128
3886 3909
         case 128: microstep_ms(driver, MICROSTEP128); break;
3887 3910
       #endif
3888 3911
 

+ 7
- 0
Marlin/src/pins/sam/pins_ALLIGATOR_R2.h View File

@@ -85,6 +85,13 @@
85 85
 #define Z_MS1_PIN                             44  // PC19
86 86
 #define E0_MS1_PIN                            45  // PC18
87 87
 
88
+#ifndef MICROSTEP16
89
+  #define MICROSTEP16 LOW,LOW,LOW
90
+#endif
91
+#ifndef MICROSTEP32
92
+  #define MICROSTEP32 HIGH,HIGH,LOW
93
+#endif
94
+
88 95
 //#define MOTOR_FAULT_PIN                     22  // PB26 , motor X-Y-Z-E0 motor FAULT
89 96
 
90 97
 //

Loading…
Cancel
Save