From 707349d492c2544d32af7287aca4ddbaf1473542 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 19 Jan 2020 19:52:01 -0600 Subject: [PATCH] Updates for L64XX --- Marlin/src/gcode/calibrate/G28.cpp | 4 +- Marlin/src/gcode/feature/L6470/M906.cpp | 30 ++--- Marlin/src/inc/Conditionals_post.h | 6 +- Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 42 +++---- Marlin/src/libs/L64XX/L64XX_Marlin.h | 10 +- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/stepper/L64xx.h | 156 ++++++++++++------------ Marlin/src/module/stepper/TMC26X.h | 28 ++--- Marlin/src/module/stepper/indirection.h | 54 ++++---- Marlin/src/module/stepper/trinamic.h | 26 ++-- 10 files changed, 180 insertions(+), 178 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 17d192045..6d87e6f93 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -530,14 +530,14 @@ void GcodeSuite::G28(const bool always_home_all) { // Set L6470 absolute position registers to counts // constexpr *might* move this to PROGMEM. // If not, this will need a PROGMEM directive and an accessor. - static constexpr AxisEnum L6470_axis_xref[MAX_L6470] = { + static constexpr AxisEnum L64XX_axis_xref[MAX_L64XX] = { X_AXIS, Y_AXIS, Z_AXIS, X_AXIS, Y_AXIS, Z_AXIS, Z_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS }; for (uint8_t j = 1; j <= L64XX::chain[0]; j++) { const uint8_t cv = L64XX::chain[j]; - L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L6470_axis_xref[cv])); + L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L64XX_axis_xref[cv])); } #endif } diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index 5b4157b0b..0f55fe122 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -77,7 +77,7 @@ * KVAL_DEC * Vs compensation (if enabled) */ -void L6470_report_current(L64XX &motor, const L64XX_axis_t axis) { +void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) { if (L64xxManager.spi_abort) return; // don't do anything if set_directions() has occurred @@ -303,48 +303,48 @@ void GcodeSuite::M906() { } if (report_current) { - #define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q) + #define L64XX_REPORT_CURRENT(Q) L64XX_report_current(stepper##Q, Q) L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway #if AXIS_IS_L64XX(X) - L6470_REPORT_CURRENT(X); + L64XX_REPORT_CURRENT(X); #endif #if AXIS_IS_L64XX(X2) - L6470_REPORT_CURRENT(X2); + L64XX_REPORT_CURRENT(X2); #endif #if AXIS_IS_L64XX(Y) - L6470_REPORT_CURRENT(Y); + L64XX_REPORT_CURRENT(Y); #endif #if AXIS_IS_L64XX(Y2) - L6470_REPORT_CURRENT(Y2); + L64XX_REPORT_CURRENT(Y2); #endif #if AXIS_IS_L64XX(Z) - L6470_REPORT_CURRENT(Z); + L64XX_REPORT_CURRENT(Z); #endif #if AXIS_IS_L64XX(Z2) - L6470_REPORT_CURRENT(Z2); + L64XX_REPORT_CURRENT(Z2); #endif #if AXIS_IS_L64XX(Z3) - L6470_REPORT_CURRENT(Z3); + L64XX_REPORT_CURRENT(Z3); #endif #if AXIS_IS_L64XX(E0) - L6470_REPORT_CURRENT(E0); + L64XX_REPORT_CURRENT(E0); #endif #if AXIS_IS_L64XX(E1) - L6470_REPORT_CURRENT(E1); + L64XX_REPORT_CURRENT(E1); #endif #if AXIS_IS_L64XX(E2) - L6470_REPORT_CURRENT(E2); + L64XX_REPORT_CURRENT(E2); #endif #if AXIS_IS_L64XX(E3) - L6470_REPORT_CURRENT(E3); + L64XX_REPORT_CURRENT(E3); #endif #if AXIS_IS_L64XX(E4) - L6470_REPORT_CURRENT(E4); + L64XX_REPORT_CURRENT(E4); #endif #if AXIS_IS_L64XX(E5) - L6470_REPORT_CURRENT(E5); + L64XX_REPORT_CURRENT(E5); #endif L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 47de43cc4..acadd234e 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1030,7 +1030,9 @@ #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)) #define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION)) +// // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) +// #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675)) #define HAS_TEMP_ADC_0 HAS_ADC_TEST(0) #define HAS_TEMP_ADC_1 HAS_ADC_TEST(1) @@ -1145,7 +1147,9 @@ #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E) -#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS) +#define HAS_SOME_Z_MICROSTEPS (HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS) +#define HAS_SOME_E_MICROSTEPS (HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS) +#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS) #if HAS_MICROSTEPS diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index f1396ada4..e7c42d601 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -39,34 +39,34 @@ L64XX_Marlin L64xxManager; void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); } -char L64XX_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" }; +char L64XX_Marlin::index_to_axis[MAX_L64XX][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" }; #define DEBUG_OUT ENABLED(L6470_CHITCHAT) #include "../../core/debug_out.h" -uint8_t L64XX_Marlin::dir_commands[MAX_L6470]; // array to hold direction command for each driver +uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction command for each driver -uint8_t L64XX_Marlin::index_to_dir[MAX_L6470] = { (INVERT_X_DIR) , // 0 X - (INVERT_Y_DIR) , // 1 Y - (INVERT_Z_DIR) , // 2 Z - #if ENABLED(X_DUAL_STEPPER_DRIVERS) - (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR) , // 3 X2 +uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { (INVERT_X_DIR), // 0 X + (INVERT_Y_DIR), // 1 Y + (INVERT_Z_DIR), // 2 Z + #if ENABLED(X_DUAL_STEPPER_DRIVERS) // 3 X2 + (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR), #else - (INVERT_X_DIR) , // 3 X2 + (INVERT_X_DIR), #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR) , // 4 Y2 + #if ENABLED(Y_DUAL_STEPPER_DRIVERS) // 4 Y2 + (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR), #else - (INVERT_Y_DIR) , // 4 Y2 + (INVERT_Y_DIR), #endif - (INVERT_Z_DIR) , // 5 Z2 - (INVERT_Z_DIR) , // 6 Z3 - (INVERT_E0_DIR) , // 7 E0 - (INVERT_E1_DIR) , // 8 E1 - (INVERT_E2_DIR) , // 9 E2 - (INVERT_E3_DIR) , // 10 E3 - (INVERT_E4_DIR) , // 11 E4 - (INVERT_E5_DIR) , // 12 E5 + (INVERT_Z_DIR), // 5 Z2 + (INVERT_Z_DIR), // 6 Z3 + (INVERT_E0_DIR), // 7 E0 + (INVERT_E1_DIR), // 8 E1 + (INVERT_E2_DIR), // 9 E2 + (INVERT_E3_DIR), // 10 E3 + (INVERT_E4_DIR), // 11 E4 + (INVERT_E5_DIR), // 12 E5 }; volatile uint8_t L64XX_Marlin::spi_abort = false; @@ -367,7 +367,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in uint8_t driver_count_local = 0; // Can't use "driver_count" directly as a subscript because it's passed by reference if (axis_offset >= 2 || axis_mon[0][0] == 'E') { // Single axis, E0, or E1 axis_mon[0][1] = axis_offset + '0'; - for (j = 0; j < MAX_L6470; j++) { // See how many drivers on this axis + for (j = 0; j < MAX_L64XX; j++) { // See how many drivers on this axis const char * const str = index_to_axis[j]; if (axis_mon[0][0] == str[0]) { char * const mon = axis_mon[driver_count_local]; @@ -380,7 +380,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in } } else if (axis_offset == 0) { // One or more axes - for (j = 0; j < MAX_L6470; j++) { // See how many drivers on this axis + for (j = 0; j < MAX_L64XX; j++) { // See how many drivers on this axis const char * const str = index_to_axis[j]; if (axis_mon[0][0] == str[0]) { char * const mon = axis_mon[driver_count_local]; diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.h b/Marlin/src/libs/L64XX/L64XX_Marlin.h index a0b5e5e5a..9aaabb1fb 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.h +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.h @@ -30,21 +30,19 @@ #define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P) -#define MAX_L6470 (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin - #define dSPIN_STEP_CLOCK 0x58 #define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK #define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1 #define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5)) -typedef enum : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5 } L64XX_axis_t; +enum L64XX_axis_t : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5, MAX_L64XX }; class L64XX_Marlin : public L64XXHelper { public: - static char index_to_axis[MAX_L6470][3]; + static char index_to_axis[MAX_L64XX][3]; - static uint8_t index_to_dir[MAX_L6470]; - static uint8_t dir_commands[MAX_L6470]; + static uint8_t index_to_dir[MAX_L64XX]; + static uint8_t dir_commands[MAX_L64XX]; // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer static volatile uint8_t spi_abort; diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 4aa2208b6..5d05e0d75 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -119,7 +119,7 @@ Stepper stepper; // Singleton #if HAS_L64XX #include "../libs/L64XX/L64XX_Marlin.h" - uint8_t L6470_buf[MAX_L6470 + 1]; // chip command sequence - element 0 not used + uint8_t L6470_buf[MAX_L64XX + 1]; // chip command sequence - element 0 not used bool L64XX_OK_to_power_up = false; // flag to keep L64xx steppers powered down after a reset or power up #endif diff --git a/Marlin/src/module/stepper/L64xx.h b/Marlin/src/module/stepper/L64xx.h index 36ce5610f..7f5c60fcf 100644 --- a/Marlin/src/module/stepper/L64xx.h +++ b/Marlin/src/module/stepper/L64xx.h @@ -44,220 +44,220 @@ // X Stepper #if AXIS_IS_L64XX(X) extern L64XX_CLASS(X) stepperX; - #define X_ENABLE_INIT NOOP + #define X_ENABLE_INIT() NOOP #define X_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX.free()) - #define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ) + #define X_ENABLE_READ() (stepperX.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_X(L6474) - #define X_DIR_INIT SET_OUTPUT(X_DIR_PIN) + #define X_DIR_INIT() SET_OUTPUT(X_DIR_PIN) #define X_DIR_WRITE(STATE) L6474_DIR_WRITE(X, STATE) - #define X_DIR_READ READ(X_DIR_PIN) + #define X_DIR_READ() READ(X_DIR_PIN) #else - #define X_DIR_INIT NOOP + #define X_DIR_INIT() NOOP #define X_DIR_WRITE(STATE) L64XX_DIR_WRITE(X, STATE) - #define X_DIR_READ (stepper##X.getStatus() & STATUS_DIR); + #define X_DIR_READ() (stepper##X.getStatus() & STATUS_DIR); #endif #endif // Y Stepper #if AXIS_IS_L64XX(Y) extern L64XX_CLASS(Y) stepperY; - #define Y_ENABLE_INIT NOOP + #define Y_ENABLE_INIT() NOOP #define Y_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY.free()) - #define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ) + #define Y_ENABLE_READ() (stepperY.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_Y(L6474) - #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN) + #define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN) #define Y_DIR_WRITE(STATE) L6474_DIR_WRITE(Y, STATE) - #define Y_DIR_READ READ(Y_DIR_PIN) + #define Y_DIR_READ() READ(Y_DIR_PIN) #else - #define Y_DIR_INIT NOOP + #define Y_DIR_INIT() NOOP #define Y_DIR_WRITE(STATE) L64XX_DIR_WRITE(Y, STATE) - #define Y_DIR_READ (stepper##Y.getStatus() & STATUS_DIR); + #define Y_DIR_READ() (stepper##Y.getStatus() & STATUS_DIR); #endif #endif // Z Stepper #if AXIS_IS_L64XX(Z) extern L64XX_CLASS(Z) stepperZ; - #define Z_ENABLE_INIT NOOP + #define Z_ENABLE_INIT() NOOP #define Z_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ.free()) - #define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ) + #define Z_ENABLE_READ() (stepperZ.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_Z(L6474) - #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN) + #define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN) #define Z_DIR_WRITE(STATE) L6474_DIR_WRITE(Z, STATE) - #define Z_DIR_READ READ(Z_DIR_PIN) + #define Z_DIR_READ() READ(Z_DIR_PIN) #else - #define Z_DIR_INIT NOOP + #define Z_DIR_INIT() NOOP #define Z_DIR_WRITE(STATE) L64XX_DIR_WRITE(Z, STATE) - #define Z_DIR_READ (stepper##Z.getStatus() & STATUS_DIR); + #define Z_DIR_READ() (stepper##Z.getStatus() & STATUS_DIR); #endif #endif // X2 Stepper #if HAS_X2_ENABLE && AXIS_IS_L64XX(X2) extern L64XX_CLASS(X2) stepperX2; - #define X2_ENABLE_INIT NOOP + #define X2_ENABLE_INIT() NOOP #define X2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX2.free()) - #define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ) + #define X2_ENABLE_READ() (stepperX2.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_X2(L6474) - #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN) + #define X2_DIR_INIT() SET_OUTPUT(X2_DIR_PIN) #define X2_DIR_WRITE(STATE) L6474_DIR_WRITE(X2, STATE) - #define X2_DIR_READ READ(X2_DIR_PIN) + #define X2_DIR_READ() READ(X2_DIR_PIN) #else - #define X2_DIR_INIT NOOP + #define X2_DIR_INIT() NOOP #define X2_DIR_WRITE(STATE) L64XX_DIR_WRITE(X2, STATE) - #define X2_DIR_READ (stepper##X2.getStatus() & STATUS_DIR); + #define X2_DIR_READ() (stepper##X2.getStatus() & STATUS_DIR); #endif #endif // Y2 Stepper #if HAS_Y2_ENABLE && AXIS_IS_L64XX(Y2) extern L64XX_CLASS(Y2) stepperY2; - #define Y2_ENABLE_INIT NOOP + #define Y2_ENABLE_INIT() NOOP #define Y2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY2.free()) - #define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ) + #define Y2_ENABLE_READ() (stepperY2.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_Y2(L6474) - #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN) + #define Y2_DIR_INIT() SET_OUTPUT(Y2_DIR_PIN) #define Y2_DIR_WRITE(STATE) L6474_DIR_WRITE(Y2, STATE) - #define Y2_DIR_READ READ(Y2_DIR_PIN) + #define Y2_DIR_READ() READ(Y2_DIR_PIN) #else - #define Y2_DIR_INIT NOOP + #define Y2_DIR_INIT() NOOP #define Y2_DIR_WRITE(STATE) L64XX_DIR_WRITE(Y2, STATE) - #define Y2_DIR_READ (stepper##Y2.getStatus() & STATUS_DIR); + #define Y2_DIR_READ() (stepper##Y2.getStatus() & STATUS_DIR); #endif #endif // Z2 Stepper #if HAS_Z2_ENABLE && AXIS_IS_L64XX(Z2) extern L64XX_CLASS(Z2) stepperZ2; - #define Z2_ENABLE_INIT NOOP + #define Z2_ENABLE_INIT() NOOP #define Z2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ2.free()) - #define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ) + #define Z2_ENABLE_READ() (stepperZ2.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_Z2(L6474) - #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN) + #define Z2_DIR_INIT() SET_OUTPUT(Z2_DIR_PIN) #define Z2_DIR_WRITE(STATE) L6474_DIR_WRITE(Z2, STATE) - #define Z2_DIR_READ READ(Z2_DIR_PIN) + #define Z2_DIR_READ() READ(Z2_DIR_PIN) #else - #define Z2_DIR_INIT NOOP + #define Z2_DIR_INIT() NOOP #define Z2_DIR_WRITE(STATE) L64XX_DIR_WRITE(Z2, STATE) - #define Z2_DIR_READ (stepper##Z2.getStatus() & STATUS_DIR); + #define Z2_DIR_READ() (stepper##Z2.getStatus() & STATUS_DIR); #endif #endif // Z3 Stepper #if HAS_Z3_ENABLE && AXIS_IS_L64XX(Z3) extern L64XX_CLASS(Z3) stepperZ3; - #define Z3_ENABLE_INIT NOOP + #define Z3_ENABLE_INIT() NOOP #define Z3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ3.free()) - #define Z3_ENABLE_READ (stepperZ3.getStatus() & STATUS_HIZ) + #define Z3_ENABLE_READ() (stepperZ3.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_Z3(L6474) - #define Z3_DIR_INIT SET_OUTPUT(Z3_DIR_PIN) + #define Z3_DIR_INIT() SET_OUTPUT(Z3_DIR_PIN) #define Z3_DIR_WRITE(STATE) L6474_DIR_WRITE(Z3, STATE) - #define Z3_DIR_READ READ(Z3_DIR_PIN) + #define Z3_DIR_READ() READ(Z3_DIR_PIN) #else - #define Z3_DIR_INIT NOOP + #define Z3_DIR_INIT() NOOP #define Z3_DIR_WRITE(STATE) L64XX_DIR_WRITE(Z3, STATE) - #define Z3_DIR_READ (stepper##Z3.getStatus() & STATUS_DIR); + #define Z3_DIR_READ() (stepper##Z3.getStatus() & STATUS_DIR); #endif #endif // E0 Stepper #if AXIS_IS_L64XX(E0) extern L64XX_CLASS(E0) stepperE0; - #define E0_ENABLE_INIT NOOP + #define E0_ENABLE_INIT() NOOP #define E0_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE0.free()) - #define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ) + #define E0_ENABLE_READ() (stepperE0.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E0(L6474) - #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN) + #define E0_DIR_INIT() SET_OUTPUT(E0_DIR_PIN) #define E0_DIR_WRITE(STATE) L6474_DIR_WRITE(E0, STATE) - #define E0_DIR_READ READ(E0_DIR_PIN) + #define E0_DIR_READ() READ(E0_DIR_PIN) #else - #define E0_DIR_INIT NOOP + #define E0_DIR_INIT() NOOP #define E0_DIR_WRITE(STATE) L64XX_DIR_WRITE(E0, STATE) - #define E0_DIR_READ (stepper##E0.getStatus() & STATUS_DIR); + #define E0_DIR_READ() (stepper##E0.getStatus() & STATUS_DIR); #endif #endif // E1 Stepper #if AXIS_IS_L64XX(E1) extern L64XX_CLASS(E1) stepperE1; - #define E1_ENABLE_INIT NOOP + #define E1_ENABLE_INIT() NOOP #define E1_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE1.free()) - #define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ) + #define E1_ENABLE_READ() (stepperE1.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E1(L6474) - #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN) + #define E1_DIR_INIT() SET_OUTPUT(E1_DIR_PIN) #define E1_DIR_WRITE(STATE) L6474_DIR_WRITE(E1, STATE) - #define E1_DIR_READ READ(E1_DIR_PIN) + #define E1_DIR_READ() READ(E1_DIR_PIN) #else - #define E1_DIR_INIT NOOP + #define E1_DIR_INIT() NOOP #define E1_DIR_WRITE(STATE) L64XX_DIR_WRITE(E1, STATE) - #define E1_DIR_READ (stepper##E1.getStatus() & STATUS_DIR); + #define E1_DIR_READ() (stepper##E1.getStatus() & STATUS_DIR); #endif #endif // E2 Stepper #if AXIS_IS_L64XX(E2) extern L64XX_CLASS(E2) stepperE2; - #define E2_ENABLE_INIT NOOP + #define E2_ENABLE_INIT() NOOP #define E2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE2.free()) - #define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ) + #define E2_ENABLE_READ() (stepperE2.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E2(L6474) - #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN) + #define E2_DIR_INIT() SET_OUTPUT(E2_DIR_PIN) #define E2_DIR_WRITE(STATE) L6474_DIR_WRITE(E2, STATE) - #define E2_DIR_READ READ(E2_DIR_PIN) + #define E2_DIR_READ() READ(E2_DIR_PIN) #else - #define E2_DIR_INIT NOOP + #define E2_DIR_INIT() NOOP #define E2_DIR_WRITE(STATE) L64XX_DIR_WRITE(E2, STATE) - #define E2_DIR_READ (stepper##E2.getStatus() & STATUS_DIR); + #define E2_DIR_READ() (stepper##E2.getStatus() & STATUS_DIR); #endif #endif // E3 Stepper #if AXIS_IS_L64XX(E3) extern L64XX_CLASS(E3) stepperE3; - #define E3_ENABLE_INIT NOOP + #define E3_ENABLE_INIT() NOOP #define E3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE3.free()) - #define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ) + #define E3_ENABLE_READ() (stepperE3.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E3(L6474) - #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN) + #define E3_DIR_INIT() SET_OUTPUT(E3_DIR_PIN) #define E3_DIR_WRITE(STATE) L6474_DIR_WRITE(E3, STATE) - #define E3_DIR_READ READ(E3_DIR_PIN) + #define E3_DIR_READ() READ(E3_DIR_PIN) #else - #define E3_DIR_INIT NOOP + #define E3_DIR_INIT() NOOP #define E3_DIR_WRITE(STATE) L64XX_DIR_WRITE(E3, STATE) - #define E3_DIR_READ (stepper##E3.getStatus() & STATUS_DIR); + #define E3_DIR_READ() (stepper##E3.getStatus() & STATUS_DIR); #endif #endif // E4 Stepper #if AXIS_IS_L64XX(E4) extern L64XX_CLASS(E4) stepperE4; - #define E4_ENABLE_INIT NOOP + #define E4_ENABLE_INIT() NOOP #define E4_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE4.free()) - #define E4_ENABLE_READ (stepperE4.getStatus() & STATUS_HIZ) + #define E4_ENABLE_READ() (stepperE4.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E4(L6474) - #define E4_DIR_INIT SET_OUTPUT(E4_DIR_PIN) + #define E4_DIR_INIT() SET_OUTPUT(E4_DIR_PIN) #define E4_DIR_WRITE(STATE) L6474_DIR_WRITE(E4, STATE) - #define E4_DIR_READ READ(E4_DIR_PIN) + #define E4_DIR_READ() READ(E4_DIR_PIN) #else - #define E4_DIR_INIT NOOP + #define E4_DIR_INIT() NOOP #define E4_DIR_WRITE(STATE) L64XX_DIR_WRITE(E4, STATE) - #define E4_DIR_READ (stepper##E4.getStatus() & STATUS_DIR); + #define E4_DIR_READ() (stepper##E4.getStatus() & STATUS_DIR); #endif #endif // E5 Stepper #if AXIS_IS_L64XX(E5) extern L64XX_CLASS(E5) stepperE5; - #define E5_ENABLE_INIT NOOP + #define E5_ENABLE_INIT() NOOP #define E5_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE5.free()) - #define E5_ENABLE_READ (stepperE5.getStatus() & STATUS_HIZ) + #define E5_ENABLE_READ() (stepperE5.getStatus() & STATUS_HIZ) #if AXIS_DRIVER_TYPE_E5(L6474) - #define E5_DIR_INIT SET_OUTPUT(E5_DIR_PIN) + #define E5_DIR_INIT() SET_OUTPUT(E5_DIR_PIN) #define E5_DIR_WRITE(STATE) L6474_DIR_WRITE(E5, STATE) - #define E5_DIR_READ READ(E5_DIR_PIN) + #define E5_DIR_READ() READ(E5_DIR_PIN) #else - #define E5_DIR_INIT NOOP + #define E5_DIR_INIT() NOOP #define E5_DIR_WRITE(STATE) L64XX_DIR_WRITE(E5, STATE) - #define E5_DIR_READ (stepper##E5.getStatus() & STATUS_DIR); + #define E5_DIR_READ() (stepper##E5.getStatus() & STATUS_DIR); #endif #endif diff --git a/Marlin/src/module/stepper/TMC26X.h b/Marlin/src/module/stepper/TMC26X.h index a1c270482..b4a742edc 100644 --- a/Marlin/src/module/stepper/TMC26X.h +++ b/Marlin/src/module/stepper/TMC26X.h @@ -42,7 +42,7 @@ void tmc26x_init_to_defaults(); // X Stepper #if AXIS_DRIVER_TYPE_X(TMC26X) extern TMC26XStepper stepperX; - #define X_ENABLE_INIT NOOP + #define X_ENABLE_INIT() NOOP #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_READ() stepperX.isEnabled() #endif @@ -50,7 +50,7 @@ void tmc26x_init_to_defaults(); // Y Stepper #if AXIS_DRIVER_TYPE_Y(TMC26X) extern TMC26XStepper stepperY; - #define Y_ENABLE_INIT NOOP + #define Y_ENABLE_INIT() NOOP #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_READ() stepperY.isEnabled() #endif @@ -58,7 +58,7 @@ void tmc26x_init_to_defaults(); // Z Stepper #if AXIS_DRIVER_TYPE_Z(TMC26X) extern TMC26XStepper stepperZ; - #define Z_ENABLE_INIT NOOP + #define Z_ENABLE_INIT() NOOP #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_READ() stepperZ.isEnabled() #endif @@ -66,7 +66,7 @@ void tmc26x_init_to_defaults(); // X2 Stepper #if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(TMC26X) extern TMC26XStepper stepperX2; - #define X2_ENABLE_INIT NOOP + #define X2_ENABLE_INIT() NOOP #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_READ() stepperX2.isEnabled() #endif @@ -74,7 +74,7 @@ void tmc26x_init_to_defaults(); // Y2 Stepper #if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(TMC26X) extern TMC26XStepper stepperY2; - #define Y2_ENABLE_INIT NOOP + #define Y2_ENABLE_INIT() NOOP #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_READ() stepperY2.isEnabled() #endif @@ -82,15 +82,15 @@ void tmc26x_init_to_defaults(); // Z2 Stepper #if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(TMC26X) extern TMC26XStepper stepperZ2; - #define Z2_ENABLE_INIT NOOP + #define Z2_ENABLE_INIT() NOOP #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_READ() stepperZ2.isEnabled() #endif // Z3 Stepper -#if HAS_Z3_ENABLE && ENABLED(Z3_IS_TMC26X) +#if HAS_Z3_ENABLE && AXIS_DRIVER_TYPE_Z3(TMC26X) extern TMC26XStepper stepperZ3; - #define Z3_ENABLE_INIT NOOP + #define Z3_ENABLE_INIT() NOOP #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE) #define Z3_ENABLE_READ() stepperZ3.isEnabled() #endif @@ -98,7 +98,7 @@ void tmc26x_init_to_defaults(); // E0 Stepper #if AXIS_DRIVER_TYPE_E0(TMC26X) extern TMC26XStepper stepperE0; - #define E0_ENABLE_INIT NOOP + #define E0_ENABLE_INIT() NOOP #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_READ() stepperE0.isEnabled() #endif @@ -106,7 +106,7 @@ void tmc26x_init_to_defaults(); // E1 Stepper #if AXIS_DRIVER_TYPE_E1(TMC26X) extern TMC26XStepper stepperE1; - #define E1_ENABLE_INIT NOOP + #define E1_ENABLE_INIT() NOOP #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_READ() stepperE1.isEnabled() #endif @@ -114,7 +114,7 @@ void tmc26x_init_to_defaults(); // E2 Stepper #if AXIS_DRIVER_TYPE_E2(TMC26X) extern TMC26XStepper stepperE2; - #define E2_ENABLE_INIT NOOP + #define E2_ENABLE_INIT() NOOP #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_READ() stepperE2.isEnabled() #endif @@ -122,7 +122,7 @@ void tmc26x_init_to_defaults(); // E3 Stepper #if AXIS_DRIVER_TYPE_E3(TMC26X) extern TMC26XStepper stepperE3; - #define E3_ENABLE_INIT NOOP + #define E3_ENABLE_INIT() NOOP #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_READ() stepperE3.isEnabled() #endif @@ -130,7 +130,7 @@ void tmc26x_init_to_defaults(); // E4 Stepper #if AXIS_DRIVER_TYPE_E4(TMC26X) extern TMC26XStepper stepperE4; - #define E4_ENABLE_INIT NOOP + #define E4_ENABLE_INIT() NOOP #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE) #define E4_ENABLE_READ() stepperE4.isEnabled() #endif @@ -138,7 +138,7 @@ void tmc26x_init_to_defaults(); // E5 Stepper #if AXIS_DRIVER_TYPE_E5(TMC26X) extern TMC26XStepper stepperE5; - #define E5_ENABLE_INIT NOOP + #define E5_ENABLE_INIT() NOOP #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE) #define E5_ENABLE_READ() stepperE5.isEnabled() #endif diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index 5884e231d..bc8ab145d 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -49,12 +49,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // X Stepper #ifndef X_ENABLE_INIT - #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) + #define X_ENABLE_INIT() SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE) #define X_ENABLE_READ() READ(X_ENABLE_PIN) #endif #ifndef X_DIR_INIT - #define X_DIR_INIT SET_OUTPUT(X_DIR_PIN) + #define X_DIR_INIT() SET_OUTPUT(X_DIR_PIN) #define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE) #define X_DIR_READ() READ(X_DIR_PIN) #endif @@ -66,12 +66,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Y Stepper #ifndef Y_ENABLE_INIT - #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) + #define Y_ENABLE_INIT() SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE) #define Y_ENABLE_READ() READ(Y_ENABLE_PIN) #endif #ifndef Y_DIR_INIT - #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN) + #define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN) #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE) #define Y_DIR_READ() READ(Y_DIR_PIN) #endif @@ -83,12 +83,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Z Stepper #ifndef Z_ENABLE_INIT - #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) + #define Z_ENABLE_INIT() SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE) #define Z_ENABLE_READ() READ(Z_ENABLE_PIN) #endif #ifndef Z_DIR_INIT - #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN) + #define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN) #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE) #define Z_DIR_READ() READ(Z_DIR_PIN) #endif @@ -101,12 +101,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // X2 Stepper #if HAS_X2_ENABLE #ifndef X2_ENABLE_INIT - #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) + #define X2_ENABLE_INIT() SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) #define X2_ENABLE_READ() READ(X2_ENABLE_PIN) #endif #ifndef X2_DIR_INIT - #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN) + #define X2_DIR_INIT() SET_OUTPUT(X2_DIR_PIN) #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE) #define X2_DIR_READ() READ(X2_DIR_PIN) #endif @@ -120,12 +120,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Y2 Stepper #if HAS_Y2_ENABLE #ifndef Y2_ENABLE_INIT - #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) + #define Y2_ENABLE_INIT() SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) #define Y2_ENABLE_READ() READ(Y2_ENABLE_PIN) #endif #ifndef Y2_DIR_INIT - #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN) + #define Y2_DIR_INIT() SET_OUTPUT(Y2_DIR_PIN) #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE) #define Y2_DIR_READ() READ(Y2_DIR_PIN) #endif @@ -141,12 +141,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Z2 Stepper #if HAS_Z2_ENABLE #ifndef Z2_ENABLE_INIT - #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) + #define Z2_ENABLE_INIT() SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) #define Z2_ENABLE_READ() READ(Z2_ENABLE_PIN) #endif #ifndef Z2_DIR_INIT - #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN) + #define Z2_DIR_INIT() SET_OUTPUT(Z2_DIR_PIN) #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE) #define Z2_DIR_READ() READ(Z2_DIR_PIN) #endif @@ -162,12 +162,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Z3 Stepper #if HAS_Z3_ENABLE #ifndef Z3_ENABLE_INIT - #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN) + #define Z3_ENABLE_INIT() SET_OUTPUT(Z3_ENABLE_PIN) #define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE) #define Z3_ENABLE_READ() READ(Z3_ENABLE_PIN) #endif #ifndef Z3_DIR_INIT - #define Z3_DIR_INIT SET_OUTPUT(Z3_DIR_PIN) + #define Z3_DIR_INIT() SET_OUTPUT(Z3_DIR_PIN) #define Z3_DIR_WRITE(STATE) WRITE(Z3_DIR_PIN,STATE) #define Z3_DIR_READ() READ(Z3_DIR_PIN) #endif @@ -182,12 +182,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E0 Stepper #ifndef E0_ENABLE_INIT - #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) + #define E0_ENABLE_INIT() SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE) #define E0_ENABLE_READ() READ(E0_ENABLE_PIN) #endif #ifndef E0_DIR_INIT - #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN) + #define E0_DIR_INIT() SET_OUTPUT(E0_DIR_PIN) #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE) #define E0_DIR_READ() READ(E0_DIR_PIN) #endif @@ -199,12 +199,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E1 Stepper #ifndef E1_ENABLE_INIT - #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) + #define E1_ENABLE_INIT() SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE) #define E1_ENABLE_READ() READ(E1_ENABLE_PIN) #endif #ifndef E1_DIR_INIT - #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN) + #define E1_DIR_INIT() SET_OUTPUT(E1_DIR_PIN) #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE) #define E1_DIR_READ() READ(E1_DIR_PIN) #endif @@ -216,12 +216,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E2 Stepper #ifndef E2_ENABLE_INIT - #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) + #define E2_ENABLE_INIT() SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE) #define E2_ENABLE_READ() READ(E2_ENABLE_PIN) #endif #ifndef E2_DIR_INIT - #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN) + #define E2_DIR_INIT() SET_OUTPUT(E2_DIR_PIN) #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE) #define E2_DIR_READ() READ(E2_DIR_PIN) #endif @@ -233,12 +233,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E3 Stepper #ifndef E3_ENABLE_INIT - #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) + #define E3_ENABLE_INIT() SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE) #define E3_ENABLE_READ() READ(E3_ENABLE_PIN) #endif #ifndef E3_DIR_INIT - #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN) + #define E3_DIR_INIT() SET_OUTPUT(E3_DIR_PIN) #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE) #define E3_DIR_READ() READ(E3_DIR_PIN) #endif @@ -250,12 +250,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E4 Stepper #ifndef E4_ENABLE_INIT - #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) + #define E4_ENABLE_INIT() SET_OUTPUT(E4_ENABLE_PIN) #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE) #define E4_ENABLE_READ() READ(E4_ENABLE_PIN) #endif #ifndef E4_DIR_INIT - #define E4_DIR_INIT SET_OUTPUT(E4_DIR_PIN) + #define E4_DIR_INIT() SET_OUTPUT(E4_DIR_PIN) #define E4_DIR_WRITE(STATE) WRITE(E4_DIR_PIN,STATE) #define E4_DIR_READ() READ(E4_DIR_PIN) #endif @@ -267,12 +267,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // E5 Stepper #ifndef E5_ENABLE_INIT - #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN) + #define E5_ENABLE_INIT() SET_OUTPUT(E5_ENABLE_PIN) #define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE) #define E5_ENABLE_READ() READ(E5_ENABLE_PIN) #endif #ifndef E5_DIR_INIT - #define E5_DIR_INIT SET_OUTPUT(E5_DIR_PIN) + #define E5_DIR_INIT() SET_OUTPUT(E5_DIR_PIN) #define E5_DIR_WRITE(STATE) WRITE(E5_DIR_PIN,STATE) #define E5_DIR_READ() READ(E5_DIR_PIN) #endif @@ -491,7 +491,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z3_disable() NOOP #endif -#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0) +#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0) #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0) // diff --git a/Marlin/src/module/stepper/trinamic.h b/Marlin/src/module/stepper/trinamic.h index b11d6b2ec..863e7475b 100644 --- a/Marlin/src/module/stepper/trinamic.h +++ b/Marlin/src/module/stepper/trinamic.h @@ -88,7 +88,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(X) extern TMC_CLASS(X, X) stepperX; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define X_ENABLE_INIT NOOP + #define X_ENABLE_INIT() NOOP #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0) #define X_ENABLE_READ() stepperX.isEnabled() #endif @@ -101,7 +101,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(Y) extern TMC_CLASS(Y, Y) stepperY; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define Y_ENABLE_INIT NOOP + #define Y_ENABLE_INIT() NOOP #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0) #define Y_ENABLE_READ() stepperY.isEnabled() #endif @@ -114,7 +114,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(Z) extern TMC_CLASS(Z, Z) stepperZ; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define Z_ENABLE_INIT NOOP + #define Z_ENABLE_INIT() NOOP #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z_ENABLE_READ() stepperZ.isEnabled() #endif @@ -127,7 +127,7 @@ void reset_trinamic_drivers(); #if HAS_X2_ENABLE && AXIS_IS_TMC(X2) extern TMC_CLASS(X2, X) stepperX2; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define X2_ENABLE_INIT NOOP + #define X2_ENABLE_INIT() NOOP #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0) #define X2_ENABLE_READ() stepperX2.isEnabled() #endif @@ -140,7 +140,7 @@ void reset_trinamic_drivers(); #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2) extern TMC_CLASS(Y2, Y) stepperY2; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define Y2_ENABLE_INIT NOOP + #define Y2_ENABLE_INIT() NOOP #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0) #define Y2_ENABLE_READ() stepperY2.isEnabled() #endif @@ -153,7 +153,7 @@ void reset_trinamic_drivers(); #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2) extern TMC_CLASS(Z2, Z) stepperZ2; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2) - #define Z2_ENABLE_INIT NOOP + #define Z2_ENABLE_INIT() NOOP #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z2_ENABLE_READ() stepperZ2.isEnabled() #endif @@ -166,7 +166,7 @@ void reset_trinamic_drivers(); #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3) extern TMC_CLASS(Z3, Z) stepperZ3; #if ENABLED(SOFTWARE_DRIVER_ENABLE) - #define Z3_ENABLE_INIT NOOP + #define Z3_ENABLE_INIT() NOOP #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z3_ENABLE_READ() stepperZ3.isEnabled() #endif @@ -179,7 +179,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E0) extern TMC_CLASS_E(0) stepperE0; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0) - #define E0_ENABLE_INIT NOOP + #define E0_ENABLE_INIT() NOOP #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E0_ENABLE_READ() stepperE0.isEnabled() #endif @@ -192,7 +192,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E1) extern TMC_CLASS_E(1) stepperE1; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1) - #define E1_ENABLE_INIT NOOP + #define E1_ENABLE_INIT() NOOP #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E1_ENABLE_READ() stepperE1.isEnabled() #endif @@ -205,7 +205,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E2) extern TMC_CLASS_E(2) stepperE2; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2) - #define E2_ENABLE_INIT NOOP + #define E2_ENABLE_INIT() NOOP #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E2_ENABLE_READ() stepperE2.isEnabled() #endif @@ -218,7 +218,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E3) extern TMC_CLASS_E(3) stepperE3; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3) - #define E3_ENABLE_INIT NOOP + #define E3_ENABLE_INIT() NOOP #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E3_ENABLE_READ() stepperE3.isEnabled() #endif @@ -231,7 +231,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E4) extern TMC_CLASS_E(4) stepperE4; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4) - #define E4_ENABLE_INIT NOOP + #define E4_ENABLE_INIT() NOOP #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E4_ENABLE_READ() stepperE4.isEnabled() #endif @@ -244,7 +244,7 @@ void reset_trinamic_drivers(); #if AXIS_IS_TMC(E5) extern TMC_CLASS_E(5) stepperE5; #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5) - #define E5_ENABLE_INIT NOOP + #define E5_ENABLE_INIT() NOOP #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E5_ENABLE_READ() stepperE5.isEnabled() #endif