🧑‍💻 Microsteps to stepper.cpp

This commit is contained in:
Scott Lahteine 2022-09-06 23:03:15 -05:00
parent b29cd4c510
commit 78577b13cb
3 changed files with 38 additions and 75 deletions

View File

@ -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
*/

View File

@ -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

View File

@ -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
//