Browse Source

🧑‍💻 Microsteps to stepper.cpp

FB4S_WIFI^2^2
Scott Lahteine 2 years ago
parent
commit
78577b13cb
  1. 67
      Marlin/src/inc/Conditionals_post.h
  2. 39
      Marlin/src/module/stepper.cpp
  3. 7
      Marlin/src/pins/sam/pins_ALLIGATOR_R2.h

67
Marlin/src/inc/Conditionals_post.h

@ -3124,73 +3124,6 @@
#define HAS_MICROSTEPS 1 #define HAS_MICROSTEPS 1
#endif #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 * Heater signal inversion defaults
*/ */

39
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) { void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) {
switch (stepping_mode) { switch (stepping_mode) {
#if HAS_MICROSTEP1 #ifdef MICROSTEP1
case 1: microstep_ms(driver, MICROSTEP1); break; case 1: microstep_ms(driver, MICROSTEP1); break;
#endif #endif
#if HAS_MICROSTEP2 #ifdef MICROSTEP2
case 2: microstep_ms(driver, MICROSTEP2); break; case 2: microstep_ms(driver, MICROSTEP2); break;
#endif #endif
#if HAS_MICROSTEP4 #ifdef MICROSTEP4
case 4: microstep_ms(driver, MICROSTEP4); break; case 4: microstep_ms(driver, MICROSTEP4); break;
#endif #endif
#if HAS_MICROSTEP8 #ifdef MICROSTEP8
case 8: microstep_ms(driver, MICROSTEP8); break; case 8: microstep_ms(driver, MICROSTEP8); break;
#endif #endif
#if HAS_MICROSTEP16 #ifdef MICROSTEP16
case 16: microstep_ms(driver, MICROSTEP16); break; case 16: microstep_ms(driver, MICROSTEP16); break;
#endif #endif
#if HAS_MICROSTEP32 #ifdef MICROSTEP32
case 32: microstep_ms(driver, MICROSTEP32); break; case 32: microstep_ms(driver, MICROSTEP32); break;
#endif #endif
#if HAS_MICROSTEP64 #ifdef MICROSTEP64
case 64: microstep_ms(driver, MICROSTEP64); break; case 64: microstep_ms(driver, MICROSTEP64); break;
#endif #endif
#if HAS_MICROSTEP128 #ifdef MICROSTEP128
case 128: microstep_ms(driver, MICROSTEP128); break; case 128: microstep_ms(driver, MICROSTEP128); break;
#endif #endif

7
Marlin/src/pins/sam/pins_ALLIGATOR_R2.h

@ -85,6 +85,13 @@
#define Z_MS1_PIN 44 // PC19 #define Z_MS1_PIN 44 // PC19
#define E0_MS1_PIN 45 // PC18 #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 //#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT
// //

Loading…
Cancel
Save