Consolidate smart stepper driver initialization
This commit is contained in:
parent
72776f647b
commit
a03502080e
@ -8278,19 +8278,14 @@ inline void gcode_M140() {
|
||||
OUT_WRITE(SUICIDE_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
delay(100);
|
||||
tmc2130_init(); // Settings only stick when the driver has power
|
||||
#if DISABLED(AUTO_POWER_CONTROL)
|
||||
delay(100); // Wait for power to settle
|
||||
restore_stepper_drivers();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
LCD_MESSAGEPGM(WELCOME_MSG);
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAVE_TMC2208)
|
||||
delay(100);
|
||||
tmc2208_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAS_POWER_SWITCH
|
||||
@ -13667,6 +13662,7 @@ void setup() {
|
||||
SERIAL_PROTOCOLLNPGM("start");
|
||||
SERIAL_ECHO_START();
|
||||
|
||||
// Prepare communication for TMC drivers
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
tmc_init_cs_pins();
|
||||
#endif
|
||||
@ -13722,8 +13718,9 @@ void setup() {
|
||||
|
||||
print_job_timer.init(); // Initial setup of print job timer
|
||||
|
||||
stepper.init(); // Initialize stepper, this enables interrupts!
|
||||
servo_init();
|
||||
stepper.init(); // Initialize stepper, this enables interrupts!
|
||||
|
||||
servo_init(); // Initialize all servos, stow servo probe
|
||||
|
||||
#if HAS_PHOTOGRAPH
|
||||
OUT_WRITE(PHOTOGRAPH_PIN, LOW);
|
||||
|
@ -87,6 +87,11 @@ void Power::check() {
|
||||
void Power::power_on() {
|
||||
lastPowerOn = millis();
|
||||
PSU_PIN_ON();
|
||||
|
||||
#if HAS_TRINAMIC
|
||||
delay(100); // Wait for power to settle
|
||||
restore_stepper_drivers();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Power::power_off() {
|
||||
|
@ -948,31 +948,6 @@ void Stepper::init() {
|
||||
microstep_init();
|
||||
#endif
|
||||
|
||||
// Init TMC Steppers
|
||||
#if ENABLED(HAVE_TMC26X)
|
||||
tmc_init();
|
||||
#endif
|
||||
|
||||
// Init TMC2130 Steppers
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
tmc2130_init();
|
||||
#endif
|
||||
|
||||
// Init TMC2208 Steppers
|
||||
#if ENABLED(HAVE_TMC2208)
|
||||
tmc2208_init();
|
||||
#endif
|
||||
|
||||
// TRAMS, TMC2130 and TMC2208 advanced settings
|
||||
#if HAS_TRINAMIC
|
||||
TMC_ADV()
|
||||
#endif
|
||||
|
||||
// Init L6470 Steppers
|
||||
#if ENABLED(HAVE_L6470DRIVER)
|
||||
L6470_init();
|
||||
#endif
|
||||
|
||||
// Init Dir Pins
|
||||
#if HAS_X_DIR
|
||||
X_DIR_INIT;
|
||||
|
@ -42,83 +42,82 @@
|
||||
#include <SPI.h>
|
||||
#include <TMC26XStepper.h>
|
||||
|
||||
#define _TMC_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_ENABLE_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
|
||||
#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_ENABLE_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
|
||||
|
||||
#if ENABLED(X_IS_TMC26X)
|
||||
_TMC_DEFINE(X);
|
||||
_TMC26X_DEFINE(X);
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC26X)
|
||||
_TMC_DEFINE(X2);
|
||||
_TMC26X_DEFINE(X2);
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC26X)
|
||||
_TMC_DEFINE(Y);
|
||||
_TMC26X_DEFINE(Y);
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC26X)
|
||||
_TMC_DEFINE(Y2);
|
||||
_TMC26X_DEFINE(Y2);
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC26X)
|
||||
_TMC_DEFINE(Z);
|
||||
_TMC26X_DEFINE(Z);
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC26X)
|
||||
_TMC_DEFINE(Z2);
|
||||
_TMC26X_DEFINE(Z2);
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC26X)
|
||||
_TMC_DEFINE(E0);
|
||||
_TMC26X_DEFINE(E0);
|
||||
#endif
|
||||
#if ENABLED(E1_IS_TMC26X)
|
||||
_TMC_DEFINE(E1);
|
||||
_TMC26X_DEFINE(E1);
|
||||
#endif
|
||||
#if ENABLED(E2_IS_TMC26X)
|
||||
_TMC_DEFINE(E2);
|
||||
_TMC26X_DEFINE(E2);
|
||||
#endif
|
||||
#if ENABLED(E3_IS_TMC26X)
|
||||
_TMC_DEFINE(E3);
|
||||
_TMC26X_DEFINE(E3);
|
||||
#endif
|
||||
#if ENABLED(E4_IS_TMC26X)
|
||||
_TMC_DEFINE(E4);
|
||||
_TMC26X_DEFINE(E4);
|
||||
#endif
|
||||
|
||||
#define _TMC_INIT(A) do{ \
|
||||
#define _TMC26X_INIT(A) do{ \
|
||||
stepper##A.setMicrosteps(A##_MICROSTEPS); \
|
||||
stepper##A.start(); \
|
||||
}while(0)
|
||||
|
||||
void tmc_init() {
|
||||
void tmc26x_init_to_defaults() {
|
||||
#if ENABLED(X_IS_TMC26X)
|
||||
_TMC_INIT(X);
|
||||
_TMC26X_INIT(X);
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC26X)
|
||||
_TMC_INIT(X2);
|
||||
_TMC26X_INIT(X2);
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC26X)
|
||||
_TMC_INIT(Y);
|
||||
_TMC26X_INIT(Y);
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC26X)
|
||||
_TMC_INIT(Y2);
|
||||
_TMC26X_INIT(Y2);
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC26X)
|
||||
_TMC_INIT(Z);
|
||||
_TMC26X_INIT(Z);
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC26X)
|
||||
_TMC_INIT(Z2);
|
||||
_TMC26X_INIT(Z2);
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC26X)
|
||||
_TMC_INIT(E0);
|
||||
_TMC26X_INIT(E0);
|
||||
#endif
|
||||
#if ENABLED(E1_IS_TMC26X)
|
||||
_TMC_INIT(E1);
|
||||
_TMC26X_INIT(E1);
|
||||
#endif
|
||||
#if ENABLED(E2_IS_TMC26X)
|
||||
_TMC_INIT(E2);
|
||||
_TMC26X_INIT(E2);
|
||||
#endif
|
||||
#if ENABLED(E3_IS_TMC26X)
|
||||
_TMC_INIT(E3);
|
||||
_TMC26X_INIT(E3);
|
||||
#endif
|
||||
#if ENABLED(E4_IS_TMC26X)
|
||||
_TMC_INIT(E4);
|
||||
_TMC26X_INIT(E4);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC26X
|
||||
|
||||
//
|
||||
@ -137,7 +136,6 @@
|
||||
#define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)
|
||||
#endif
|
||||
|
||||
|
||||
// Stepper objects of TMC2130 steppers used
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
_TMC2130_DEFINE(X);
|
||||
@ -176,9 +174,9 @@
|
||||
// Use internal reference voltage for current calculations. This is the default.
|
||||
// Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
|
||||
// https://www.trinamic.com/products/integrated-circuits/details/tmc2130/
|
||||
void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
|
||||
void tmc2130_init(TMC2130Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
|
||||
st.begin();
|
||||
st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
|
||||
st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
|
||||
st.microsteps(microsteps);
|
||||
st.blank_time(24);
|
||||
st.off_time(5); // Only enables the driver if used with stealthChop
|
||||
@ -205,9 +203,9 @@
|
||||
st.GSTAT(); // Clear GSTAT
|
||||
}
|
||||
|
||||
#define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
|
||||
#define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
|
||||
|
||||
void tmc2130_init() {
|
||||
void tmc2130_init_to_defaults() {
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
_TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]);
|
||||
#endif
|
||||
@ -242,7 +240,35 @@
|
||||
{ constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
#define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY);
|
||||
#ifdef X_HOMING_SENSITIVITY
|
||||
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
stepperX.sgt(X_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130)
|
||||
stepperX2.sgt(X_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef Y_HOMING_SENSITIVITY
|
||||
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
stepperY.sgt(Y_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC2130)
|
||||
stepperY2.sgt(Y_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef Z_HOMING_SENSITIVITY
|
||||
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
|
||||
stepperZ.sgt(Z_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#if ENABLED(Z2_IS_TMC2130)
|
||||
stepperZ2.sgt(Z_HOMING_SENSITIVITY);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2130
|
||||
|
||||
//
|
||||
@ -377,11 +403,11 @@
|
||||
|
||||
// Use internal reference voltage for current calculations. This is the default.
|
||||
// Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
|
||||
void tmc2208_init(TMC2208Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
|
||||
void tmc2208_init(TMC2208Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
|
||||
st.pdn_disable(true); // Use UART
|
||||
st.mstep_reg_select(true); // Select microsteps with UART
|
||||
st.I_scale_analog(false);
|
||||
st.rms_current(st.getCurrent(), HOLD_MULTIPLIER, R_SENSE);
|
||||
st.rms_current(mA, HOLD_MULTIPLIER, R_SENSE);
|
||||
st.microsteps(microsteps);
|
||||
st.blank_time(24);
|
||||
st.toff(5);
|
||||
@ -411,9 +437,9 @@
|
||||
delay(200);
|
||||
}
|
||||
|
||||
#define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
|
||||
#define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
|
||||
|
||||
void tmc2208_init() {
|
||||
void tmc2208_init_to_defaults() {
|
||||
#if ENABLED(X_IS_TMC2208)
|
||||
_TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]);
|
||||
#endif
|
||||
@ -448,8 +474,63 @@
|
||||
{ constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2208
|
||||
|
||||
void restore_stepper_drivers() {
|
||||
#if X_IS_TRINAMIC
|
||||
stepperX.push();
|
||||
#endif
|
||||
#if X2_IS_TRINAMIC
|
||||
stepperX2.push();
|
||||
#endif
|
||||
#if Y_IS_TRINAMIC
|
||||
stepperY.push();
|
||||
#endif
|
||||
#if Y2_IS_TRINAMIC
|
||||
stepperY2.push();
|
||||
#endif
|
||||
#if Z_IS_TRINAMIC
|
||||
stepperZ.push();
|
||||
#endif
|
||||
#if Z2_IS_TRINAMIC
|
||||
stepperZ2.push();
|
||||
#endif
|
||||
#if E0_IS_TRINAMIC
|
||||
stepperE0.push();
|
||||
#endif
|
||||
#if E1_IS_TRINAMIC
|
||||
stepperE1.push();
|
||||
#endif
|
||||
#if E2_IS_TRINAMIC
|
||||
stepperE2.push();
|
||||
#endif
|
||||
#if E3_IS_TRINAMIC
|
||||
stepperE3.push();
|
||||
#endif
|
||||
#if E4_IS_TRINAMIC
|
||||
stepperE4.push();
|
||||
#endif
|
||||
}
|
||||
|
||||
void reset_stepper_drivers() {
|
||||
#if ENABLED(HAVE_TMC26X)
|
||||
tmc26x_init_to_defaults();
|
||||
#endif
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
tmc2130_init_to_defaults();
|
||||
#endif
|
||||
#if ENABLED(HAVE_TMC2208)
|
||||
tmc2208_init_to_defaults();
|
||||
#endif
|
||||
#ifdef TMC_ADV
|
||||
TMC_ADV()
|
||||
#endif
|
||||
#if ENABLED(HAVE_L6470DRIVER)
|
||||
L6470_init_to_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// L6470 Driver objects and inits
|
||||
//
|
||||
@ -503,7 +584,7 @@
|
||||
stepper##A.setStallCurrent(A##_STALLCURRENT); \
|
||||
}while(0)
|
||||
|
||||
void L6470_init() {
|
||||
void L6470_init_to_defaults() {
|
||||
#if ENABLED(X_IS_L6470)
|
||||
_L6470_INIT(X);
|
||||
#endif
|
||||
|
@ -50,29 +50,32 @@
|
||||
#if ENABLED(HAVE_TMC26X)
|
||||
#include <SPI.h>
|
||||
#include <TMC26XStepper.h>
|
||||
void tmc_init();
|
||||
void tmc26x_init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
#include <TMC2130Stepper.h>
|
||||
void tmc2130_init();
|
||||
void tmc2130_init_to_defaults();
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAVE_TMC2208)
|
||||
#include <TMC2208Stepper.h>
|
||||
void tmc2208_serial_begin();
|
||||
void tmc2208_init();
|
||||
void tmc2208_init_to_defaults();
|
||||
#endif
|
||||
|
||||
// L6470 has STEP on normal pins, but DIR/ENABLE via SPI
|
||||
#if ENABLED(HAVE_L6470DRIVER)
|
||||
#include <SPI.h>
|
||||
#include <L6470.h>
|
||||
void L6470_init();
|
||||
void L6470_init_to_defaults();
|
||||
#endif
|
||||
|
||||
void restore_stepper_drivers(); // Called by PSU_ON
|
||||
void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
|
||||
// X Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(X_IS_L6470)
|
||||
#if ENABLED(X_IS_L6470)
|
||||
extern L6470 stepperX;
|
||||
#define X_ENABLE_INIT NOOP
|
||||
#define X_ENABLE_WRITE(STATE) do{ if (STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree(); }while(0)
|
||||
@ -81,15 +84,15 @@
|
||||
#define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
|
||||
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(X_IS_TMC26X)
|
||||
#if ENABLED(X_IS_TMC26X)
|
||||
extern TMC26XStepper stepperX;
|
||||
#define X_ENABLE_INIT NOOP
|
||||
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
|
||||
#define X_ENABLE_READ stepperX.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperX;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(X_IS_TMC2208)
|
||||
#elif ENABLED(X_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperX;
|
||||
#endif
|
||||
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
|
||||
@ -105,7 +108,7 @@
|
||||
#define X_STEP_READ READ(X_STEP_PIN)
|
||||
|
||||
// Y Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Y_IS_L6470)
|
||||
#if ENABLED(Y_IS_L6470)
|
||||
extern L6470 stepperY;
|
||||
#define Y_ENABLE_INIT NOOP
|
||||
#define Y_ENABLE_WRITE(STATE) do{ if (STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree(); }while(0)
|
||||
@ -114,15 +117,15 @@
|
||||
#define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
|
||||
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(Y_IS_TMC26X)
|
||||
#if ENABLED(Y_IS_TMC26X)
|
||||
extern TMC26XStepper stepperY;
|
||||
#define Y_ENABLE_INIT NOOP
|
||||
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
|
||||
#define Y_ENABLE_READ stepperY.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperY;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(Y_IS_TMC2208)
|
||||
#elif ENABLED(Y_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperY;
|
||||
#endif
|
||||
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
|
||||
@ -138,7 +141,7 @@
|
||||
#define Y_STEP_READ READ(Y_STEP_PIN)
|
||||
|
||||
// Z Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Z_IS_L6470)
|
||||
#if ENABLED(Z_IS_L6470)
|
||||
extern L6470 stepperZ;
|
||||
#define Z_ENABLE_INIT NOOP
|
||||
#define Z_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree(); }while(0)
|
||||
@ -147,15 +150,15 @@
|
||||
#define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
|
||||
#define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(Z_IS_TMC26X)
|
||||
#if ENABLED(Z_IS_TMC26X)
|
||||
extern TMC26XStepper stepperZ;
|
||||
#define Z_ENABLE_INIT NOOP
|
||||
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
|
||||
#define Z_ENABLE_READ stepperZ.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperZ;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(Z_IS_TMC2208)
|
||||
#elif ENABLED(Z_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperZ;
|
||||
#endif
|
||||
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
|
||||
@ -172,7 +175,7 @@
|
||||
|
||||
// X2 Stepper
|
||||
#if HAS_X2_ENABLE
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(X2_IS_L6470)
|
||||
#if ENABLED(X2_IS_L6470)
|
||||
extern L6470 stepperX2;
|
||||
#define X2_ENABLE_INIT NOOP
|
||||
#define X2_ENABLE_WRITE(STATE) do{ if (STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree(); }while(0)
|
||||
@ -181,15 +184,15 @@
|
||||
#define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
|
||||
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(X2_IS_TMC26X)
|
||||
#if ENABLED(X2_IS_TMC26X)
|
||||
extern TMC26XStepper stepperX2;
|
||||
#define X2_ENABLE_INIT NOOP
|
||||
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
|
||||
#define X2_ENABLE_READ stepperX2.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
|
||||
#if ENABLED(X2_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperX2;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(X2_IS_TMC2208)
|
||||
#elif ENABLED(X2_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperX2;
|
||||
#endif
|
||||
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
|
||||
@ -207,7 +210,7 @@
|
||||
|
||||
// Y2 Stepper
|
||||
#if HAS_Y2_ENABLE
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Y2_IS_L6470)
|
||||
#if ENABLED(Y2_IS_L6470)
|
||||
extern L6470 stepperY2;
|
||||
#define Y2_ENABLE_INIT NOOP
|
||||
#define Y2_ENABLE_WRITE(STATE) do{ if (STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree(); }while(0)
|
||||
@ -216,15 +219,15 @@
|
||||
#define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
|
||||
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(Y2_IS_TMC26X)
|
||||
#if ENABLED(Y2_IS_TMC26X)
|
||||
extern TMC26XStepper stepperY2;
|
||||
#define Y2_ENABLE_INIT NOOP
|
||||
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
|
||||
#define Y2_ENABLE_READ stepperY2.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
|
||||
#if ENABLED(Y2_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperY2;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(Y2_IS_TMC2208)
|
||||
#elif ENABLED(Y2_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperY2;
|
||||
#endif
|
||||
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
|
||||
@ -242,7 +245,7 @@
|
||||
|
||||
// Z2 Stepper
|
||||
#if HAS_Z2_ENABLE
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Z2_IS_L6470)
|
||||
#if ENABLED(Z2_IS_L6470)
|
||||
extern L6470 stepperZ2;
|
||||
#define Z2_ENABLE_INIT NOOP
|
||||
#define Z2_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree(); }while(0)
|
||||
@ -251,15 +254,15 @@
|
||||
#define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
|
||||
#define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(Z2_IS_TMC26X)
|
||||
#if ENABLED(Z2_IS_TMC26X)
|
||||
extern TMC26XStepper stepperZ2;
|
||||
#define Z2_ENABLE_INIT NOOP
|
||||
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
|
||||
#define Z2_ENABLE_READ stepperZ2.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
|
||||
#if ENABLED(Z2_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperZ2;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(Z2_IS_TMC2208)
|
||||
#elif ENABLED(Z2_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperZ2;
|
||||
#endif
|
||||
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
|
||||
@ -276,7 +279,7 @@
|
||||
#endif
|
||||
|
||||
// E0 Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E0_IS_L6470)
|
||||
#if ENABLED(E0_IS_L6470)
|
||||
extern L6470 stepperE0;
|
||||
#define E0_ENABLE_INIT NOOP
|
||||
#define E0_ENABLE_WRITE(STATE) do{ if (STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree(); }while(0)
|
||||
@ -285,15 +288,15 @@
|
||||
#define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
|
||||
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(E0_IS_TMC26X)
|
||||
#if ENABLED(E0_IS_TMC26X)
|
||||
extern TMC26XStepper stepperE0;
|
||||
#define E0_ENABLE_INIT NOOP
|
||||
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
|
||||
#define E0_ENABLE_READ stepperE0.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperE0;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(E0_IS_TMC2208)
|
||||
#elif ENABLED(E0_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperE0;
|
||||
#endif
|
||||
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
|
||||
@ -309,7 +312,7 @@
|
||||
#define E0_STEP_READ READ(E0_STEP_PIN)
|
||||
|
||||
// E1 Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E1_IS_L6470)
|
||||
#if ENABLED(E1_IS_L6470)
|
||||
extern L6470 stepperE1;
|
||||
#define E1_ENABLE_INIT NOOP
|
||||
#define E1_ENABLE_WRITE(STATE) do{ if (STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree(); }while(0)
|
||||
@ -318,15 +321,15 @@
|
||||
#define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
|
||||
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(E1_IS_TMC26X)
|
||||
#if ENABLED(E1_IS_TMC26X)
|
||||
extern TMC26XStepper stepperE1;
|
||||
#define E1_ENABLE_INIT NOOP
|
||||
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
|
||||
#define E1_ENABLE_READ stepperE1.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
|
||||
#if ENABLED(E1_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperE1;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(E1_IS_TMC2208)
|
||||
#elif ENABLED(E1_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperE1;
|
||||
#endif
|
||||
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
|
||||
@ -342,7 +345,7 @@
|
||||
#define E1_STEP_READ READ(E1_STEP_PIN)
|
||||
|
||||
// E2 Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E2_IS_L6470)
|
||||
#if ENABLED(E2_IS_L6470)
|
||||
extern L6470 stepperE2;
|
||||
#define E2_ENABLE_INIT NOOP
|
||||
#define E2_ENABLE_WRITE(STATE) do{ if (STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree(); }while(0)
|
||||
@ -351,15 +354,15 @@
|
||||
#define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
|
||||
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(E2_IS_TMC26X)
|
||||
#if ENABLED(E2_IS_TMC26X)
|
||||
extern TMC26XStepper stepperE2;
|
||||
#define E2_ENABLE_INIT NOOP
|
||||
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
|
||||
#define E2_ENABLE_READ stepperE2.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
|
||||
#if ENABLED(E2_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperE2;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(E2_IS_TMC2208)
|
||||
#elif ENABLED(E2_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperE2;
|
||||
#endif
|
||||
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
|
||||
@ -375,7 +378,7 @@
|
||||
#define E2_STEP_READ READ(E2_STEP_PIN)
|
||||
|
||||
// E3 Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E3_IS_L6470)
|
||||
#if ENABLED(E3_IS_L6470)
|
||||
extern L6470 stepperE3;
|
||||
#define E3_ENABLE_INIT NOOP
|
||||
#define E3_ENABLE_WRITE(STATE) do{ if (STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree(); }while(0)
|
||||
@ -384,15 +387,15 @@
|
||||
#define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
|
||||
#define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(E3_IS_TMC26X)
|
||||
#if ENABLED(E3_IS_TMC26X)
|
||||
extern TMC26XStepper stepperE3;
|
||||
#define E3_ENABLE_INIT NOOP
|
||||
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
|
||||
#define E3_ENABLE_READ stepperE3.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
|
||||
#if ENABLED(E3_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperE3;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(E3_IS_TMC2208)
|
||||
#elif ENABLED(E3_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperE3;
|
||||
#endif
|
||||
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
|
||||
@ -408,7 +411,7 @@
|
||||
#define E3_STEP_READ READ(E3_STEP_PIN)
|
||||
|
||||
// E4 Stepper
|
||||
#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E4_IS_L6470)
|
||||
#if ENABLED(E4_IS_L6470)
|
||||
extern L6470 stepperE4;
|
||||
#define E4_ENABLE_INIT NOOP
|
||||
#define E4_ENABLE_WRITE(STATE) do{ if (STATE) stepperE4.Step_Clock(stepperE4.getStatus() & STATUS_HIZ); else stepperE4.softFree(); }while(0)
|
||||
@ -417,15 +420,15 @@
|
||||
#define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE)
|
||||
#define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR)
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC26X) && ENABLED(E4_IS_TMC26X)
|
||||
#if ENABLED(E4_IS_TMC26X)
|
||||
extern TMC26XStepper stepperE4;
|
||||
#define E4_ENABLE_INIT NOOP
|
||||
#define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
|
||||
#define E4_ENABLE_READ stepperE4.isEnabled()
|
||||
#else
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(E4_IS_TMC2130)
|
||||
#if ENABLED(E4_IS_TMC2130)
|
||||
extern TMC2130Stepper stepperE4;
|
||||
#elif ENABLED(HAVE_TMC2208) && ENABLED(E4_IS_TMC2208)
|
||||
#elif ENABLED(E4_IS_TMC2208)
|
||||
extern TMC2208Stepper stepperE4;
|
||||
#endif
|
||||
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
|
||||
|
Loading…
Reference in New Issue
Block a user