From 78577b13cbe5d5aaca5a3eb58b7aeb472077f00d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 6 Sep 2022 23:03:15 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Microsteps?= =?UTF-8?q?=20to=20stepper.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 67 ------------------------- Marlin/src/module/stepper.cpp | 39 +++++++++++--- Marlin/src/pins/sam/pins_ALLIGATOR_R2.h | 7 +++ 3 files changed, 38 insertions(+), 75 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 010cb79330..c208466dd0 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3124,73 +3124,6 @@ #define HAS_MICROSTEPS 1 #endif -#if HAS_MICROSTEPS - - // MS1 MS2 MS3 Stepper Driver Microstepping mode table - #ifndef MICROSTEP1 - #define MICROSTEP1 LOW,LOW,LOW - #endif - #if ENABLED(HEROIC_STEPPER_DRIVERS) - #ifndef MICROSTEP128 - #define MICROSTEP128 LOW,HIGH,LOW - #endif - #else - #ifndef MICROSTEP2 - #define MICROSTEP2 HIGH,LOW,LOW - #endif - #ifndef MICROSTEP4 - #define MICROSTEP4 LOW,HIGH,LOW - #endif - #endif - #ifndef MICROSTEP8 - #define MICROSTEP8 HIGH,HIGH,LOW - #endif - #ifdef __SAM3X8E__ - #if MB(ALLIGATOR) - #ifndef MICROSTEP16 - #define MICROSTEP16 LOW,LOW,LOW - #endif - #ifndef MICROSTEP32 - #define MICROSTEP32 HIGH,HIGH,LOW - #endif - #else - #ifndef MICROSTEP16 - #define MICROSTEP16 HIGH,HIGH,LOW - #endif - #endif - #else - #ifndef MICROSTEP16 - #define MICROSTEP16 HIGH,HIGH,LOW - #endif - #endif - - #ifdef MICROSTEP1 - #define HAS_MICROSTEP1 1 - #endif - #ifdef MICROSTEP2 - #define HAS_MICROSTEP2 1 - #endif - #ifdef MICROSTEP4 - #define HAS_MICROSTEP4 1 - #endif - #ifdef MICROSTEP8 - #define HAS_MICROSTEP8 1 - #endif - #ifdef MICROSTEP16 - #define HAS_MICROSTEP16 1 - #endif - #ifdef MICROSTEP32 - #define HAS_MICROSTEP32 1 - #endif - #ifdef MICROSTEP64 - #define HAS_MICROSTEP64 1 - #endif - #ifdef MICROSTEP128 - #define HAS_MICROSTEP128 1 - #endif - -#endif // HAS_MICROSTEPS - /** * Heater signal inversion defaults */ diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index beea674ced..78c09fadef 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3865,30 +3865,53 @@ void Stepper::report_positions() { } } + // MS1 MS2 MS3 Stepper Driver Microstepping mode table + #ifndef MICROSTEP1 + #define MICROSTEP1 LOW,LOW,LOW + #endif + #if ENABLED(HEROIC_STEPPER_DRIVERS) + #ifndef MICROSTEP128 + #define MICROSTEP128 LOW,HIGH,LOW + #endif + #else + #ifndef MICROSTEP2 + #define MICROSTEP2 HIGH,LOW,LOW + #endif + #ifndef MICROSTEP4 + #define MICROSTEP4 LOW,HIGH,LOW + #endif + #endif + #ifndef MICROSTEP8 + #define MICROSTEP8 HIGH,HIGH,LOW + #endif + #ifndef MICROSTEP16 + #define MICROSTEP16 HIGH,HIGH,LOW + #endif + void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) { switch (stepping_mode) { - #if HAS_MICROSTEP1 + #ifdef MICROSTEP1 case 1: microstep_ms(driver, MICROSTEP1); break; #endif - #if HAS_MICROSTEP2 + #ifdef MICROSTEP2 case 2: microstep_ms(driver, MICROSTEP2); break; #endif - #if HAS_MICROSTEP4 + #ifdef MICROSTEP4 case 4: microstep_ms(driver, MICROSTEP4); break; #endif - #if HAS_MICROSTEP8 + #ifdef MICROSTEP8 case 8: microstep_ms(driver, MICROSTEP8); break; #endif - #if HAS_MICROSTEP16 + #ifdef MICROSTEP16 case 16: microstep_ms(driver, MICROSTEP16); break; #endif - #if HAS_MICROSTEP32 + #ifdef MICROSTEP32 case 32: microstep_ms(driver, MICROSTEP32); break; #endif - #if HAS_MICROSTEP64 + #ifdef MICROSTEP64 case 64: microstep_ms(driver, MICROSTEP64); break; #endif - #if HAS_MICROSTEP128 + #ifdef MICROSTEP128 case 128: microstep_ms(driver, MICROSTEP128); break; #endif diff --git a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h index 70c3853dc9..76431937a7 100644 --- a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h @@ -85,6 +85,13 @@ #define Z_MS1_PIN 44 // PC19 #define E0_MS1_PIN 45 // PC18 +#ifndef MICROSTEP16 + #define MICROSTEP16 LOW,LOW,LOW +#endif +#ifndef MICROSTEP32 + #define MICROSTEP32 HIGH,HIGH,LOW +#endif + //#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT //