Simplify stepper driver per-axis selection

This commit is contained in:
teemuatlut 2018-07-14 14:13:06 +03:00 committed by Scott Lahteine
parent e5c0b490c8
commit fbcdf5eaeb
26 changed files with 744 additions and 837 deletions

View file

@ -551,6 +551,29 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.
/**
* Specify Stepper Driver types
* The options are used to determine driver pulse timings as well as more advanced functionality.
* Stepper timing options can be overridden in Configuration_adv.h
*
* Options: A4988, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100,
* TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE,
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE
* :['A4988', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE']
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
#define X2_DRIVER_TYPE A4988
#define Y2_DRIVER_TYPE A4988
#define Z2_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
#define E1_DRIVER_TYPE A4988
#define E2_DRIVER_TYPE A4988
#define E3_DRIVER_TYPE A4988
#define E4_DRIVER_TYPE A4988
// Enable this feature if all enabled endstop pins are interrupt-capable. // Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE

View file

@ -837,15 +837,17 @@
/** /**
* Minimum delay after setting the stepper DIR (in ns) * Minimum delay after setting the stepper DIR (in ns)
* 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire)
* 20 : Minimum for TMC2xxx drivers * 20 : Minimum for TMC2xxx drivers
* 200 : Minimum for A4988 drivers * 200 : Minimum for A4988 drivers
* 500 : Minimum for LV8729 drivers (guess, no info in datasheet) * 500 : Minimum for LV8729 drivers (guess, no info in datasheet)
* 650 : Minimum for DRV8825 drivers * 650 : Minimum for DRV8825 drivers
* 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet)
*15000 : Minimum for TB6560 drivers (guess, no info in datasheet) * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet)
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MINIMUM_STEPPER_DIR_DELAY 0 //#define MINIMUM_STEPPER_DIR_DELAY 650
/** /**
* Minimum stepper driver pulse width (in µs) * Minimum stepper driver pulse width (in µs)
@ -855,8 +857,10 @@
* 2 : Minimum for DRV8825 stepper drivers * 2 : Minimum for DRV8825 stepper drivers
* 3 : Minimum for TB6600 stepper drivers * 3 : Minimum for TB6600 stepper drivers
* 30 : Minimum for TB6560 stepper drivers * 30 : Minimum for TB6560 stepper drivers
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MINIMUM_STEPPER_PULSE 2 //#define MINIMUM_STEPPER_PULSE 2
/** /**
* Maximum stepping rate (in Hz) the stepper driver allows * Maximum stepping rate (in Hz) the stepper driver allows
@ -867,8 +871,10 @@
* 150000 : Maximum for TB6600 stepper driver * 150000 : Maximum for TB6600 stepper driver
* 130000 : Maximum for LV8729 stepper driver * 130000 : Maximum for LV8729 stepper driver
* 15000 : Maximum for TB6560 stepper driver * 15000 : Maximum for TB6560 stepper driver
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MAXIMUM_STEPPER_RATE 250000 //#define MAXIMUM_STEPPER_RATE 250000
// @section temperature // @section temperature
@ -1036,23 +1042,12 @@
// @section tmc // @section tmc
/** /**
* Enable this section if you have TMC26X motor drivers. * TMC26X Stepper Driver options
* You will need to import the TMC26XStepper library into the Arduino IDE for this *
* (https://github.com/trinamic/TMC26XStepper.git) * The TMC26XStepper library is required for this stepper driver.
* https://github.com/trinamic/TMC26XStepper
*/ */
//#define HAVE_TMC26X #if HAS_DRIVER(TMC26X)
#if ENABLED(HAVE_TMC26X) // Choose your axes here. This is mandatory!
//#define X_IS_TMC26X
//#define X2_IS_TMC26X
//#define Y_IS_TMC26X
//#define Y2_IS_TMC26X
//#define Z_IS_TMC26X
//#define Z2_IS_TMC26X
//#define E0_IS_TMC26X
//#define E1_IS_TMC26X
//#define E2_IS_TMC26X
//#define E3_IS_TMC26X
//#define E4_IS_TMC26X
#define X_MAX_CURRENT 1000 // in mA #define X_MAX_CURRENT 1000 // in mA
#define X_SENSE_RESISTOR 91 // in mOhms #define X_SENSE_RESISTOR 91 // in mOhms
@ -1098,62 +1093,29 @@
#define E4_SENSE_RESISTOR 91 #define E4_SENSE_RESISTOR 91
#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
#endif #endif // TMC26X
// @section tmc_smart // @section tmc_smart
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
*
* You'll also need the TMC2130Stepper Arduino library
* (https://github.com/teemuatlut/TMC2130Stepper).
*
* To use TMC2130 stepper drivers in SPI mode connect your SPI pins to * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to
* the hardware SPI interface on your board and define the required CS pins * the hardware SPI interface on your board and define the required CS pins
* in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
* You may also use software SPI if you wish to use general purpose IO pins. * You may also use software SPI if you wish to use general purpose IO pins.
*/ *
//#define HAVE_TMC2130 * The TMC2130Stepper library is required for this stepper driver.
#if ENABLED(HAVE_TMC2130) // Choose your axes here. This is mandatory! * https://github.com/teemuatlut/TMC2130Stepper
//#define X_IS_TMC2130 *
//#define X2_IS_TMC2130 * To use TMC2208 stepper UART-configurable stepper drivers
//#define Y_IS_TMC2130 * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor.
//#define Y2_IS_TMC2130
//#define Z_IS_TMC2130
//#define Z2_IS_TMC2130
//#define E0_IS_TMC2130
//#define E1_IS_TMC2130
//#define E2_IS_TMC2130
//#define E3_IS_TMC2130
//#define E4_IS_TMC2130
#endif
/**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN * To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to PDN_UART without a resistor. * to PDN_UART without a resistor.
* The drivers can also be used with hardware serial. * The drivers can also be used with hardware serial.
* *
* You'll also need the TMC2208Stepper Arduino library * The TMC2208Stepper library is required for this stepper driver.
* (https://github.com/teemuatlut/TMC2208Stepper). * https://github.com/teemuatlut/TMC2208Stepper
*/ */
//#define HAVE_TMC2208 #if HAS_TRINAMIC
#if ENABLED(HAVE_TMC2208) // Choose your axes here. This is mandatory!
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
#endif
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
@ -1308,25 +1270,12 @@
// @section L6470 // @section L6470
/** /**
* Enable this section if you have L6470 motor drivers. * L6470 Stepper Driver options
* You need to import the L6470 library into the Arduino IDE for this. *
* (https://github.com/ameyer/Arduino-L6470) * The Arduino-L6470 library is required for this stepper driver.
* https://github.com/ameyer/Arduino-L6470
*/ */
#if HAS_DRIVER(L6470)
//#define HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
//#define X_IS_L6470
//#define X2_IS_L6470
//#define Y_IS_L6470
//#define Y2_IS_L6470
//#define Z_IS_L6470
//#define Z2_IS_L6470
//#define E0_IS_L6470
//#define E1_IS_L6470
//#define E2_IS_L6470
//#define E3_IS_L6470
//#define E4_IS_L6470
#define X_MICROSTEPS 16 // number of microsteps #define X_MICROSTEPS 16 // number of microsteps
#define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off
@ -1372,7 +1321,7 @@
#define E4_OVERCURRENT 2000 #define E4_OVERCURRENT 2000
#define E4_STALLCURRENT 1500 #define E4_STALLCURRENT 1500
#endif #endif // L6470
/** /**
* TWI/I2C BUS * TWI/I2C BUS

View file

@ -99,7 +99,7 @@
/** /**
* TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
*/ */
#if ENABLED(HAVE_TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ #if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
defined(X_HARDWARE_SERIAL ) \ defined(X_HARDWARE_SERIAL ) \
|| defined(X2_HARDWARE_SERIAL) \ || defined(X2_HARDWARE_SERIAL) \
|| defined(Y_HARDWARE_SERIAL ) \ || defined(Y_HARDWARE_SERIAL ) \

View file

@ -41,7 +41,7 @@
*/ */
#define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == MOSI_PIN || TMC_SW_##P == MISO_PIN || TMC_SW_##P == SCK_PIN)) #define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == MOSI_PIN || TMC_SW_##P == MISO_PIN || TMC_SW_##P == SCK_PIN))
#if ENABLED(SDSUPPORT) && ENABLED(HAVE_TMC2130) #if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130)
#if ENABLED(TMC_USE_SW_SPI) #if ENABLED(TMC_USE_SW_SPI)
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK)) #if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs." #error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."

View file

@ -66,7 +66,7 @@
#endif #endif
#endif // SPINDLE_LASER_ENABLE #endif // SPINDLE_LASER_ENABLE
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && ENABLED(HAVE_TMC2130) && DISABLED(TMC_USE_SW_SPI) \ #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) \
&& (MB(RAMPS_14_RE_ARM_EFB) \ && (MB(RAMPS_14_RE_ARM_EFB) \
|| MB(RAMPS_14_RE_ARM_EEB) \ || MB(RAMPS_14_RE_ARM_EEB) \
|| MB(RAMPS_14_RE_ARM_EFF) \ || MB(RAMPS_14_RE_ARM_EFF) \

View file

@ -712,10 +712,10 @@ void setup() {
SERIAL_PROTOCOLLNPGM("start"); SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START(); SERIAL_ECHO_START();
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
tmc_init_cs_pins(); tmc_init_cs_pins();
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
tmc2208_serial_begin(); tmc2208_serial_begin();
#endif #endif

View file

@ -551,6 +551,29 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.
/**
* Specify Stepper Driver types
* The options are used to determine driver pulse timings as well as more advanced functionality.
* Stepper timing options can be overridden in Configuration_adv.h
*
* Options: A4988, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100,
* TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE,
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE
* :['A4988', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE']
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
#define X2_DRIVER_TYPE A4988
#define Y2_DRIVER_TYPE A4988
#define Z2_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
#define E1_DRIVER_TYPE A4988
#define E2_DRIVER_TYPE A4988
#define E3_DRIVER_TYPE A4988
#define E4_DRIVER_TYPE A4988
// Enable this feature if all enabled endstop pins are interrupt-capable. // Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE

View file

@ -837,15 +837,17 @@
/** /**
* Minimum delay after setting the stepper DIR (in ns) * Minimum delay after setting the stepper DIR (in ns)
* 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire)
* 20 : Minimum for TMC2xxx drivers * 20 : Minimum for TMC2xxx drivers
* 200 : Minimum for A4988 drivers * 200 : Minimum for A4988 drivers
* 500 : Minimum for LV8729 drivers (guess, no info in datasheet) * 500 : Minimum for LV8729 drivers (guess, no info in datasheet)
* 650 : Minimum for DRV8825 drivers * 650 : Minimum for DRV8825 drivers
* 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet)
*15000 : Minimum for TB6560 drivers (guess, no info in datasheet) * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet)
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MINIMUM_STEPPER_DIR_DELAY 0 //#define MINIMUM_STEPPER_DIR_DELAY 650
/** /**
* Minimum stepper driver pulse width (in µs) * Minimum stepper driver pulse width (in µs)
@ -855,8 +857,10 @@
* 2 : Minimum for DRV8825 stepper drivers * 2 : Minimum for DRV8825 stepper drivers
* 3 : Minimum for TB6600 stepper drivers * 3 : Minimum for TB6600 stepper drivers
* 30 : Minimum for TB6560 stepper drivers * 30 : Minimum for TB6560 stepper drivers
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MINIMUM_STEPPER_PULSE 2 //#define MINIMUM_STEPPER_PULSE 2
/** /**
* Maximum stepping rate (in Hz) the stepper driver allows * Maximum stepping rate (in Hz) the stepper driver allows
@ -867,8 +871,10 @@
* 150000 : Maximum for TB6600 stepper driver * 150000 : Maximum for TB6600 stepper driver
* 130000 : Maximum for LV8729 stepper driver * 130000 : Maximum for LV8729 stepper driver
* 15000 : Maximum for TB6560 stepper driver * 15000 : Maximum for TB6560 stepper driver
*
* Override the default value based on the driver type set in Configuration.h.
*/ */
#define MAXIMUM_STEPPER_RATE 250000 //#define MAXIMUM_STEPPER_RATE 250000
// @section temperature // @section temperature
@ -1036,23 +1042,12 @@
// @section tmc // @section tmc
/** /**
* Enable this section if you have TMC26X motor drivers. * TMC26X Stepper Driver options
* You will need to import the TMC26XStepper library into the Arduino IDE for this *
* (https://github.com/trinamic/TMC26XStepper.git) * The TMC26XStepper library is required for this stepper driver.
* https://github.com/trinamic/TMC26XStepper
*/ */
//#define HAVE_TMC26X #if HAS_DRIVER(TMC26X)
#if ENABLED(HAVE_TMC26X) // Choose your axes here. This is mandatory!
//#define X_IS_TMC26X
//#define X2_IS_TMC26X
//#define Y_IS_TMC26X
//#define Y2_IS_TMC26X
//#define Z_IS_TMC26X
//#define Z2_IS_TMC26X
//#define E0_IS_TMC26X
//#define E1_IS_TMC26X
//#define E2_IS_TMC26X
//#define E3_IS_TMC26X
//#define E4_IS_TMC26X
#define X_MAX_CURRENT 1000 // in mA #define X_MAX_CURRENT 1000 // in mA
#define X_SENSE_RESISTOR 91 // in mOhms #define X_SENSE_RESISTOR 91 // in mOhms
@ -1098,62 +1093,29 @@
#define E4_SENSE_RESISTOR 91 #define E4_SENSE_RESISTOR 91
#define E4_MICROSTEPS 16 #define E4_MICROSTEPS 16
#endif #endif // TMC26X
// @section tmc_smart // @section tmc_smart
/** /**
* Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers.
*
* You'll also need the TMC2130Stepper Arduino library
* (https://github.com/teemuatlut/TMC2130Stepper).
*
* To use TMC2130 stepper drivers in SPI mode connect your SPI pins to * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to
* the hardware SPI interface on your board and define the required CS pins * the hardware SPI interface on your board and define the required CS pins
* in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.).
* You may also use software SPI if you wish to use general purpose IO pins. * You may also use software SPI if you wish to use general purpose IO pins.
*/ *
//#define HAVE_TMC2130 * The TMC2130Stepper library is required for this stepper driver.
#if ENABLED(HAVE_TMC2130) // Choose your axes here. This is mandatory! * https://github.com/teemuatlut/TMC2130Stepper
//#define X_IS_TMC2130 *
//#define X2_IS_TMC2130 * To use TMC2208 stepper UART-configurable stepper drivers
//#define Y_IS_TMC2130 * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor.
//#define Y2_IS_TMC2130
//#define Z_IS_TMC2130
//#define Z2_IS_TMC2130
//#define E0_IS_TMC2130
//#define E1_IS_TMC2130
//#define E2_IS_TMC2130
//#define E3_IS_TMC2130
//#define E4_IS_TMC2130
#endif
/**
* Enable this for SilentStepStick Trinamic TMC2208 UART-configurable stepper drivers.
* Connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor.
* To use the reading capabilities, also connect #_SERIAL_RX_PIN * To use the reading capabilities, also connect #_SERIAL_RX_PIN
* to PDN_UART without a resistor. * to PDN_UART without a resistor.
* The drivers can also be used with hardware serial. * The drivers can also be used with hardware serial.
* *
* You'll also need the TMC2208Stepper Arduino library * The TMC2208Stepper library is required for this stepper driver.
* (https://github.com/teemuatlut/TMC2208Stepper). * https://github.com/teemuatlut/TMC2208Stepper
*/ */
//#define HAVE_TMC2208 #if HAS_TRINAMIC
#if ENABLED(HAVE_TMC2208) // Choose your axes here. This is mandatory!
//#define X_IS_TMC2208
//#define X2_IS_TMC2208
//#define Y_IS_TMC2208
//#define Y2_IS_TMC2208
//#define Z_IS_TMC2208
//#define Z2_IS_TMC2208
//#define E0_IS_TMC2208
//#define E1_IS_TMC2208
//#define E2_IS_TMC2208
//#define E3_IS_TMC2208
//#define E4_IS_TMC2208
#endif
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208)
#define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
@ -1308,25 +1270,12 @@
// @section L6470 // @section L6470
/** /**
* Enable this section if you have L6470 motor drivers. * L6470 Stepper Driver options
* You need to import the L6470 library into the Arduino IDE for this. *
* (https://github.com/ameyer/Arduino-L6470) * The Arduino-L6470 library is required for this stepper driver.
* https://github.com/ameyer/Arduino-L6470
*/ */
#if HAS_DRIVER(L6470)
//#define HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
//#define X_IS_L6470
//#define X2_IS_L6470
//#define Y_IS_L6470
//#define Y2_IS_L6470
//#define Z_IS_L6470
//#define Z2_IS_L6470
//#define E0_IS_L6470
//#define E1_IS_L6470
//#define E2_IS_L6470
//#define E3_IS_L6470
//#define E4_IS_L6470
#define X_MICROSTEPS 16 // number of microsteps #define X_MICROSTEPS 16 // number of microsteps
#define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off
@ -1372,7 +1321,7 @@
#define E4_OVERCURRENT 2000 #define E4_OVERCURRENT 2000
#define E4_STALLCURRENT 1500 #define E4_STALLCURRENT 1500
#endif #endif // L6470
/** /**
* TWI/I2C BUS * TWI/I2C BUS

57
Marlin/src/core/drivers.h Normal file
View file

@ -0,0 +1,57 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#define A4988 0x001
#define DRV8825 0x002
#define LV8729 0x003
#define L6470 0x104
#define TB6560 0x005
#define TB6600 0x006
#define TMC2100 0x007
#define TMC2130 0x108
#define TMC2130_STANDALONE 0x008
#define TMC2208 0x109
#define TMC2208_STANDALONE 0x009
#define TMC26X 0x10A
#define TMC26X_STANDALONE 0x00A
#define TMC2660 0x10B
#define TMC2660_STANDALONE 0x00B
#define AXIS_DRIVER_TYPE(A, T) ( defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T) )
#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE( X,T) || AXIS_DRIVER_TYPE(X2,T) || \
AXIS_DRIVER_TYPE( Y,T) || AXIS_DRIVER_TYPE(Y2,T) || \
AXIS_DRIVER_TYPE( Z,T) || AXIS_DRIVER_TYPE(Z2,T) || \
AXIS_DRIVER_TYPE(E0,T) || \
AXIS_DRIVER_TYPE(E1,T) || \
AXIS_DRIVER_TYPE(E2,T) || \
AXIS_DRIVER_TYPE(E3,T) || \
AXIS_DRIVER_TYPE(E4,T) )
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660) )
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A, TMC2130) || \
AXIS_DRIVER_TYPE(A, TMC2208) || \
AXIS_DRIVER_TYPE(A, TMC2660) )

View file

@ -20,8 +20,8 @@
* *
*/ */
#ifndef MACROS_H #ifndef _CORE_MACROS_H_
#define MACROS_H #define _CORE_MACROS_H_
#define NUM_AXIS 4 #define NUM_AXIS 4
#define ABCE 4 #define ABCE 4
@ -270,4 +270,4 @@
#define FMOD(x, y) fmodf(x, y) #define FMOD(x, y) fmodf(x, y)
#define HYPOT(x,y) SQRT(HYPOT2(x,y)) #define HYPOT(x,y) SQRT(HYPOT2(x,y))
#endif //__MACROS_H #endif // _CORE_MACROS_H_

View file

@ -52,7 +52,7 @@ bool report_tmc_status = false;
bool is_ot; bool is_ot;
bool is_error; bool is_error;
}; };
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); } static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; } static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; }
static TMC_driver_data get_driver_data(TMC2130Stepper &st) { static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
@ -70,7 +70,7 @@ bool report_tmc_status = false;
return data; return data;
} }
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); } static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
static uint8_t get_status_response(TMC2208Stepper &st) { static uint8_t get_status_response(TMC2208Stepper &st) {
uint32_t drv_status = st.DRV_STATUS(); uint32_t drv_status = st.DRV_STATUS();
@ -159,21 +159,21 @@ bool report_tmc_status = false;
} }
} }
#define HAS_HW_COMMS(ST) ENABLED(ST##_IS_TMC2130)|| (ENABLED(ST##_IS_TMC2208) && defined(ST##_HARDWARE_SERIAL)) #define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL))
void monitor_tmc_driver() { void monitor_tmc_driver() {
static millis_t next_cOT = 0; static millis_t next_cOT = 0;
if (ELAPSED(millis(), next_cOT)) { if (ELAPSED(millis(), next_cOT)) {
next_cOT = millis() + 500; next_cOT = millis() + 500;
#if HAS_HW_COMMS(X) || ENABLED(IS_TRAMS) #if HAS_HW_COMMS(X)
static uint8_t x_otpw_cnt = 0; static uint8_t x_otpw_cnt = 0;
monitor_tmc_driver(stepperX, TMC_X, x_otpw_cnt); monitor_tmc_driver(stepperX, TMC_X, x_otpw_cnt);
#endif #endif
#if HAS_HW_COMMS(Y) || ENABLED(IS_TRAMS) #if HAS_HW_COMMS(Y)
static uint8_t y_otpw_cnt = 0; static uint8_t y_otpw_cnt = 0;
monitor_tmc_driver(stepperY, TMC_Y, y_otpw_cnt); monitor_tmc_driver(stepperY, TMC_Y, y_otpw_cnt);
#endif #endif
#if HAS_HW_COMMS(Z) || ENABLED(IS_TRAMS) #if HAS_HW_COMMS(Z)
static uint8_t z_otpw_cnt = 0; static uint8_t z_otpw_cnt = 0;
monitor_tmc_driver(stepperZ, TMC_Z, z_otpw_cnt); monitor_tmc_driver(stepperZ, TMC_Z, z_otpw_cnt);
#endif #endif
@ -189,7 +189,7 @@ bool report_tmc_status = false;
static uint8_t z2_otpw_cnt = 0; static uint8_t z2_otpw_cnt = 0;
monitor_tmc_driver(stepperZ2, TMC_Z, z2_otpw_cnt); monitor_tmc_driver(stepperZ2, TMC_Z, z2_otpw_cnt);
#endif #endif
#if HAS_HW_COMMS(E0) || ENABLED(IS_TRAMS) #if HAS_HW_COMMS(E0)
static uint8_t e0_otpw_cnt = 0; static uint8_t e0_otpw_cnt = 0;
monitor_tmc_driver(stepperE0, TMC_E0, e0_otpw_cnt); monitor_tmc_driver(stepperE0, TMC_E0, e0_otpw_cnt);
#endif #endif
@ -311,7 +311,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
SERIAL_EOL(); SERIAL_EOL();
} }
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) { static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
switch (i) { switch (i) {
case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
@ -331,7 +331,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
} }
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
switch (i) { switch (i) {
case TMC_TSTEP: { uint32_t data = 0; st.TSTEP(&data); SERIAL_PROTOCOL(data); break; } case TMC_TSTEP: { uint32_t data = 0; st.TSTEP(&data); SERIAL_PROTOCOL(data); break; }
@ -420,52 +420,52 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
} }
static void tmc_debug_loop(const TMC_debug_enum i) { static void tmc_debug_loop(const TMC_debug_enum i) {
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
tmc_status(stepperX, TMC_X, i, planner.axis_steps_per_mm[X_AXIS]); tmc_status(stepperX, TMC_X, i, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
tmc_status(stepperX2, TMC_X2, i, planner.axis_steps_per_mm[X_AXIS]); tmc_status(stepperX2, TMC_X2, i, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
tmc_status(stepperY, TMC_Y, i, planner.axis_steps_per_mm[Y_AXIS]); tmc_status(stepperY, TMC_Y, i, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
tmc_status(stepperY2, TMC_Y2, i, planner.axis_steps_per_mm[Y_AXIS]); tmc_status(stepperY2, TMC_Y2, i, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
tmc_status(stepperZ, TMC_Z, i, planner.axis_steps_per_mm[Z_AXIS]); tmc_status(stepperZ, TMC_Z, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]); tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]); tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]);
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
tmc_status(stepperE1, TMC_E1, i, planner.axis_steps_per_mm[E_AXIS tmc_status(stepperE1, TMC_E1, i, planner.axis_steps_per_mm[E_AXIS
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
+ 1 + 1
#endif #endif
]); ]);
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
tmc_status(stepperE2, TMC_E2, i, planner.axis_steps_per_mm[E_AXIS tmc_status(stepperE2, TMC_E2, i, planner.axis_steps_per_mm[E_AXIS
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
+ 2 + 2
#endif #endif
]); ]);
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
tmc_status(stepperE3, TMC_E3, i, planner.axis_steps_per_mm[E_AXIS tmc_status(stepperE3, TMC_E3, i, planner.axis_steps_per_mm[E_AXIS
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
+ 3 + 3
#endif #endif
]); ]);
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
tmc_status(stepperE4, TMC_E4, i, planner.axis_steps_per_mm[E_AXIS tmc_status(stepperE4, TMC_E4, i, planner.axis_steps_per_mm[E_AXIS
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
+ 4 + 4
@ -477,40 +477,40 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
} }
static void drv_status_loop(const TMC_drv_status_enum i) { static void drv_status_loop(const TMC_drv_status_enum i) {
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
tmc_parse_drv_status(stepperX, TMC_X, i); tmc_parse_drv_status(stepperX, TMC_X, i);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
tmc_parse_drv_status(stepperX2, TMC_X2, i); tmc_parse_drv_status(stepperX2, TMC_X2, i);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
tmc_parse_drv_status(stepperY, TMC_Y, i); tmc_parse_drv_status(stepperY, TMC_Y, i);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
tmc_parse_drv_status(stepperY2, TMC_Y2, i); tmc_parse_drv_status(stepperY2, TMC_Y2, i);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
tmc_parse_drv_status(stepperZ, TMC_Z, i); tmc_parse_drv_status(stepperZ, TMC_Z, i);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
tmc_parse_drv_status(stepperZ2, TMC_Z2, i); tmc_parse_drv_status(stepperZ2, TMC_Z2, i);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
tmc_parse_drv_status(stepperE0, TMC_E0, i); tmc_parse_drv_status(stepperE0, TMC_E0, i);
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
tmc_parse_drv_status(stepperE1, TMC_E1, i); tmc_parse_drv_status(stepperE1, TMC_E1, i);
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
tmc_parse_drv_status(stepperE2, TMC_E2, i); tmc_parse_drv_status(stepperE2, TMC_E2, i);
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
tmc_parse_drv_status(stepperE3, TMC_E3, i); tmc_parse_drv_status(stepperE3, TMC_E3, i);
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
tmc_parse_drv_status(stepperE4, TMC_E4, i); tmc_parse_drv_status(stepperE4, TMC_E4, i);
#endif #endif
@ -553,7 +553,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
TMC_REPORT("Stallguard thrs", TMC_SGT); TMC_REPORT("Stallguard thrs", TMC_SGT);
DRV_REPORT("DRVSTATUS", TMC_DRV_CODES); DRV_REPORT("DRVSTATUS", TMC_DRV_CODES);
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
DRV_REPORT("stallguard\t", TMC_STALLGUARD); DRV_REPORT("stallguard\t", TMC_STALLGUARD);
DRV_REPORT("sg_result\t", TMC_SG_RESULT); DRV_REPORT("sg_result\t", TMC_SG_RESULT);
DRV_REPORT("fsactive\t", TMC_FSACTIVE); DRV_REPORT("fsactive\t", TMC_FSACTIVE);
@ -565,7 +565,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
DRV_REPORT("s2ga\t", TMC_S2GA); DRV_REPORT("s2ga\t", TMC_S2GA);
DRV_REPORT("otpw\t", TMC_DRV_OTPW); DRV_REPORT("otpw\t", TMC_DRV_OTPW);
DRV_REPORT("ot\t", TMC_OT); DRV_REPORT("ot\t", TMC_OT);
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
DRV_REPORT("157C\t", TMC_T157); DRV_REPORT("157C\t", TMC_T157);
DRV_REPORT("150C\t", TMC_T150); DRV_REPORT("150C\t", TMC_T150);
DRV_REPORT("143C\t", TMC_T143); DRV_REPORT("143C\t", TMC_T143);
@ -591,43 +591,43 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#endif // SENSORLESS_HOMING #endif // SENSORLESS_HOMING
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
#define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH) #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
void tmc_init_cs_pins() { void tmc_init_cs_pins() {
#if ENABLED(X_IS_TMC2130) #if AXIS_DRIVER_TYPE(X, TMC2130)
SET_CS_PIN(X); SET_CS_PIN(X);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y, TMC2130)
SET_CS_PIN(Y); SET_CS_PIN(Y);
#endif #endif
#if ENABLED(Z_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z, TMC2130)
SET_CS_PIN(Z); SET_CS_PIN(Z);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
SET_CS_PIN(X2); SET_CS_PIN(X2);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
SET_CS_PIN(Y2); SET_CS_PIN(Y2);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
SET_CS_PIN(Z2); SET_CS_PIN(Z2);
#endif #endif
#if ENABLED(E0_IS_TMC2130) #if AXIS_DRIVER_TYPE(E0, TMC2130)
SET_CS_PIN(E0); SET_CS_PIN(E0);
#endif #endif
#if ENABLED(E1_IS_TMC2130) #if AXIS_DRIVER_TYPE(E1, TMC2130)
SET_CS_PIN(E1); SET_CS_PIN(E1);
#endif #endif
#if ENABLED(E2_IS_TMC2130) #if AXIS_DRIVER_TYPE(E2, TMC2130)
SET_CS_PIN(E2); SET_CS_PIN(E2);
#endif #endif
#if ENABLED(E3_IS_TMC2130) #if AXIS_DRIVER_TYPE(E3, TMC2130)
SET_CS_PIN(E3); SET_CS_PIN(E3);
#endif #endif
#if ENABLED(E4_IS_TMC2130) #if AXIS_DRIVER_TYPE(E4, TMC2130)
SET_CS_PIN(E4); SET_CS_PIN(E4);
#endif #endif
} }
#endif // HAVE_TMC2130 #endif // TMC2130
#endif // HAS_TRINAMIC #endif // HAS_TRINAMIC

View file

@ -25,11 +25,11 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
#include <TMC2130Stepper.h> #include <TMC2130Stepper.h>
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
#include <TMC2208Stepper.h> #include <TMC2208Stepper.h>
#endif #endif
@ -100,7 +100,7 @@ void monitor_tmc_driver();
void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable=true); void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable=true);
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
void tmc_init_cs_pins(); void tmc_init_cs_pins();
#endif #endif

View file

@ -42,45 +42,45 @@ void GcodeSuite::M906() {
report = false; report = false;
switch (i) { switch (i) {
case X_AXIS: case X_AXIS:
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
if (index == 0) TMC_SET_CURRENT(X); if (index == 0) TMC_SET_CURRENT(X);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
if (index == 1) TMC_SET_CURRENT(X2); if (index == 1) TMC_SET_CURRENT(X2);
#endif #endif
break; break;
case Y_AXIS: case Y_AXIS:
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
if (index == 0) TMC_SET_CURRENT(Y); if (index == 0) TMC_SET_CURRENT(Y);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
if (index == 1) TMC_SET_CURRENT(Y2); if (index == 1) TMC_SET_CURRENT(Y2);
#endif #endif
break; break;
case Z_AXIS: case Z_AXIS:
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
if (index == 0) TMC_SET_CURRENT(Z); if (index == 0) TMC_SET_CURRENT(Z);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
if (index == 1) TMC_SET_CURRENT(Z2); if (index == 1) TMC_SET_CURRENT(Z2);
#endif #endif
break; break;
case E_AXIS: { case E_AXIS: {
if (get_target_extruder_from_command()) return; if (get_target_extruder_from_command()) return;
switch (target_extruder) { switch (target_extruder) {
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
case 0: TMC_SET_CURRENT(E0); break; case 0: TMC_SET_CURRENT(E0); break;
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
case 1: TMC_SET_CURRENT(E1); break; case 1: TMC_SET_CURRENT(E1); break;
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
case 2: TMC_SET_CURRENT(E2); break; case 2: TMC_SET_CURRENT(E2); break;
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
case 3: TMC_SET_CURRENT(E3); break; case 3: TMC_SET_CURRENT(E3); break;
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
case 4: TMC_SET_CURRENT(E4); break; case 4: TMC_SET_CURRENT(E4); break;
#endif #endif
} }
@ -89,37 +89,37 @@ void GcodeSuite::M906() {
} }
if (report) { if (report) {
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
TMC_SAY_CURRENT(X); TMC_SAY_CURRENT(X);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
TMC_SAY_CURRENT(X2); TMC_SAY_CURRENT(X2);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
TMC_SAY_CURRENT(Y); TMC_SAY_CURRENT(Y);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
TMC_SAY_CURRENT(Y2); TMC_SAY_CURRENT(Y2);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
TMC_SAY_CURRENT(Z); TMC_SAY_CURRENT(Z);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
TMC_SAY_CURRENT(Z2); TMC_SAY_CURRENT(Z2);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
TMC_SAY_CURRENT(E0); TMC_SAY_CURRENT(E0);
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
TMC_SAY_CURRENT(E1); TMC_SAY_CURRENT(E1);
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
TMC_SAY_CURRENT(E2); TMC_SAY_CURRENT(E2);
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
TMC_SAY_CURRENT(E3); TMC_SAY_CURRENT(E3);
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
TMC_SAY_CURRENT(E4); TMC_SAY_CURRENT(E4);
#endif #endif
} }

View file

@ -30,37 +30,33 @@
#include "../../../module/planner.h" #include "../../../module/planner.h"
#include "../../queue.h" #include "../../queue.h"
#define M91x_USE(A) (ENABLED(A##_IS_TMC2130) || (ENABLED(A##_IS_TMC2208) && PIN_EXISTS(A##_SERIAL_RX))) #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && PIN_EXISTS(ST##_SERIAL_RX)))
#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) #define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N))
#define M91x_USE_X (ENABLED(IS_TRAMS) || M91x_USE(X))
#define M91x_USE_Y (ENABLED(IS_TRAMS) || M91x_USE(Y))
#define M91x_USE_Z (ENABLED(IS_TRAMS) || M91x_USE(Z))
#define M91x_USE_E0 (ENABLED(IS_TRAMS) || M91x_USE_E(0))
/** /**
* M911: Report TMC stepper driver overtemperature pre-warn flag * M911: Report TMC stepper driver overtemperature pre-warn flag
* This flag is held by the library, persisting until cleared by M912 * This flag is held by the library, persisting until cleared by M912
*/ */
void GcodeSuite::M911() { void GcodeSuite::M911() {
#if M91x_USE_X #if M91x_USE(X)
tmc_report_otpw(stepperX, TMC_X); tmc_report_otpw(stepperX, TMC_X);
#endif #endif
#if M91x_USE(X2) #if M91x_USE(X2)
tmc_report_otpw(stepperX2, TMC_X2); tmc_report_otpw(stepperX2, TMC_X2);
#endif #endif
#if M91x_USE_Y #if M91x_USE(Y)
tmc_report_otpw(stepperY, TMC_Y); tmc_report_otpw(stepperY, TMC_Y);
#endif #endif
#if M91x_USE(Y2) #if M91x_USE(Y2)
tmc_report_otpw(stepperY2, TMC_Y2); tmc_report_otpw(stepperY2, TMC_Y2);
#endif #endif
#if M91x_USE_Z #if M91x_USE(Z)
tmc_report_otpw(stepperZ, TMC_Z); tmc_report_otpw(stepperZ, TMC_Z);
#endif #endif
#if M91x_USE(Z2) #if M91x_USE(Z2)
tmc_report_otpw(stepperZ2, TMC_Z2); tmc_report_otpw(stepperZ2, TMC_Z2);
#endif #endif
#if M91x_USE_E0 #if M91x_USE_E(0)
tmc_report_otpw(stepperE0, TMC_E0); tmc_report_otpw(stepperE0, TMC_E0);
#endif #endif
#if M91x_USE_E(1) #if M91x_USE_E(1)
@ -96,9 +92,9 @@ void GcodeSuite::M912() {
hasE = parser.seen(axis_codes[E_AXIS]), hasE = parser.seen(axis_codes[E_AXIS]),
hasNone = !hasX && !hasY && !hasZ && !hasE; hasNone = !hasX && !hasY && !hasZ && !hasE;
#if M91x_USE_X || M91x_USE(X2) #if M91x_USE(X) || M91x_USE(X2)
const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10); const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10);
#if M91x_USE_X #if M91x_USE(X)
if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X); if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X);
#endif #endif
#if M91x_USE(X2) #if M91x_USE(X2)
@ -106,9 +102,9 @@ void GcodeSuite::M912() {
#endif #endif
#endif #endif
#if M91x_USE_Y || M91x_USE(Y2) #if M91x_USE(Y) || M91x_USE(Y2)
const uint8_t yval = parser.byteval(axis_codes[Y_AXIS], 10); const uint8_t yval = parser.byteval(axis_codes[Y_AXIS], 10);
#if M91x_USE_Y #if M91x_USE(Y)
if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y); if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y);
#endif #endif
#if M91x_USE(Y2) #if M91x_USE(Y2)
@ -116,9 +112,9 @@ void GcodeSuite::M912() {
#endif #endif
#endif #endif
#if M91x_USE_Z || M91x_USE(Z2) #if M91x_USE(Z) || M91x_USE(Z2)
const uint8_t zval = parser.byteval(axis_codes[Z_AXIS], 10); const uint8_t zval = parser.byteval(axis_codes[Z_AXIS], 10);
#if M91x_USE_Z #if M91x_USE(Z)
if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z); if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z);
#endif #endif
#if M91x_USE(Z2) #if M91x_USE(Z2)
@ -126,9 +122,9 @@ void GcodeSuite::M912() {
#endif #endif
#endif #endif
#if M91x_USE_E0 || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4)
const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10); const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10);
#if M91x_USE_E0 #if M91x_USE_E(0)
if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0); if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
#endif #endif
#if M91x_USE_E(1) #if M91x_USE_E(1)
@ -162,45 +158,45 @@ void GcodeSuite::M912() {
report = false; report = false;
switch (i) { switch (i) {
case X_AXIS: case X_AXIS:
#if X_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X)
if (index < 2) TMC_SET_PWMTHRS(X,X); if (index < 2) TMC_SET_PWMTHRS(X,X);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X2)
if (!(index & 1)) TMC_SET_PWMTHRS(X,X2); if (!(index & 1)) TMC_SET_PWMTHRS(X,X2);
#endif #endif
break; break;
case Y_AXIS: case Y_AXIS:
#if Y_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y)
if (index < 2) TMC_SET_PWMTHRS(Y,Y); if (index < 2) TMC_SET_PWMTHRS(Y,Y);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y2)
if (!(index & 1)) TMC_SET_PWMTHRS(Y,Y2); if (!(index & 1)) TMC_SET_PWMTHRS(Y,Y2);
#endif #endif
break; break;
case Z_AXIS: case Z_AXIS:
#if Z_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z)
if (index < 2) TMC_SET_PWMTHRS(Z,Z); if (index < 2) TMC_SET_PWMTHRS(Z,Z);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z2)
if (!(index & 1)) TMC_SET_PWMTHRS(Z,Z2); if (!(index & 1)) TMC_SET_PWMTHRS(Z,Z2);
#endif #endif
break; break;
case E_AXIS: { case E_AXIS: {
if (get_target_extruder_from_command()) return; if (get_target_extruder_from_command()) return;
switch (target_extruder) { switch (target_extruder) {
#if E0_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E0)
case 0: TMC_SET_PWMTHRS_E(0); break; case 0: TMC_SET_PWMTHRS_E(0); break;
#endif #endif
#if E_STEPPERS > 1 && E1_IS_TRINAMIC #if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1)
case 1: TMC_SET_PWMTHRS_E(1); break; case 1: TMC_SET_PWMTHRS_E(1); break;
#endif #endif
#if E_STEPPERS > 2 && E2_IS_TRINAMIC #if E_STEPPERS > 2 && AXIS_HAS_STEALTHCHOP(E2)
case 2: TMC_SET_PWMTHRS_E(2); break; case 2: TMC_SET_PWMTHRS_E(2); break;
#endif #endif
#if E_STEPPERS > 3 && E3_IS_TRINAMIC #if E_STEPPERS > 3 && AXIS_HAS_STEALTHCHOP(E3)
case 3: TMC_SET_PWMTHRS_E(3); break; case 3: TMC_SET_PWMTHRS_E(3); break;
#endif #endif
#if E_STEPPERS > 4 && E4_IS_TRINAMIC #if E_STEPPERS > 4 && AXIS_HAS_STEALTHCHOP(E4)
case 4: TMC_SET_PWMTHRS_E(4); break; case 4: TMC_SET_PWMTHRS_E(4); break;
#endif #endif
} }
@ -209,37 +205,37 @@ void GcodeSuite::M912() {
} }
if (report) { if (report) {
#if X_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X)
TMC_SAY_PWMTHRS(X,X); TMC_SAY_PWMTHRS(X,X);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X2)
TMC_SAY_PWMTHRS(X,X2); TMC_SAY_PWMTHRS(X,X2);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y)
TMC_SAY_PWMTHRS(Y,Y); TMC_SAY_PWMTHRS(Y,Y);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y2)
TMC_SAY_PWMTHRS(Y,Y2); TMC_SAY_PWMTHRS(Y,Y2);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z)
TMC_SAY_PWMTHRS(Z,Z); TMC_SAY_PWMTHRS(Z,Z);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z2)
TMC_SAY_PWMTHRS(Z,Z2); TMC_SAY_PWMTHRS(Z,Z2);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E0)
TMC_SAY_PWMTHRS_E(0); TMC_SAY_PWMTHRS_E(0);
#endif #endif
#if E_STEPPERS > 1 && E1_IS_TRINAMIC #if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1)
TMC_SAY_PWMTHRS_E(1); TMC_SAY_PWMTHRS_E(1);
#endif #endif
#if E_STEPPERS > 2 && E2_IS_TRINAMIC #if E_STEPPERS > 2 && AXIS_HAS_STEALTHCHOP(E2)
TMC_SAY_PWMTHRS_E(2); TMC_SAY_PWMTHRS_E(2);
#endif #endif
#if E_STEPPERS > 3 && E3_IS_TRINAMIC #if E_STEPPERS > 3 && AXIS_HAS_STEALTHCHOP(E3)
TMC_SAY_PWMTHRS_E(3); TMC_SAY_PWMTHRS_E(3);
#endif #endif
#if E_STEPPERS > 4 && E4_IS_TRINAMIC #if E_STEPPERS > 4 && AXIS_HAS_STEALTHCHOP(E4)
TMC_SAY_PWMTHRS_E(4); TMC_SAY_PWMTHRS_E(4);
#endif #endif
} }
@ -262,30 +258,30 @@ void GcodeSuite::M912() {
switch (i) { switch (i) {
#if X_SENSORLESS #if X_SENSORLESS
case X_AXIS: case X_AXIS:
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(X)
if (index < 2) TMC_SET_SGT(X); if (index < 2) TMC_SET_SGT(X);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(X2)
if (!(index & 1)) TMC_SET_SGT(X2); if (!(index & 1)) TMC_SET_SGT(X2);
#endif #endif
break; break;
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
case Y_AXIS: case Y_AXIS:
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Y)
if (index < 2) TMC_SET_SGT(Y); if (index < 2) TMC_SET_SGT(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Y2)
if (!(index & 1)) TMC_SET_SGT(Y2); if (!(index & 1)) TMC_SET_SGT(Y2);
#endif #endif
break; break;
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
case Z_AXIS: case Z_AXIS:
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Z)
if (index < 2) TMC_SET_SGT(Z); if (index < 2) TMC_SET_SGT(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Z2)
if (!(index & 1)) TMC_SET_SGT(Z2); if (!(index & 1)) TMC_SET_SGT(Z2);
#endif #endif
break; break;
@ -295,26 +291,26 @@ void GcodeSuite::M912() {
if (report) { if (report) {
#if X_SENSORLESS #if X_SENSORLESS
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(X)
TMC_SAY_SGT(X); TMC_SAY_SGT(X);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(X2)
TMC_SAY_SGT(X2); TMC_SAY_SGT(X2);
#endif #endif
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Y)
TMC_SAY_SGT(Y); TMC_SAY_SGT(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Y2)
TMC_SAY_SGT(Y2); TMC_SAY_SGT(Y2);
#endif #endif
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Z)
TMC_SAY_SGT(Z); TMC_SAY_SGT(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Z2)
TMC_SAY_SGT(Z2); TMC_SAY_SGT(Z2);
#endif #endif
#endif #endif
@ -335,11 +331,11 @@ void GcodeSuite::M912() {
return; return;
} }
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
const uint16_t Z_current_1 = stepperZ.getCurrent(); const uint16_t Z_current_1 = stepperZ.getCurrent();
stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
const uint16_t Z2_current_1 = stepperZ2.getCurrent(); const uint16_t Z2_current_1 = stepperZ2.getCurrent();
stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
@ -350,10 +346,10 @@ void GcodeSuite::M912() {
do_blocking_move_to_z(Z_MAX_POS+_z); do_blocking_move_to_z(Z_MAX_POS+_z);
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER); stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER); stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
#endif #endif

View file

@ -132,7 +132,7 @@
* M119 - Report endstops status. * M119 - Report endstops status.
* M120 - Enable endstops detection. * M120 - Enable endstops detection.
* M121 - Disable endstops detection. * M121 - Disable endstops detection.
* M122 - Debug stepper (Requires HAVE_TMC2130 or HAVE_TMC2208) * M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE) * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
* M126 - Solenoid Air Valve Open. (Requires BARICUDA) * M126 - Solenoid Air Valve Open. (Requires BARICUDA)
* M127 - Solenoid Air Valve Closed. (Requires BARICUDA) * M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
@ -219,13 +219,13 @@
* M868 - Report or set position encoder module error correction threshold. * M868 - Report or set position encoder module error correction threshold.
* M869 - Report position encoder module error. * M869 - Report position encoder module error.
* M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE) * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires HAVE_TMC2130 or HAVE_TMC2208) * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots) * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
* M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN) * M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
* M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT) * M909 - Print digipot/DAC current value. (Requires DAC_STEPPER_CURRENT)
* M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT) * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires DAC_STEPPER_CURRENT)
* M911 - Report stepper driver overtemperature pre-warn condition. (Requires HAVE_TMC2130 or HAVE_TMC2208) * M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130 or HAVE_TMC2208) * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD) * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
* M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING) * M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING)
* *

View file

@ -426,6 +426,63 @@
#define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__) #define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__)
#define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1) #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
/**
* Driver Timings
* NOTE: Driver timing order is longest-to-shortest duration.
* Preserve this ordering when adding new drivers.
*/
#ifndef MINIMUM_STEPPER_DIR_DELAY
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_DIR_DELAY 15000
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_DIR_DELAY 1500
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_DIR_DELAY 650
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_DIR_DELAY 500
#elif HAS_DRIVER(A4988)
#define MINIMUM_STEPPER_DIR_DELAY 200
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MINIMUM_STEPPER_DIR_DELAY 20
#else
#define MINIMUM_STEPPER_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire
#endif
#endif
#ifndef MINIMUM_STEPPER_PULSE
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_PULSE 30
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_PULSE 3
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_PULSE 2
#elif HAS_DRIVER(A4988) || HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_PULSE 1
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MINIMUM_STEPPER_PULSE 0
#else
#define MINIMUM_STEPPER_PULSE 2
#endif
#endif
#ifndef MAXIMUM_STEPPER_RATE
#if HAS_DRIVER(TB6560)
#define MAXIMUM_STEPPER_RATE 15000
#elif HAS_DRIVER(LV8729)
#define MAXIMUM_STEPPER_RATE 130000
#elif HAS_DRIVER(TB6600)
#define MAXIMUM_STEPPER_RATE 150000
#elif HAS_DRIVER(DRV8825)
#define MAXIMUM_STEPPER_RATE 250000
#elif HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)
#define MAXIMUM_STEPPER_RATE 400000
#elif HAS_DRIVER(A4988)
#define MAXIMUM_STEPPER_RATE 500000
#else
#define MAXIMUM_STEPPER_RATE 250000
#endif
#endif
/** /**
* X_DUAL_ENDSTOPS endstop reassignment * X_DUAL_ENDSTOPS endstop reassignment
*/ */
@ -711,27 +768,19 @@
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4)) #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
// Trinamic Stepper Drivers // Trinamic Stepper Drivers
#define HAS_TRINAMIC (ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208) || ENABLED(IS_TRAMS)) #define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
#define X_IS_TRINAMIC (ENABLED( X_IS_TMC2130) || ENABLED( X_IS_TMC2208) || ENABLED(IS_TRAMS)) #define HAS_STALLGUARD (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660))
#define X2_IS_TRINAMIC (ENABLED(X2_IS_TMC2130) || ENABLED(X2_IS_TMC2208)) #define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
#define Y_IS_TRINAMIC (ENABLED( Y_IS_TMC2130) || ENABLED( Y_IS_TMC2208) || ENABLED(IS_TRAMS)) #define AXIS_HAS_STALLGUARD(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660) )
#define Y2_IS_TRINAMIC (ENABLED(Y2_IS_TMC2130) || ENABLED(Y2_IS_TMC2208))
#define Z_IS_TRINAMIC (ENABLED( Z_IS_TMC2130) || ENABLED( Z_IS_TMC2208) || ENABLED(IS_TRAMS))
#define Z2_IS_TRINAMIC (ENABLED(Z2_IS_TMC2130) || ENABLED(Z2_IS_TMC2208))
#define E0_IS_TRINAMIC (ENABLED(E0_IS_TMC2130) || ENABLED(E0_IS_TMC2208) || ENABLED(IS_TRAMS))
#define E1_IS_TRINAMIC (ENABLED(E1_IS_TMC2130) || ENABLED(E1_IS_TMC2208))
#define E2_IS_TRINAMIC (ENABLED(E2_IS_TMC2130) || ENABLED(E2_IS_TMC2208))
#define E3_IS_TRINAMIC (ENABLED(E3_IS_TMC2130) || ENABLED(E3_IS_TMC2208))
#define E4_IS_TRINAMIC (ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208))
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
// Disable Z axis sensorless homing if a probe is used to home the Z axis // Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
#undef Z_HOMING_SENSITIVITY #undef Z_HOMING_SENSITIVITY
#endif #endif
#define X_SENSORLESS (ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)) #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY))
#define Y_SENSORLESS (ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)) #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY))
#define Z_SENSORLESS (ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)) #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY))
#endif #endif
// Endstops and bed probe // Endstops and bed probe

View file

@ -29,6 +29,7 @@
#include "../core/types.h" #include "../core/types.h"
#include "Version.h" #include "Version.h"
#include "../../Configuration.h" #include "../../Configuration.h"
#include "../core/drivers.h"
#include "Conditionals_LCD.h" #include "Conditionals_LCD.h"
#include "../../Configuration_adv.h" #include "../../Configuration_adv.h"
#include "Conditionals_adv.h" #include "Conditionals_adv.h"

View file

@ -265,10 +265,28 @@
#elif defined(MEASURED_LOWER_LIMIT) || defined(MEASURED_UPPER_LIMIT) #elif defined(MEASURED_LOWER_LIMIT) || defined(MEASURED_UPPER_LIMIT)
#error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN. Please update your configuration." #error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN. Please update your configuration."
#elif defined(HAVE_TMCDRIVER) #elif defined(HAVE_TMCDRIVER)
#error "HAVE_TMCDRIVER is now HAVE_TMC26X. Please update your Configuration_adv.h." #error "HAVE_TMCDRIVER is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(HAVE_TMC26X)
#error "HAVE_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(HAVE_TMC2130)
#error "HAVE_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130. Please update your Configuration.h."
#elif defined(HAVE_L6470DRIVER)
#error "HAVE_L6470DRIVER is now [AXIS]_DRIVER_TYPE L6470. Please update your Configuration.h."
#elif defined(X_IS_TMC) || defined(X2_IS_TMC) || defined(Y_IS_TMC) || defined(Y2_IS_TMC) || defined(Z_IS_TMC) || defined(Z2_IS_TMC) \ #elif defined(X_IS_TMC) || defined(X2_IS_TMC) || defined(Y_IS_TMC) || defined(Y2_IS_TMC) || defined(Z_IS_TMC) || defined(Z2_IS_TMC) \
|| defined(E0_IS_TMC) || defined(E1_IS_TMC) || defined(E2_IS_TMC) || defined(E3_IS_TMC) || defined(E4_IS_TMC) || defined(E0_IS_TMC) || defined(E1_IS_TMC) || defined(E2_IS_TMC) || defined(E3_IS_TMC) || defined(E4_IS_TMC)
#error "[AXIS]_IS_TMC is now [AXIS]_IS_TMC26X. Please update your Configuration_adv.h." #error "[AXIS]_IS_TMC is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(X_IS_TMC26X) || defined(X2_IS_TMC26X) || defined(Y_IS_TMC26X) || defined(Y2_IS_TMC26X) || defined(Z_IS_TMC26X) || defined(Z2_IS_TMC26X) \
|| defined(E0_IS_TMC26X) || defined(E1_IS_TMC26X) || defined(E2_IS_TMC26X) || defined(E3_IS_TMC26X) || defined(E4_IS_TMC26X)
#error "[AXIS]_IS_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h."
#elif defined(X_IS_TMC2130) || defined(X2_IS_TMC2130) || defined(Y_IS_TMC2130) || defined(Y2_IS_TMC2130) || defined(Z_IS_TMC2130) || defined(Z2_IS_TMC2130) \
|| defined(E0_IS_TMC2130) || defined(E1_IS_TMC2130) || defined(E2_IS_TMC2130) || defined(E3_IS_TMC2130) || defined(E4_IS_TMC2130)
#error "[AXIS]_IS_TMC2130 is now [AXIS]_DRIVER_TYPE TMC2130. Please update your Configuration.h."
#elif defined(X_IS_TMC2208) || defined(X2_IS_TMC2208) || defined(Y_IS_TMC2208) || defined(Y2_IS_TMC2208) || defined(Z_IS_TMC2208) || defined(Z2_IS_TMC2208) \
|| defined(E0_IS_TMC2208) || defined(E1_IS_TMC2208) || defined(E2_IS_TMC2208) || defined(E3_IS_TMC2208) || defined(E4_IS_TMC2208)
#error "[AXIS]_IS_TMC2208 is now [AXIS]_DRIVER_TYPE TMC2208. Please update your Configuration.h."
#elif defined(X_IS_L6470) || defined(X2_IS_L6470) || defined(Y_IS_L6470) || defined(Y2_IS_L6470) || defined(Z_IS_L6470) || defined(Z2_IS_L6470) \
|| defined(E0_IS_L6470) || defined(E1_IS_L6470) || defined(E2_IS_L6470) || defined(E3_IS_L6470) || defined(E4_IS_L6470)
#error "[AXIS]_IS_L6470 is now [AXIS]_DRIVER_TYPE L6470. Please update your Configuration.h."
#elif defined(AUTOMATIC_CURRENT_CONTROL) #elif defined(AUTOMATIC_CURRENT_CONTROL)
#error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration." #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration."
#elif defined(FILAMENT_CHANGE_LOAD_LENGTH) #elif defined(FILAMENT_CHANGE_LOAD_LENGTH)
@ -974,15 +992,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
*/ */
#if ENABLED(Z_SAFE_HOMING) #if ENABLED(Z_SAFE_HOMING)
#if HAS_BED_PROBE #if HAS_BED_PROBE
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, MIN_PROBE_X, MAX_PROBE_X), static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, MIN_PROBE_X, MAX_PROBE_X), "Z_SAFE_HOMING_X_POINT is outside the probe region.");
"Z_SAFE_HOMING_X_POINT is outside the probe region."); static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, MIN_PROBE_Y, MAX_PROBE_Y), "Z_SAFE_HOMING_Y_POINT is outside the probe region.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, MIN_PROBE_Y, MAX_PROBE_Y),
"Z_SAFE_HOMING_Y_POINT is outside the probe region.");
#else #else
static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS), static_assert(WITHIN(Z_SAFE_HOMING_X_POINT, X_MIN_POS, X_MAX_POS), "Z_SAFE_HOMING_X_POINT can't be reached by the nozzle.");
"Z_SAFE_HOMING_X_POINT can't be reached by the nozzle."); static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS), "Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS),
"Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
#endif #endif
#endif // Z_SAFE_HOMING #endif // Z_SAFE_HOMING
@ -1458,128 +1472,36 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#endif #endif
/** /**
* Make sure HAVE_TMC26X is warranted * Check existing CS pins against enabled TMC SPI drivers.
*/ */
#if ENABLED(HAVE_TMC26X) && !( \ #if AXIS_DRIVER_TYPE(X, TMC2130) && !PIN_EXISTS(X_CS)
ENABLED( X_IS_TMC26X ) \ #error "X_CS_PIN is required for TMC2130. Define X_CS_PIN in Configuration_adv.h."
|| ENABLED( X2_IS_TMC26X ) \ #elif AXIS_DRIVER_TYPE(X2, TMC2130) && !PIN_EXISTS(X2_CS)
|| ENABLED( Y_IS_TMC26X ) \ #error "X2_CS_PIN is required for X2. Define X2_CS_PIN in Configuration_adv.h."
|| ENABLED( Y2_IS_TMC26X ) \ #elif AXIS_DRIVER_TYPE(Y, TMC2130) && !PIN_EXISTS(Y_CS)
|| ENABLED( Z_IS_TMC26X ) \ #error "Y_CS_PIN is required for TMC2130. Define Y_CS_PIN in Configuration_adv.h."
|| ENABLED( Z2_IS_TMC26X ) \ #elif AXIS_DRIVER_TYPE(Y2, TMC2130) && !PIN_EXISTS(Y2_CS)
|| ENABLED( E0_IS_TMC26X ) \ #error "Y2_CS_PIN is required for TMC2130. Define Y2_CS_PIN in Configuration_adv.h."
|| ENABLED( E1_IS_TMC26X ) \ #elif AXIS_DRIVER_TYPE(Z, TMC2130) && !PIN_EXISTS(Z_CS)
|| ENABLED( E2_IS_TMC26X ) \ #error "Z_CS_PIN is required for TMC2130. Define Z_CS_PIN in Configuration_adv.h."
|| ENABLED( E3_IS_TMC26X ) \ #elif AXIS_DRIVER_TYPE(Z2, TMC2130) && !PIN_EXISTS(Z2_CS)
|| ENABLED( E4_IS_TMC26X ) \ #error "Z2_CS_PIN is required for TMC2130. Define Z2_CS_PIN in Configuration_adv.h."
) #elif AXIS_DRIVER_TYPE(E0, TMC2130) && !PIN_EXISTS(E0_CS)
#error "HAVE_TMC26X requires at least one TMC26X stepper to be set." #error "E0_CS_PIN is required for TMC2130. Define E0_CS_PIN in Configuration_adv.h."
#endif #elif AXIS_DRIVER_TYPE(E1, TMC2130) && !PIN_EXISTS(E1_CS)
#error "E1_CS_PIN is required for TMC2130. Define E1_CS_PIN in Configuration_adv.h."
/** #elif AXIS_DRIVER_TYPE(E2, TMC2130) && !PIN_EXISTS(E2_CS)
* Make sure HAVE_TMC2130 is warranted #error "E2_CS_PIN is required for TMC2130. Define E2_CS_PIN in Configuration_adv.h."
*/ #elif AXIS_DRIVER_TYPE(E3, TMC2130) && !PIN_EXISTS(E3_CS)
#if ENABLED(HAVE_TMC2130) #error "E3_CS_PIN is required for TMC2130. Define E3_CS_PIN in Configuration_adv.h."
#if !( ENABLED( X_IS_TMC2130 ) \ #elif AXIS_DRIVER_TYPE(E4, TMC2130) && !PIN_EXISTS(E4_CS)
|| ENABLED( X2_IS_TMC2130 ) \ #error "E4_CS_PIN is required for TMC2130. Define E4_CS_PIN in Configuration_adv.h."
|| ENABLED( Y_IS_TMC2130 ) \
|| ENABLED( Y2_IS_TMC2130 ) \
|| ENABLED( Z_IS_TMC2130 ) \
|| ENABLED( Z2_IS_TMC2130 ) \
|| ENABLED( E0_IS_TMC2130 ) \
|| ENABLED( E1_IS_TMC2130 ) \
|| ENABLED( E2_IS_TMC2130 ) \
|| ENABLED( E3_IS_TMC2130 ) \
|| ENABLED( E4_IS_TMC2130 ) )
#error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set."
#elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif
#if ENABLED(X_IS_TMC2130) && !PIN_EXISTS(X_CS)
#error "X_CS_PIN is required for X_IS_TMC2130. Define X_CS_PIN in Configuration_adv.h."
#elif ENABLED(X2_IS_TMC2130) && !PIN_EXISTS(X2_CS)
#error "X2_CS_PIN is required for X2_IS_TMC2130. Define X2_CS_PIN in Configuration_adv.h."
#elif ENABLED(Y_IS_TMC2130) && !PIN_EXISTS(Y_CS)
#error "Y_CS_PIN is required for Y_IS_TMC2130. Define Y_CS_PIN in Configuration_adv.h."
#elif ENABLED(Y2_IS_TMC2130) && !PIN_EXISTS(Y2_CS)
#error "Y2_CS_PIN is required for Y2_IS_TMC2130. Define Y2_CS_PIN in Configuration_adv.h."
#elif ENABLED(Z_IS_TMC2130) && !PIN_EXISTS(Z_CS)
#error "Z_CS_PIN is required for Z_IS_TMC2130. Define Z_CS_PIN in Configuration_adv.h."
#elif ENABLED(Z2_IS_TMC2130) && !PIN_EXISTS(Z2_CS)
#error "Z2_CS_PIN is required for Z2_IS_TMC2130. Define Z2_CS_PIN in Configuration_adv.h."
#elif ENABLED(E0_IS_TMC2130) && !PIN_EXISTS(E0_CS)
#error "E0_CS_PIN is required for E0_IS_TMC2130. Define E0_CS_PIN in Configuration_adv.h."
#elif ENABLED(E1_IS_TMC2130) && !PIN_EXISTS(E1_CS)
#error "E1_CS_PIN is required for E1_IS_TMC2130. Define E1_CS_PIN in Configuration_adv.h."
#elif ENABLED(E2_IS_TMC2130) && !PIN_EXISTS(E2_CS)
#error "E2_CS_PIN is required for E2_IS_TMC2130. Define E2_CS_PIN in Configuration_adv.h."
#elif ENABLED(E3_IS_TMC2130) && !PIN_EXISTS(E3_CS)
#error "E3_CS_PIN is required for E3_IS_TMC2130. Define E3_CS_PIN in Configuration_adv.h."
#elif ENABLED(E4_IS_TMC2130) && !PIN_EXISTS(E4_CS)
#error "E4_CS_PIN is required for E4_IS_TMC2130. Define E4_CS_PIN in Configuration_adv.h."
#endif
#if ENABLED(SENSORLESS_HOMING)
// Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
// is necessary in order to reset the stallGuard indication between the initial movement of all three
// towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
// clearing the stallGuard activated status is found.
#if ENABLED(DELTA) && !ENABLED(STEALTHCHOP)
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP."
#elif X_SENSORLESS && X_HOME_DIR == -1 && (DISABLED(X_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR == 1 && (DISABLED(X_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (DISABLED(Y_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (DISABLED(Y_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (DISABLED(Z_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENABLED(ENDSTOP_NOISE_FILTER)
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_FILTER."
#endif
#endif
// Sensorless homing is required for both combined steppers in an H-bot
#if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
#error "CoreXY requires both X and Y to use sensorless homing if either does."
#elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS
#error "CoreXZ requires both X and Z to use sensorless homing if either does."
#elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS
#error "CoreYZ requires both Y and Z to use sensorless homing if either does."
#endif
#elif ENABLED(SENSORLESS_HOMING)
#error "SENSORLESS_HOMING requires TMC2130 stepper drivers."
#endif
/**
* Make sure HAVE_TMC2208 is warranted
*/
#if ENABLED(HAVE_TMC2208) && !( \
ENABLED( X_IS_TMC2208 ) \
|| ENABLED( X2_IS_TMC2208 ) \
|| ENABLED( Y_IS_TMC2208 ) \
|| ENABLED( Y2_IS_TMC2208 ) \
|| ENABLED( Z_IS_TMC2208 ) \
|| ENABLED( Z2_IS_TMC2208 ) \
|| ENABLED( E0_IS_TMC2208 ) \
|| ENABLED( E1_IS_TMC2208 ) \
|| ENABLED( E2_IS_TMC2208 ) \
|| ENABLED( E3_IS_TMC2208 ) )
#error "HAVE_TMC2208 requires at least one TMC2208 stepper to be set."
#endif #endif
/** /**
* TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
*/ */
#if ENABLED(HAVE_TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ #if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
defined(X_HARDWARE_SERIAL ) \ defined(X_HARDWARE_SERIAL ) \
|| defined(X2_HARDWARE_SERIAL) \ || defined(X2_HARDWARE_SERIAL) \
|| defined(Y_HARDWARE_SERIAL ) \ || defined(Y_HARDWARE_SERIAL ) \
@ -1594,113 +1516,52 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE." #error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE."
#endif #endif
#if ENABLED(SENSORLESS_HOMING)
// Require STEALTHCHOP for SENSORLESS_HOMING on DELTA as the transition from spreadCycle to stealthChop
// is necessary in order to reset the stallGuard indication between the initial movement of all three
// towers to +Z and the individual homing of each tower. This restriction can be removed once a means of
// clearing the stallGuard activated status is found.
#if ENABLED(DELTA) && !ENABLED(STEALTHCHOP)
#error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP."
#elif X_SENSORLESS && X_HOME_DIR == -1 && (DISABLED(X_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMIN))
#error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
#elif X_SENSORLESS && X_HOME_DIR == 1 && (DISABLED(X_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMAX))
#error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
#elif Y_SENSORLESS && Y_HOME_DIR == -1 && (DISABLED(Y_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMIN))
#error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
#elif Y_SENSORLESS && Y_HOME_DIR == 1 && (DISABLED(Y_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMAX))
#error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
#elif Z_SENSORLESS && Z_HOME_DIR == -1 && (DISABLED(Z_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMIN))
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENABLED(ENDSTOP_NOISE_FILTER)
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_FILTER."
#endif
#endif
// Sensorless homing is required for both combined steppers in an H-bot
#if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
#error "CoreXY requires both X and Y to use sensorless homing if either does."
#elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS
#error "CoreXZ requires both X and Z to use sensorless homing if either does."
#elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS
#error "CoreYZ requires both Y and Z to use sensorless homing if either does."
#endif
#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP)
#error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD."
#endif #endif
#if ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2)
#if ENABLED(TMC_Z_CALIBRATION) && !Z_IS_TRINAMIC && !Z2_IS_TRINAMIC
#error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis" #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis"
#endif #endif
/** #if ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD
* Make sure HAVE_L6470DRIVER is warranted #error "SENSORLESS_HOMING requires TMC2130 or TMC2660 stepper drivers."
*/
#if ENABLED(HAVE_L6470DRIVER) && !( \
ENABLED( X_IS_L6470 ) \
|| ENABLED( X2_IS_L6470 ) \
|| ENABLED( Y_IS_L6470 ) \
|| ENABLED( Y2_IS_L6470 ) \
|| ENABLED( Z_IS_L6470 ) \
|| ENABLED( Z2_IS_L6470 ) \
|| ENABLED( E0_IS_L6470 ) \
|| ENABLED( E1_IS_L6470 ) \
|| ENABLED( E2_IS_L6470 ) \
|| ENABLED( E3_IS_L6470 ) \
|| ENABLED( E4_IS_L6470 ) \
)
#error "HAVE_L6470DRIVER requires at least one L6470 stepper to be set."
#endif
/**
* Check that each axis has only one driver selected
*/
#if 1 < 0 \
+ ENABLED(X_IS_TMC26X) \
+ ENABLED(X_IS_TMC2130) \
+ ENABLED(X_IS_TMC2208) \
+ ENABLED(X_IS_L6470)
#error "Please enable only one stepper driver for the X axis."
#endif
#if 1 < 0 \
+ ENABLED(X2_IS_TMC26X) \
+ ENABLED(X2_IS_TMC2130) \
+ ENABLED(X2_IS_TMC2208) \
+ ENABLED(X2_IS_L6470)
#error "Please enable only one stepper driver for the X2 axis."
#endif
#if 1 < 0 \
+ ENABLED(Y_IS_TMC26X) \
+ ENABLED(Y_IS_TMC2130) \
+ ENABLED(Y_IS_TMC2208) \
+ ENABLED(Y_IS_L6470)
#error "Please enable only one stepper driver for the Y axis."
#endif
#if 1 < 0 \
+ ENABLED(Y2_IS_TMC26X) \
+ ENABLED(Y2_IS_TMC2130) \
+ ENABLED(Y2_IS_TMC2208) \
+ ENABLED(Y2_IS_L6470)
#error "Please enable only one stepper driver for the Y2 axis."
#endif
#if 1 < 0 \
+ ENABLED(Z_IS_TMC26X) \
+ ENABLED(Z_IS_TMC2130) \
+ ENABLED(Z_IS_TMC2208) \
+ ENABLED(Z_IS_L6470)
#error "Please enable only one stepper driver for the Z axis."
#endif
#if 1 < 0 \
+ ENABLED(Z2_IS_TMC26X) \
+ ENABLED(Z2_IS_TMC2130) \
+ ENABLED(Z2_IS_TMC2208) \
+ ENABLED(Z2_IS_L6470)
#error "Please enable only one stepper driver for the Z2 axis."
#endif
#if 1 < 0 \
+ ENABLED(E0_IS_TMC26X) \
+ ENABLED(E0_IS_TMC2130) \
+ ENABLED(E0_IS_TMC2208) \
+ ENABLED(E0_IS_L6470)
#error "Please enable only one stepper driver for the E0 axis."
#endif
#if 1 < 0 \
+ ENABLED(E1_IS_TMC26X) \
+ ENABLED(E1_IS_TMC2130) \
+ ENABLED(E1_IS_TMC2208) \
+ ENABLED(E1_IS_L6470)
#error "Please enable only one stepper driver for the E1 axis."
#endif
#if 1 < 0 \
+ ENABLED(E2_IS_TMC26X) \
+ ENABLED(E2_IS_TMC2130) \
+ ENABLED(E2_IS_TMC2208) \
+ ENABLED(E2_IS_L6470)
#error "Please enable only one stepper driver for the E2 axis."
#endif
#if 1 < 0 \
+ ENABLED(E3_IS_TMC26X) \
+ ENABLED(E3_IS_TMC2130) \
+ ENABLED(E3_IS_TMC2208) \
+ ENABLED(E3_IS_L6470)
#error "Please enable only one stepper driver for the E3 axis."
#endif
#if 1 < 0 \
+ ENABLED(E4_IS_TMC26X) \
+ ENABLED(E4_IS_TMC2130) \
+ ENABLED(E4_IS_TMC2208) \
+ ENABLED(E4_IS_L6470)
#error "Please enable only one stepper driver for the E4 axis."
#endif #endif
#if ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP
#error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers."
#endif
/** /**
* Digipot requirement * Digipot requirement

View file

@ -681,57 +681,57 @@ void MarlinSettings::postprocess() {
uint16_t tmc_stepper_current[TMC_AXES] = { uint16_t tmc_stepper_current[TMC_AXES] = {
#if HAS_TRINAMIC #if HAS_TRINAMIC
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
stepperX.getCurrent(), stepperX.getCurrent(),
#else #else
0, 0,
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
stepperY.getCurrent(), stepperY.getCurrent(),
#else #else
0, 0,
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
stepperZ.getCurrent(), stepperZ.getCurrent(),
#else #else
0, 0,
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
stepperX2.getCurrent(), stepperX2.getCurrent(),
#else #else
0, 0,
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
stepperY2.getCurrent(), stepperY2.getCurrent(),
#else #else
0, 0,
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
stepperZ2.getCurrent(), stepperZ2.getCurrent(),
#else #else
0, 0,
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
stepperE0.getCurrent(), stepperE0.getCurrent(),
#else #else
0, 0,
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
stepperE1.getCurrent(), stepperE1.getCurrent(),
#else #else
0, 0,
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
stepperE2.getCurrent(), stepperE2.getCurrent(),
#else #else
0, 0,
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
stepperE3.getCurrent(), stepperE3.getCurrent(),
#else #else
0, 0,
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
stepperE4.getCurrent() stepperE4.getCurrent()
#else #else
0 0
@ -750,57 +750,57 @@ void MarlinSettings::postprocess() {
uint32_t tmc_hybrid_threshold[TMC_AXES] = { uint32_t tmc_hybrid_threshold[TMC_AXES] = {
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
#if X_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X)
TMC_GET_PWMTHRS(X, X), TMC_GET_PWMTHRS(X, X),
#else #else
X_HYBRID_THRESHOLD, X_HYBRID_THRESHOLD,
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y)
TMC_GET_PWMTHRS(Y, Y), TMC_GET_PWMTHRS(Y, Y),
#else #else
Y_HYBRID_THRESHOLD, Y_HYBRID_THRESHOLD,
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z)
TMC_GET_PWMTHRS(Z, Z), TMC_GET_PWMTHRS(Z, Z),
#else #else
Z_HYBRID_THRESHOLD, Z_HYBRID_THRESHOLD,
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X2)
TMC_GET_PWMTHRS(X, X2), TMC_GET_PWMTHRS(X, X2),
#else #else
X2_HYBRID_THRESHOLD, X2_HYBRID_THRESHOLD,
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y2)
TMC_GET_PWMTHRS(Y, Y2), TMC_GET_PWMTHRS(Y, Y2),
#else #else
Y2_HYBRID_THRESHOLD, Y2_HYBRID_THRESHOLD,
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z2)
TMC_GET_PWMTHRS(Z, Z2), TMC_GET_PWMTHRS(Z, Z2),
#else #else
Z2_HYBRID_THRESHOLD, Z2_HYBRID_THRESHOLD,
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E0)
TMC_GET_PWMTHRS(E, E0), TMC_GET_PWMTHRS(E, E0),
#else #else
E0_HYBRID_THRESHOLD, E0_HYBRID_THRESHOLD,
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E1)
TMC_GET_PWMTHRS(E, E1), TMC_GET_PWMTHRS(E, E1),
#else #else
E1_HYBRID_THRESHOLD, E1_HYBRID_THRESHOLD,
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E2)
TMC_GET_PWMTHRS(E, E2), TMC_GET_PWMTHRS(E, E2),
#else #else
E2_HYBRID_THRESHOLD, E2_HYBRID_THRESHOLD,
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E3)
TMC_GET_PWMTHRS(E, E3), TMC_GET_PWMTHRS(E, E3),
#else #else
E3_HYBRID_THRESHOLD, E3_HYBRID_THRESHOLD,
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E4)
TMC_GET_PWMTHRS(E, E4) TMC_GET_PWMTHRS(E, E4)
#else #else
E4_HYBRID_THRESHOLD E4_HYBRID_THRESHOLD
@ -818,17 +818,17 @@ void MarlinSettings::postprocess() {
// //
int16_t tmc_sgt[XYZ] = { int16_t tmc_sgt[XYZ] = {
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#if defined(X_HOMING_SENSITIVITY) && (ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)) #if X_SENSORLESS
stepperX.sgt(), stepperX.sgt(),
#else #else
0, 0,
#endif #endif
#if defined(Y_HOMING_SENSITIVITY) && (ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)) #if Y_SENSORLESS
stepperY.sgt(), stepperY.sgt(),
#else #else
0, 0,
#endif #endif
#if defined(Z_HOMING_SENSITIVITY) && (ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)) #if Z_SENSORLESS
stepperZ.sgt() stepperZ.sgt()
#else #else
0 0
@ -1311,37 +1311,37 @@ void MarlinSettings::postprocess() {
uint16_t currents[TMC_AXES]; uint16_t currents[TMC_AXES];
EEPROM_READ(currents); EEPROM_READ(currents);
if (!validating) { if (!validating) {
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
SET_CURR(X); SET_CURR(X);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
SET_CURR(Y); SET_CURR(Y);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
SET_CURR(Z); SET_CURR(Z);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
SET_CURR(X2); SET_CURR(X2);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
SET_CURR(Y2); SET_CURR(Y2);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
SET_CURR(Z2); SET_CURR(Z2);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
SET_CURR(E0); SET_CURR(E0);
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
SET_CURR(E1); SET_CURR(E1);
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
SET_CURR(E2); SET_CURR(E2);
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
SET_CURR(E3); SET_CURR(E3);
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
SET_CURR(E4); SET_CURR(E4);
#endif #endif
} }
@ -1355,37 +1355,37 @@ void MarlinSettings::postprocess() {
uint32_t tmc_hybrid_threshold[TMC_AXES]; uint32_t tmc_hybrid_threshold[TMC_AXES];
EEPROM_READ(tmc_hybrid_threshold); EEPROM_READ(tmc_hybrid_threshold);
if (!validating) { if (!validating) {
#if X_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X)
TMC_SET_PWMTHRS(X, X); TMC_SET_PWMTHRS(X, X);
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y)
TMC_SET_PWMTHRS(Y, Y); TMC_SET_PWMTHRS(Y, Y);
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z)
TMC_SET_PWMTHRS(Z, Z); TMC_SET_PWMTHRS(Z, Z);
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(X2)
TMC_SET_PWMTHRS(X, X2); TMC_SET_PWMTHRS(X, X2);
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Y2)
TMC_SET_PWMTHRS(Y, Y2); TMC_SET_PWMTHRS(Y, Y2);
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(Z2)
TMC_SET_PWMTHRS(Z, Z2); TMC_SET_PWMTHRS(Z, Z2);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E0)
TMC_SET_PWMTHRS(E, E0); TMC_SET_PWMTHRS(E, E0);
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E1)
TMC_SET_PWMTHRS(E, E1); TMC_SET_PWMTHRS(E, E1);
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E2)
TMC_SET_PWMTHRS(E, E2); TMC_SET_PWMTHRS(E, E2);
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E3)
TMC_SET_PWMTHRS(E, E3); TMC_SET_PWMTHRS(E, E3);
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_HAS_STEALTHCHOP(E4)
TMC_SET_PWMTHRS(E, E4); TMC_SET_PWMTHRS(E, E4);
#endif #endif
} }
@ -1405,26 +1405,26 @@ void MarlinSettings::postprocess() {
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
if (!validating) { if (!validating) {
#ifdef X_HOMING_SENSITIVITY #ifdef X_HOMING_SENSITIVITY
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(X)
stepperX.sgt(tmc_sgt[0]); stepperX.sgt(tmc_sgt[0]);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(X2)
stepperX2.sgt(tmc_sgt[0]); stepperX2.sgt(tmc_sgt[0]);
#endif #endif
#endif #endif
#ifdef Y_HOMING_SENSITIVITY #ifdef Y_HOMING_SENSITIVITY
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Y)
stepperY.sgt(tmc_sgt[1]); stepperY.sgt(tmc_sgt[1]);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Y2)
stepperY2.sgt(tmc_sgt[1]); stepperY2.sgt(tmc_sgt[1]);
#endif #endif
#endif #endif
#ifdef Z_HOMING_SENSITIVITY #ifdef Z_HOMING_SENSITIVITY
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_HAS_STALLGUARD(Z)
stepperZ.sgt(tmc_sgt[2]); stepperZ.sgt(tmc_sgt[2]);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_HAS_STALLGUARD(Z2)
stepperZ2.sgt(tmc_sgt[2]); stepperZ2.sgt(tmc_sgt[2]);
#endif #endif
#endif #endif
@ -2445,61 +2445,61 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#if HAS_TRINAMIC #if HAS_TRINAMIC
/** /**
* TMC2130 / TMC2208 / TRAMS stepper driver current * TMC2130 / TMC2208 stepper driver current
*/ */
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
#endif #endif
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent()); SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent());
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent()); SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent());
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent()); SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent());
#endif #endif
#if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1"); SERIAL_ECHOPGM_P(port, " I1");
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent()); SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent());
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent()); SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent());
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent()); SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent());
#endif #endif
#if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getCurrent()); SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getCurrent());
#endif #endif
#if E_STEPPERS > 1 && E1_IS_TRINAMIC #if E_STEPPERS > 1 && AXIS_IS_TMC(E1)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getCurrent()); SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getCurrent());
#endif #endif
#if E_STEPPERS > 2 && E2_IS_TRINAMIC #if E_STEPPERS > 2 && AXIS_IS_TMC(E2)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getCurrent()); SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getCurrent());
#endif #endif
#if E_STEPPERS > 3 && E3_IS_TRINAMIC #if E_STEPPERS > 3 && AXIS_IS_TMC(E3)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getCurrent()); SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getCurrent());
#endif #endif
#if E_STEPPERS > 4 && E4_IS_TRINAMIC #if E_STEPPERS > 4 && AXIS_IS_TMC(E4)
say_M906(PORTVAR_SOLO); say_M906(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getCurrent()); SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getCurrent());
#endif #endif
@ -2514,54 +2514,54 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:"); SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
#endif #endif
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X)); SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X));
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y)); SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y));
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z)); SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z));
#endif #endif
#if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1"); SERIAL_ECHOPGM_P(port, " I1");
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2)); SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2));
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2)); SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2));
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2)); SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2));
#endif #endif
#if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2)
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0)); SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0));
#endif #endif
#if E_STEPPERS > 1 && E1_IS_TRINAMIC #if E_STEPPERS > 1 && AXIS_IS_TMC(E1)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1)); SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1));
#endif #endif
#if E_STEPPERS > 2 && E2_IS_TRINAMIC #if E_STEPPERS > 2 && AXIS_IS_TMC(E2)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2)); SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2));
#endif #endif
#if E_STEPPERS > 3 && E3_IS_TRINAMIC #if E_STEPPERS > 3 && AXIS_IS_TMC(E3)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3)); SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3));
#endif #endif
#if E_STEPPERS > 4 && E4_IS_TRINAMIC #if E_STEPPERS > 4 && AXIS_IS_TMC(E4)
say_M913(PORTVAR_SOLO); say_M913(PORTVAR_SOLO);
SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4)); SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4));
#endif #endif
@ -2577,26 +2577,23 @@ void MarlinSettings::reset(PORTARG_SOLO) {
SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
#define HAS_X_SENSORLESS (defined(X_HOMING_SENSITIVITY) && (ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS))) #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
#define HAS_Y_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && (ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)))
#define HAS_Z_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && (ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)))
#if HAS_X_SENSORLESS || HAS_Y_SENSORLESS || HAS_Z_SENSORLESS
say_M914(PORTVAR_SOLO); say_M914(PORTVAR_SOLO);
#if HAS_X_SENSORLESS #if X_SENSORLESS
SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt());
#endif #endif
#if HAS_Y_SENSORLESS #if Y_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt()); SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt());
#endif #endif
#if HAS_Z_SENSORLESS #if Z_SENSORLESS
SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt()); SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt());
#endif #endif
SERIAL_EOL_P(port); SERIAL_EOL_P(port);
#endif #endif
#define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && ENABLED(X2_IS_TMC2130)) #define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2))
#define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && ENABLED(Y2_IS_TMC2130)) #define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2))
#define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && ENABLED(Z2_IS_TMC2130)) #define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2))
#if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS
say_M914(PORTVAR_SOLO); say_M914(PORTVAR_SOLO);
SERIAL_ECHOPGM_P(port, " I1"); SERIAL_ECHOPGM_P(port, " I1");

View file

@ -38,7 +38,7 @@
// //
// TMC26X Driver objects and inits // TMC26X Driver objects and inits
// //
#if ENABLED(HAVE_TMC26X) #if HAS_DRIVER(TMC26X)
#include <SPI.h> #include <SPI.h>
#ifdef STM32F7 #ifdef STM32F7
@ -49,37 +49,37 @@
#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR) #define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
#if ENABLED(X_IS_TMC26X) #if AXIS_DRIVER_TYPE(X, TMC26X)
_TMC26X_DEFINE(X); _TMC26X_DEFINE(X);
#endif #endif
#if ENABLED(X2_IS_TMC26X) #if AXIS_DRIVER_TYPE(X2, TMC26X)
_TMC26X_DEFINE(X2); _TMC26X_DEFINE(X2);
#endif #endif
#if ENABLED(Y_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y, TMC26X)
_TMC26X_DEFINE(Y); _TMC26X_DEFINE(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y2, TMC26X)
_TMC26X_DEFINE(Y2); _TMC26X_DEFINE(Y2);
#endif #endif
#if ENABLED(Z_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z, TMC26X)
_TMC26X_DEFINE(Z); _TMC26X_DEFINE(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z2, TMC26X)
_TMC26X_DEFINE(Z2); _TMC26X_DEFINE(Z2);
#endif #endif
#if ENABLED(E0_IS_TMC26X) #if AXIS_DRIVER_TYPE(E0, TMC26X)
_TMC26X_DEFINE(E0); _TMC26X_DEFINE(E0);
#endif #endif
#if ENABLED(E1_IS_TMC26X) #if AXIS_DRIVER_TYPE(E1, TMC26X)
_TMC26X_DEFINE(E1); _TMC26X_DEFINE(E1);
#endif #endif
#if ENABLED(E2_IS_TMC26X) #if AXIS_DRIVER_TYPE(E2, TMC26X)
_TMC26X_DEFINE(E2); _TMC26X_DEFINE(E2);
#endif #endif
#if ENABLED(E3_IS_TMC26X) #if AXIS_DRIVER_TYPE(E3, TMC26X)
_TMC26X_DEFINE(E3); _TMC26X_DEFINE(E3);
#endif #endif
#if ENABLED(E4_IS_TMC26X) #if AXIS_DRIVER_TYPE(E4, TMC26X)
_TMC26X_DEFINE(E4); _TMC26X_DEFINE(E4);
#endif #endif
@ -89,46 +89,46 @@
}while(0) }while(0)
void tmc26x_init_to_defaults() { void tmc26x_init_to_defaults() {
#if ENABLED(X_IS_TMC26X) #if AXIS_DRIVER_TYPE(X, TMC26X)
_TMC26X_INIT(X); _TMC26X_INIT(X);
#endif #endif
#if ENABLED(X2_IS_TMC26X) #if AXIS_DRIVER_TYPE(X2, TMC26X)
_TMC26X_INIT(X2); _TMC26X_INIT(X2);
#endif #endif
#if ENABLED(Y_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y, TMC26X)
_TMC26X_INIT(Y); _TMC26X_INIT(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y2, TMC26X)
_TMC26X_INIT(Y2); _TMC26X_INIT(Y2);
#endif #endif
#if ENABLED(Z_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z, TMC26X)
_TMC26X_INIT(Z); _TMC26X_INIT(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z2, TMC26X)
_TMC26X_INIT(Z2); _TMC26X_INIT(Z2);
#endif #endif
#if ENABLED(E0_IS_TMC26X) #if AXIS_DRIVER_TYPE(E0, TMC26X)
_TMC26X_INIT(E0); _TMC26X_INIT(E0);
#endif #endif
#if ENABLED(E1_IS_TMC26X) #if AXIS_DRIVER_TYPE(E1, TMC26X)
_TMC26X_INIT(E1); _TMC26X_INIT(E1);
#endif #endif
#if ENABLED(E2_IS_TMC26X) #if AXIS_DRIVER_TYPE(E2, TMC26X)
_TMC26X_INIT(E2); _TMC26X_INIT(E2);
#endif #endif
#if ENABLED(E3_IS_TMC26X) #if AXIS_DRIVER_TYPE(E3, TMC26X)
_TMC26X_INIT(E3); _TMC26X_INIT(E3);
#endif #endif
#if ENABLED(E4_IS_TMC26X) #if AXIS_DRIVER_TYPE(E4, TMC26X)
_TMC26X_INIT(E4); _TMC26X_INIT(E4);
#endif #endif
} }
#endif // HAVE_TMC26X #endif // TMC26X
// //
// TMC2130 Driver objects and inits // TMC2130 Driver objects and inits
// //
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
#include <SPI.h> #include <SPI.h>
#include <TMC2130Stepper.h> #include <TMC2130Stepper.h>
@ -146,37 +146,37 @@
#endif #endif
// Stepper objects of TMC2130 steppers used // Stepper objects of TMC2130 steppers used
#if ENABLED(X_IS_TMC2130) #if AXIS_DRIVER_TYPE(X, TMC2130)
_TMC2130_DEFINE(X); _TMC2130_DEFINE(X);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
_TMC2130_DEFINE(X2); _TMC2130_DEFINE(X2);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y, TMC2130)
_TMC2130_DEFINE(Y); _TMC2130_DEFINE(Y);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
_TMC2130_DEFINE(Y2); _TMC2130_DEFINE(Y2);
#endif #endif
#if ENABLED(Z_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z, TMC2130)
_TMC2130_DEFINE(Z); _TMC2130_DEFINE(Z);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
_TMC2130_DEFINE(Z2); _TMC2130_DEFINE(Z2);
#endif #endif
#if ENABLED(E0_IS_TMC2130) #if AXIS_DRIVER_TYPE(E0, TMC2130)
_TMC2130_DEFINE(E0); _TMC2130_DEFINE(E0);
#endif #endif
#if ENABLED(E1_IS_TMC2130) #if AXIS_DRIVER_TYPE(E1, TMC2130)
_TMC2130_DEFINE(E1); _TMC2130_DEFINE(E1);
#endif #endif
#if ENABLED(E2_IS_TMC2130) #if AXIS_DRIVER_TYPE(E2, TMC2130)
_TMC2130_DEFINE(E2); _TMC2130_DEFINE(E2);
#endif #endif
#if ENABLED(E3_IS_TMC2130) #if AXIS_DRIVER_TYPE(E3, TMC2130)
_TMC2130_DEFINE(E3); _TMC2130_DEFINE(E3);
#endif #endif
#if ENABLED(E4_IS_TMC2130) #if AXIS_DRIVER_TYPE(E4, TMC2130)
_TMC2130_DEFINE(E4); _TMC2130_DEFINE(E4);
#endif #endif
@ -213,74 +213,74 @@
#define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_CURRENT, 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_to_defaults() { void tmc2130_init_to_defaults() {
#if ENABLED(X_IS_TMC2130) #if AXIS_DRIVER_TYPE(X, TMC2130)
_TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]); _TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
_TMC2130_INIT(X2, planner.axis_steps_per_mm[X_AXIS]); _TMC2130_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if ENABLED(Y_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y, TMC2130)
_TMC2130_INIT( Y, planner.axis_steps_per_mm[Y_AXIS]); _TMC2130_INIT( Y, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
_TMC2130_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]); _TMC2130_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if ENABLED(Z_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z, TMC2130)
_TMC2130_INIT( Z, planner.axis_steps_per_mm[Z_AXIS]); _TMC2130_INIT( Z, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
_TMC2130_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]); _TMC2130_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(E0_IS_TMC2130) #if AXIS_DRIVER_TYPE(E0, TMC2130)
_TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]); _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
#endif #endif
#if ENABLED(E1_IS_TMC2130) #if AXIS_DRIVER_TYPE(E1, TMC2130)
{ constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E2_IS_TMC2130) #if AXIS_DRIVER_TYPE(E2, TMC2130)
{ constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E3_IS_TMC2130) #if AXIS_DRIVER_TYPE(E3, TMC2130)
{ constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E4_IS_TMC2130) #if AXIS_DRIVER_TYPE(E4, TMC2130)
{ constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(SENSORLESS_HOMING) #if ENABLED(SENSORLESS_HOMING)
#define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY); #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY);
#if X_SENSORLESS #if X_SENSORLESS
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_DRIVER_TYPE(X, TMC2130)
stepperX.sgt(X_HOMING_SENSITIVITY); stepperX.sgt(X_HOMING_SENSITIVITY);
#endif #endif
#if ENABLED(X2_IS_TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
stepperX2.sgt(X_HOMING_SENSITIVITY); stepperX2.sgt(X_HOMING_SENSITIVITY);
#endif #endif
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
#if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_DRIVER_TYPE(Y, TMC2130)
stepperY.sgt(Y_HOMING_SENSITIVITY); stepperY.sgt(Y_HOMING_SENSITIVITY);
#endif #endif
#if ENABLED(Y2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
stepperY2.sgt(Y_HOMING_SENSITIVITY); stepperY2.sgt(Y_HOMING_SENSITIVITY);
#endif #endif
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS
#if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS) #if AXIS_DRIVER_TYPE(Z, TMC2130)
stepperZ.sgt(Z_HOMING_SENSITIVITY); stepperZ.sgt(Z_HOMING_SENSITIVITY);
#endif #endif
#if ENABLED(Z2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
stepperZ2.sgt(Z_HOMING_SENSITIVITY); stepperZ2.sgt(Z_HOMING_SENSITIVITY);
#endif #endif
#endif #endif
#endif #endif
} }
#endif // HAVE_TMC2130 #endif // TMC2130
// //
// TMC2208 Driver objects and inits // TMC2208 Driver objects and inits
// //
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
#include <SoftwareSerial.h> #include <SoftwareSerial.h>
#include <HardwareSerial.h> #include <HardwareSerial.h>
@ -296,77 +296,77 @@
TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL, ST##_SERIAL_RX_PIN > -1) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL, ST##_SERIAL_RX_PIN > -1)
// Stepper objects of TMC2208 steppers used // Stepper objects of TMC2208 steppers used
#if ENABLED(X_IS_TMC2208) #if AXIS_DRIVER_TYPE(X, TMC2208)
#ifdef X_HARDWARE_SERIAL #ifdef X_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(X); _TMC2208_DEFINE_HARDWARE(X);
#else #else
_TMC2208_DEFINE_SOFTWARE(X); _TMC2208_DEFINE_SOFTWARE(X);
#endif #endif
#endif #endif
#if ENABLED(X2_IS_TMC2208) #if AXIS_DRIVER_TYPE(X2, TMC2208)
#ifdef X2_HARDWARE_SERIAL #ifdef X2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(X2); _TMC2208_DEFINE_HARDWARE(X2);
#else #else
_TMC2208_DEFINE_SOFTWARE(X2); _TMC2208_DEFINE_SOFTWARE(X2);
#endif #endif
#endif #endif
#if ENABLED(Y_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y, TMC2208)
#ifdef Y_HARDWARE_SERIAL #ifdef Y_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Y); _TMC2208_DEFINE_HARDWARE(Y);
#else #else
_TMC2208_DEFINE_SOFTWARE(Y); _TMC2208_DEFINE_SOFTWARE(Y);
#endif #endif
#endif #endif
#if ENABLED(Y2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y2, TMC2208)
#ifdef Y2_HARDWARE_SERIAL #ifdef Y2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Y2); _TMC2208_DEFINE_HARDWARE(Y2);
#else #else
_TMC2208_DEFINE_SOFTWARE(Y2); _TMC2208_DEFINE_SOFTWARE(Y2);
#endif #endif
#endif #endif
#if ENABLED(Z_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z, TMC2208)
#ifdef Z_HARDWARE_SERIAL #ifdef Z_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Z); _TMC2208_DEFINE_HARDWARE(Z);
#else #else
_TMC2208_DEFINE_SOFTWARE(Z); _TMC2208_DEFINE_SOFTWARE(Z);
#endif #endif
#endif #endif
#if ENABLED(Z2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z2, TMC2208)
#ifdef Z2_HARDWARE_SERIAL #ifdef Z2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Z2); _TMC2208_DEFINE_HARDWARE(Z2);
#else #else
_TMC2208_DEFINE_SOFTWARE(Z2); _TMC2208_DEFINE_SOFTWARE(Z2);
#endif #endif
#endif #endif
#if ENABLED(E0_IS_TMC2208) #if AXIS_DRIVER_TYPE(E0, TMC2208)
#ifdef E0_HARDWARE_SERIAL #ifdef E0_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E0); _TMC2208_DEFINE_HARDWARE(E0);
#else #else
_TMC2208_DEFINE_SOFTWARE(E0); _TMC2208_DEFINE_SOFTWARE(E0);
#endif #endif
#endif #endif
#if ENABLED(E1_IS_TMC2208) #if AXIS_DRIVER_TYPE(E1, TMC2208)
#ifdef E1_HARDWARE_SERIAL #ifdef E1_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E1); _TMC2208_DEFINE_HARDWARE(E1);
#else #else
_TMC2208_DEFINE_SOFTWARE(E1); _TMC2208_DEFINE_SOFTWARE(E1);
#endif #endif
#endif #endif
#if ENABLED(E2_IS_TMC2208) #if AXIS_DRIVER_TYPE(E2, TMC2208)
#ifdef E2_HARDWARE_SERIAL #ifdef E2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E2); _TMC2208_DEFINE_HARDWARE(E2);
#else #else
_TMC2208_DEFINE_SOFTWARE(E2); _TMC2208_DEFINE_SOFTWARE(E2);
#endif #endif
#endif #endif
#if ENABLED(E3_IS_TMC2208) #if AXIS_DRIVER_TYPE(E3, TMC2208)
#ifdef E3_HARDWARE_SERIAL #ifdef E3_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E3); _TMC2208_DEFINE_HARDWARE(E3);
#else #else
_TMC2208_DEFINE_SOFTWARE(E3); _TMC2208_DEFINE_SOFTWARE(E3);
#endif #endif
#endif #endif
#if ENABLED(E4_IS_TMC2208) #if AXIS_DRIVER_TYPE(E4, TMC2208)
#ifdef E4_HARDWARE_SERIAL #ifdef E4_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E4); _TMC2208_DEFINE_HARDWARE(E4);
#else #else
@ -375,37 +375,37 @@
#endif #endif
void tmc2208_serial_begin() { void tmc2208_serial_begin() {
#if ENABLED(X_IS_TMC2208) #if AXIS_DRIVER_TYPE(X, TMC2208)
X_HARDWARE_SERIAL.begin(115200); X_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(X2_IS_TMC2208) #if AXIS_DRIVER_TYPE(X2, TMC2208)
X2_HARDWARE_SERIAL.begin(115200); X2_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(Y_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y, TMC2208)
Y_HARDWARE_SERIAL.begin(115200); Y_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(Y2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y2, TMC2208)
Y2_HARDWARE_SERIAL.begin(115200); Y2_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(Z_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z, TMC2208)
Z_HARDWARE_SERIAL.begin(115200); Z_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(Z2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z2, TMC2208)
Z2_HARDWARE_SERIAL.begin(115200); Z2_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(E0_IS_TMC2208) #if AXIS_DRIVER_TYPE(E0, TMC2208)
E0_HARDWARE_SERIAL.begin(115200); E0_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(E1_IS_TMC2208) #if AXIS_DRIVER_TYPE(E1, TMC2208)
E1_HARDWARE_SERIAL.begin(115200); E1_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(E2_IS_TMC2208) #if AXIS_DRIVER_TYPE(E2, TMC2208)
E2_HARDWARE_SERIAL.begin(115200); E2_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(E3_IS_TMC2208) #if AXIS_DRIVER_TYPE(E3, TMC2208)
E3_HARDWARE_SERIAL.begin(115200); E3_HARDWARE_SERIAL.begin(115200);
#endif #endif
#if ENABLED(E4_IS_TMC2208) #if AXIS_DRIVER_TYPE(E4, TMC2208)
E4_HARDWARE_SERIAL.begin(115200); E4_HARDWARE_SERIAL.begin(115200);
#endif #endif
} }
@ -449,94 +449,94 @@
#define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_CURRENT, 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_to_defaults() { void tmc2208_init_to_defaults() {
#if ENABLED(X_IS_TMC2208) #if AXIS_DRIVER_TYPE(X, TMC2208)
_TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]); _TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if ENABLED(X2_IS_TMC2208) #if AXIS_DRIVER_TYPE(X2, TMC2208)
_TMC2208_INIT(X2, planner.axis_steps_per_mm[X_AXIS]); _TMC2208_INIT(X2, planner.axis_steps_per_mm[X_AXIS]);
#endif #endif
#if ENABLED(Y_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y, TMC2208)
_TMC2208_INIT(Y, planner.axis_steps_per_mm[Y_AXIS]); _TMC2208_INIT(Y, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if ENABLED(Y2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Y2, TMC2208)
_TMC2208_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]); _TMC2208_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]);
#endif #endif
#if ENABLED(Z_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z, TMC2208)
_TMC2208_INIT(Z, planner.axis_steps_per_mm[Z_AXIS]); _TMC2208_INIT(Z, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(Z2_IS_TMC2208) #if AXIS_DRIVER_TYPE(Z2, TMC2208)
_TMC2208_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]); _TMC2208_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]);
#endif #endif
#if ENABLED(E0_IS_TMC2208) #if AXIS_DRIVER_TYPE(E0, TMC2208)
_TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]); _TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
#endif #endif
#if ENABLED(E1_IS_TMC2208) #if AXIS_DRIVER_TYPE(E1, TMC2208)
{ constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E2_IS_TMC2208) #if AXIS_DRIVER_TYPE(E2, TMC2208)
{ constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E3_IS_TMC2208) #if AXIS_DRIVER_TYPE(E3, TMC2208)
{ constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
#if ENABLED(E4_IS_TMC2208) #if AXIS_DRIVER_TYPE(E4, TMC2208)
{ constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); } { constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
#endif #endif
} }
#endif // HAVE_TMC2208 #endif // TMC2208
void restore_stepper_drivers() { void restore_stepper_drivers() {
#if X_IS_TRINAMIC #if AXIS_IS_TMC(X)
stepperX.push(); stepperX.push();
#endif #endif
#if X2_IS_TRINAMIC #if AXIS_IS_TMC(X2)
stepperX2.push(); stepperX2.push();
#endif #endif
#if Y_IS_TRINAMIC #if AXIS_IS_TMC(Y)
stepperY.push(); stepperY.push();
#endif #endif
#if Y2_IS_TRINAMIC #if AXIS_IS_TMC(Y2)
stepperY2.push(); stepperY2.push();
#endif #endif
#if Z_IS_TRINAMIC #if AXIS_IS_TMC(Z)
stepperZ.push(); stepperZ.push();
#endif #endif
#if Z2_IS_TRINAMIC #if AXIS_IS_TMC(Z2)
stepperZ2.push(); stepperZ2.push();
#endif #endif
#if E0_IS_TRINAMIC #if AXIS_IS_TMC(E0)
stepperE0.push(); stepperE0.push();
#endif #endif
#if E1_IS_TRINAMIC #if AXIS_IS_TMC(E1)
stepperE1.push(); stepperE1.push();
#endif #endif
#if E2_IS_TRINAMIC #if AXIS_IS_TMC(E2)
stepperE2.push(); stepperE2.push();
#endif #endif
#if E3_IS_TRINAMIC #if AXIS_IS_TMC(E3)
stepperE3.push(); stepperE3.push();
#endif #endif
#if E4_IS_TRINAMIC #if AXIS_IS_TMC(E4)
stepperE4.push(); stepperE4.push();
#endif #endif
} }
void reset_stepper_drivers() { void reset_stepper_drivers() {
#if ENABLED(HAVE_TMC26X) #if HAS_DRIVER(TMC26X)
tmc26x_init_to_defaults(); tmc26x_init_to_defaults();
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
delay(100); delay(100);
tmc2130_init_to_defaults(); tmc2130_init_to_defaults();
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
delay(100); delay(100);
tmc2208_init_to_defaults(); tmc2208_init_to_defaults();
#endif #endif
#ifdef TMC_ADV #ifdef TMC_ADV
TMC_ADV() TMC_ADV()
#endif #endif
#if ENABLED(HAVE_L6470DRIVER) #if HAS_DRIVER(L6470)
L6470_init_to_defaults(); L6470_init_to_defaults();
#endif #endif
} }
@ -544,7 +544,7 @@ void reset_stepper_drivers() {
// //
// L6470 Driver objects and inits // L6470 Driver objects and inits
// //
#if ENABLED(HAVE_L6470DRIVER) #if HAS_DRIVER(L6470)
#include <SPI.h> #include <SPI.h>
#include <L6470.h> #include <L6470.h>
@ -552,37 +552,37 @@ void reset_stepper_drivers() {
#define _L6470_DEFINE(ST) L6470 stepper##ST(ST##_ENABLE_PIN) #define _L6470_DEFINE(ST) L6470 stepper##ST(ST##_ENABLE_PIN)
// L6470 Stepper objects // L6470 Stepper objects
#if ENABLED(X_IS_L6470) #if AXIS_DRIVER_TYPE(X, L6470)
_L6470_DEFINE(X); _L6470_DEFINE(X);
#endif #endif
#if ENABLED(X2_IS_L6470) #if AXIS_DRIVER_TYPE(X2, L6470)
_L6470_DEFINE(X2); _L6470_DEFINE(X2);
#endif #endif
#if ENABLED(Y_IS_L6470) #if AXIS_DRIVER_TYPE(Y, L6470)
_L6470_DEFINE(Y); _L6470_DEFINE(Y);
#endif #endif
#if ENABLED(Y2_IS_L6470) #if AXIS_DRIVER_TYPE(Y2, L6470)
_L6470_DEFINE(Y2); _L6470_DEFINE(Y2);
#endif #endif
#if ENABLED(Z_IS_L6470) #if AXIS_DRIVER_TYPE(Z, L6470)
_L6470_DEFINE(Z); _L6470_DEFINE(Z);
#endif #endif
#if ENABLED(Z2_IS_L6470) #if AXIS_DRIVER_TYPE(Z2, L6470)
_L6470_DEFINE(Z2); _L6470_DEFINE(Z2);
#endif #endif
#if ENABLED(E0_IS_L6470) #if AXIS_DRIVER_TYPE(E0, L6470)
_L6470_DEFINE(E0); _L6470_DEFINE(E0);
#endif #endif
#if ENABLED(E1_IS_L6470) #if AXIS_DRIVER_TYPE(E1, L6470)
_L6470_DEFINE(E1); _L6470_DEFINE(E1);
#endif #endif
#if ENABLED(E2_IS_L6470) #if AXIS_DRIVER_TYPE(E2, L6470)
_L6470_DEFINE(E2); _L6470_DEFINE(E2);
#endif #endif
#if ENABLED(E3_IS_L6470) #if AXIS_DRIVER_TYPE(E3, L6470)
_L6470_DEFINE(E3); _L6470_DEFINE(E3);
#endif #endif
#if ENABLED(E4_IS_L6470) #if AXIS_DRIVER_TYPE(E4, L6470)
_L6470_DEFINE(E4); _L6470_DEFINE(E4);
#endif #endif
@ -595,39 +595,39 @@ void reset_stepper_drivers() {
}while(0) }while(0)
void L6470_init_to_defaults() { void L6470_init_to_defaults() {
#if ENABLED(X_IS_L6470) #if AXIS_DRIVER_TYPE(X, L6470)
_L6470_INIT(X); _L6470_INIT(X);
#endif #endif
#if ENABLED(X2_IS_L6470) #if AXIS_DRIVER_TYPE(X2, L6470)
_L6470_INIT(X2); _L6470_INIT(X2);
#endif #endif
#if ENABLED(Y_IS_L6470) #if AXIS_DRIVER_TYPE(Y, L6470)
_L6470_INIT(Y); _L6470_INIT(Y);
#endif #endif
#if ENABLED(Y2_IS_L6470) #if AXIS_DRIVER_TYPE(Y2, L6470)
_L6470_INIT(Y2); _L6470_INIT(Y2);
#endif #endif
#if ENABLED(Z_IS_L6470) #if AXIS_DRIVER_TYPE(Z, L6470)
_L6470_INIT(Z); _L6470_INIT(Z);
#endif #endif
#if ENABLED(Z2_IS_L6470) #if AXIS_DRIVER_TYPE(Z2, L6470)
_L6470_INIT(Z2); _L6470_INIT(Z2);
#endif #endif
#if ENABLED(E0_IS_L6470) #if AXIS_DRIVER_TYPE(E0, L6470)
_L6470_INIT(E0); _L6470_INIT(E0);
#endif #endif
#if ENABLED(E1_IS_L6470) #if AXIS_DRIVER_TYPE(E1, L6470)
_L6470_INIT(E1); _L6470_INIT(E1);
#endif #endif
#if ENABLED(E2_IS_L6470) #if AXIS_DRIVER_TYPE(E2, L6470)
_L6470_INIT(E2); _L6470_INIT(E2);
#endif #endif
#if ENABLED(E3_IS_L6470) #if AXIS_DRIVER_TYPE(E3, L6470)
_L6470_INIT(E3); _L6470_INIT(E3);
#endif #endif
#if ENABLED(E4_IS_L6470) #if AXIS_DRIVER_TYPE(E4, L6470)
_L6470_INIT(E4); _L6470_INIT(E4);
#endif #endif
} }
#endif // HAVE_L6470DRIVER #endif // L6470

View file

@ -47,7 +47,7 @@
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"
// TMC26X drivers have STEP/DIR on normal pins, but ENABLE via SPI // TMC26X drivers have STEP/DIR on normal pins, but ENABLE via SPI
#if ENABLED(HAVE_TMC26X) #if HAS_DRIVER(TMC26X)
#include <SPI.h> #include <SPI.h>
#ifdef STM32F7 #ifdef STM32F7
#include "../HAL/HAL_STM32F7/TMC2660.h" #include "../HAL/HAL_STM32F7/TMC2660.h"
@ -57,19 +57,19 @@
void tmc26x_init_to_defaults(); void tmc26x_init_to_defaults();
#endif #endif
#if ENABLED(HAVE_TMC2130) #if HAS_DRIVER(TMC2130)
#include <TMC2130Stepper.h> #include <TMC2130Stepper.h>
void tmc2130_init_to_defaults(); void tmc2130_init_to_defaults();
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
#include <TMC2208Stepper.h> #include <TMC2208Stepper.h>
void tmc2208_serial_begin(); void tmc2208_serial_begin();
void tmc2208_init_to_defaults(); void tmc2208_init_to_defaults();
#endif #endif
// L6470 has STEP on normal pins, but DIR/ENABLE via SPI // L6470 has STEP on normal pins, but DIR/ENABLE via SPI
#if ENABLED(HAVE_L6470DRIVER) #if HAS_DRIVER(L6470)
#include <SPI.h> #include <SPI.h>
#include <L6470.h> #include <L6470.h>
void L6470_init_to_defaults(); void L6470_init_to_defaults();
@ -79,7 +79,7 @@ void restore_stepper_drivers(); // Called by PSU_ON
void reset_stepper_drivers(); // Called by settings.load / settings.reset void reset_stepper_drivers(); // Called by settings.load / settings.reset
// X Stepper // X Stepper
#if ENABLED(X_IS_L6470) #if AXIS_DRIVER_TYPE(X, L6470)
extern L6470 stepperX; extern L6470 stepperX;
#define X_ENABLE_INIT NOOP #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) #define X_ENABLE_WRITE(STATE) do{ if (STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree(); }while(0)
@ -88,15 +88,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE) #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR) #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(X_IS_TMC26X) #if AXIS_DRIVER_TYPE(X, TMC26X)
extern TMC26XStepper stepperX; extern TMC26XStepper stepperX;
#define X_ENABLE_INIT NOOP #define X_ENABLE_INIT NOOP
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
#define X_ENABLE_READ stepperX.isEnabled() #define X_ENABLE_READ stepperX.isEnabled()
#else #else
#if ENABLED(X_IS_TMC2130) #if AXIS_DRIVER_TYPE(X, TMC2130)
extern TMC2130Stepper stepperX; extern TMC2130Stepper stepperX;
#elif ENABLED(X_IS_TMC2208) #elif AXIS_DRIVER_TYPE(X, TMC2208)
extern TMC2208Stepper stepperX; extern TMC2208Stepper stepperX;
#endif #endif
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
@ -112,7 +112,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X_STEP_READ READ(X_STEP_PIN) #define X_STEP_READ READ(X_STEP_PIN)
// Y Stepper // Y Stepper
#if ENABLED(Y_IS_L6470) #if AXIS_DRIVER_TYPE(Y, L6470)
extern L6470 stepperY; extern L6470 stepperY;
#define Y_ENABLE_INIT NOOP #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) #define Y_ENABLE_WRITE(STATE) do{ if (STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree(); }while(0)
@ -121,15 +121,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE) #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR) #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(Y_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y, TMC26X)
extern TMC26XStepper stepperY; extern TMC26XStepper stepperY;
#define Y_ENABLE_INIT NOOP #define Y_ENABLE_INIT NOOP
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
#define Y_ENABLE_READ stepperY.isEnabled() #define Y_ENABLE_READ stepperY.isEnabled()
#else #else
#if ENABLED(Y_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y, TMC2130)
extern TMC2130Stepper stepperY; extern TMC2130Stepper stepperY;
#elif ENABLED(Y_IS_TMC2208) #elif AXIS_DRIVER_TYPE(Y, TMC2208)
extern TMC2208Stepper stepperY; extern TMC2208Stepper stepperY;
#endif #endif
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
@ -145,7 +145,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y_STEP_READ READ(Y_STEP_PIN) #define Y_STEP_READ READ(Y_STEP_PIN)
// Z Stepper // Z Stepper
#if ENABLED(Z_IS_L6470) #if AXIS_DRIVER_TYPE(Z, L6470)
extern L6470 stepperZ; extern L6470 stepperZ;
#define Z_ENABLE_INIT NOOP #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) #define Z_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree(); }while(0)
@ -154,15 +154,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE) #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
#define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR) #define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(Z_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z, TMC26X)
extern TMC26XStepper stepperZ; extern TMC26XStepper stepperZ;
#define Z_ENABLE_INIT NOOP #define Z_ENABLE_INIT NOOP
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
#define Z_ENABLE_READ stepperZ.isEnabled() #define Z_ENABLE_READ stepperZ.isEnabled()
#else #else
#if ENABLED(Z_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z, TMC2130)
extern TMC2130Stepper stepperZ; extern TMC2130Stepper stepperZ;
#elif ENABLED(Z_IS_TMC2208) #elif AXIS_DRIVER_TYPE(Z, TMC2208)
extern TMC2208Stepper stepperZ; extern TMC2208Stepper stepperZ;
#endif #endif
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
@ -179,7 +179,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
// X2 Stepper // X2 Stepper
#if HAS_X2_ENABLE #if HAS_X2_ENABLE
#if ENABLED(X2_IS_L6470) #if AXIS_DRIVER_TYPE(X2, L6470)
extern L6470 stepperX2; extern L6470 stepperX2;
#define X2_ENABLE_INIT NOOP #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) #define X2_ENABLE_WRITE(STATE) do{ if (STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree(); }while(0)
@ -188,15 +188,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE) #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR) #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(X2_IS_TMC26X) #if AXIS_DRIVER_TYPE(X2, TMC26X)
extern TMC26XStepper stepperX2; extern TMC26XStepper stepperX2;
#define X2_ENABLE_INIT NOOP #define X2_ENABLE_INIT NOOP
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
#define X2_ENABLE_READ stepperX2.isEnabled() #define X2_ENABLE_READ stepperX2.isEnabled()
#else #else
#if ENABLED(X2_IS_TMC2130) #if AXIS_DRIVER_TYPE(X2, TMC2130)
extern TMC2130Stepper stepperX2; extern TMC2130Stepper stepperX2;
#elif ENABLED(X2_IS_TMC2208) #elif AXIS_DRIVER_TYPE(X2, TMC2208)
extern TMC2208Stepper stepperX2; extern TMC2208Stepper stepperX2;
#endif #endif
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
@ -214,7 +214,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
// Y2 Stepper // Y2 Stepper
#if HAS_Y2_ENABLE #if HAS_Y2_ENABLE
#if ENABLED(Y2_IS_L6470) #if AXIS_DRIVER_TYPE(Y2, L6470)
extern L6470 stepperY2; extern L6470 stepperY2;
#define Y2_ENABLE_INIT NOOP #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) #define Y2_ENABLE_WRITE(STATE) do{ if (STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree(); }while(0)
@ -223,15 +223,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE) #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR) #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(Y2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Y2, TMC26X)
extern TMC26XStepper stepperY2; extern TMC26XStepper stepperY2;
#define Y2_ENABLE_INIT NOOP #define Y2_ENABLE_INIT NOOP
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
#define Y2_ENABLE_READ stepperY2.isEnabled() #define Y2_ENABLE_READ stepperY2.isEnabled()
#else #else
#if ENABLED(Y2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Y2, TMC2130)
extern TMC2130Stepper stepperY2; extern TMC2130Stepper stepperY2;
#elif ENABLED(Y2_IS_TMC2208) #elif AXIS_DRIVER_TYPE(Y2, TMC2208)
extern TMC2208Stepper stepperY2; extern TMC2208Stepper stepperY2;
#endif #endif
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
@ -249,7 +249,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
// Z2 Stepper // Z2 Stepper
#if HAS_Z2_ENABLE #if HAS_Z2_ENABLE
#if ENABLED(Z2_IS_L6470) #if AXIS_DRIVER_TYPE(Z2, L6470)
extern L6470 stepperZ2; extern L6470 stepperZ2;
#define Z2_ENABLE_INIT NOOP #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) #define Z2_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree(); }while(0)
@ -258,15 +258,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE) #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
#define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR) #define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(Z2_IS_TMC26X) #if AXIS_DRIVER_TYPE(Z2, TMC26X)
extern TMC26XStepper stepperZ2; extern TMC26XStepper stepperZ2;
#define Z2_ENABLE_INIT NOOP #define Z2_ENABLE_INIT NOOP
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
#define Z2_ENABLE_READ stepperZ2.isEnabled() #define Z2_ENABLE_READ stepperZ2.isEnabled()
#else #else
#if ENABLED(Z2_IS_TMC2130) #if AXIS_DRIVER_TYPE(Z2, TMC2130)
extern TMC2130Stepper stepperZ2; extern TMC2130Stepper stepperZ2;
#elif ENABLED(Z2_IS_TMC2208) #elif AXIS_DRIVER_TYPE(Z2, TMC2208)
extern TMC2208Stepper stepperZ2; extern TMC2208Stepper stepperZ2;
#endif #endif
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
@ -283,7 +283,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#endif #endif
// E0 Stepper // E0 Stepper
#if ENABLED(E0_IS_L6470) #if AXIS_DRIVER_TYPE(E0, L6470)
extern L6470 stepperE0; extern L6470 stepperE0;
#define E0_ENABLE_INIT NOOP #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) #define E0_ENABLE_WRITE(STATE) do{ if (STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree(); }while(0)
@ -292,15 +292,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE) #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR) #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(E0_IS_TMC26X) #if AXIS_DRIVER_TYPE(E0, TMC26X)
extern TMC26XStepper stepperE0; extern TMC26XStepper stepperE0;
#define E0_ENABLE_INIT NOOP #define E0_ENABLE_INIT NOOP
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
#define E0_ENABLE_READ stepperE0.isEnabled() #define E0_ENABLE_READ stepperE0.isEnabled()
#else #else
#if ENABLED(E0_IS_TMC2130) #if AXIS_DRIVER_TYPE(E0, TMC2130)
extern TMC2130Stepper stepperE0; extern TMC2130Stepper stepperE0;
#elif ENABLED(E0_IS_TMC2208) #elif AXIS_DRIVER_TYPE(E0, TMC2208)
extern TMC2208Stepper stepperE0; extern TMC2208Stepper stepperE0;
#endif #endif
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
@ -316,7 +316,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E0_STEP_READ READ(E0_STEP_PIN) #define E0_STEP_READ READ(E0_STEP_PIN)
// E1 Stepper // E1 Stepper
#if ENABLED(E1_IS_L6470) #if AXIS_DRIVER_TYPE(E1, L6470)
extern L6470 stepperE1; extern L6470 stepperE1;
#define E1_ENABLE_INIT NOOP #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) #define E1_ENABLE_WRITE(STATE) do{ if (STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree(); }while(0)
@ -325,15 +325,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE) #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR) #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(E1_IS_TMC26X) #if AXIS_DRIVER_TYPE(E1, TMC26X)
extern TMC26XStepper stepperE1; extern TMC26XStepper stepperE1;
#define E1_ENABLE_INIT NOOP #define E1_ENABLE_INIT NOOP
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
#define E1_ENABLE_READ stepperE1.isEnabled() #define E1_ENABLE_READ stepperE1.isEnabled()
#else #else
#if ENABLED(E1_IS_TMC2130) #if AXIS_DRIVER_TYPE(E1, TMC2130)
extern TMC2130Stepper stepperE1; extern TMC2130Stepper stepperE1;
#elif ENABLED(E1_IS_TMC2208) #elif AXIS_DRIVER_TYPE(E1, TMC2208)
extern TMC2208Stepper stepperE1; extern TMC2208Stepper stepperE1;
#endif #endif
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
@ -349,7 +349,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E1_STEP_READ READ(E1_STEP_PIN) #define E1_STEP_READ READ(E1_STEP_PIN)
// E2 Stepper // E2 Stepper
#if ENABLED(E2_IS_L6470) #if AXIS_DRIVER_TYPE(E2, L6470)
extern L6470 stepperE2; extern L6470 stepperE2;
#define E2_ENABLE_INIT NOOP #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) #define E2_ENABLE_WRITE(STATE) do{ if (STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree(); }while(0)
@ -358,15 +358,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE) #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR) #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(E2_IS_TMC26X) #if AXIS_DRIVER_TYPE(E2, TMC26X)
extern TMC26XStepper stepperE2; extern TMC26XStepper stepperE2;
#define E2_ENABLE_INIT NOOP #define E2_ENABLE_INIT NOOP
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
#define E2_ENABLE_READ stepperE2.isEnabled() #define E2_ENABLE_READ stepperE2.isEnabled()
#else #else
#if ENABLED(E2_IS_TMC2130) #if AXIS_DRIVER_TYPE(E2, TMC2130)
extern TMC2130Stepper stepperE2; extern TMC2130Stepper stepperE2;
#elif ENABLED(E2_IS_TMC2208) #elif AXIS_DRIVER_TYPE(E2, TMC2208)
extern TMC2208Stepper stepperE2; extern TMC2208Stepper stepperE2;
#endif #endif
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
@ -382,7 +382,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E2_STEP_READ READ(E2_STEP_PIN) #define E2_STEP_READ READ(E2_STEP_PIN)
// E3 Stepper // E3 Stepper
#if ENABLED(E3_IS_L6470) #if AXIS_DRIVER_TYPE(E3, L6470)
extern L6470 stepperE3; extern L6470 stepperE3;
#define E3_ENABLE_INIT NOOP #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) #define E3_ENABLE_WRITE(STATE) do{ if (STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree(); }while(0)
@ -391,15 +391,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE) #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
#define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR) #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(E3_IS_TMC26X) #if AXIS_DRIVER_TYPE(E3, TMC26X)
extern TMC26XStepper stepperE3; extern TMC26XStepper stepperE3;
#define E3_ENABLE_INIT NOOP #define E3_ENABLE_INIT NOOP
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
#define E3_ENABLE_READ stepperE3.isEnabled() #define E3_ENABLE_READ stepperE3.isEnabled()
#else #else
#if ENABLED(E3_IS_TMC2130) #if AXIS_DRIVER_TYPE(E3, TMC2130)
extern TMC2130Stepper stepperE3; extern TMC2130Stepper stepperE3;
#elif ENABLED(E3_IS_TMC2208) #elif AXIS_DRIVER_TYPE(E3, TMC2208)
extern TMC2208Stepper stepperE3; extern TMC2208Stepper stepperE3;
#endif #endif
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
@ -415,7 +415,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E3_STEP_READ READ(E3_STEP_PIN) #define E3_STEP_READ READ(E3_STEP_PIN)
// E4 Stepper // E4 Stepper
#if ENABLED(E4_IS_L6470) #if AXIS_DRIVER_TYPE(E4, L6470)
extern L6470 stepperE4; extern L6470 stepperE4;
#define E4_ENABLE_INIT NOOP #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) #define E4_ENABLE_WRITE(STATE) do{ if (STATE) stepperE4.Step_Clock(stepperE4.getStatus() & STATUS_HIZ); else stepperE4.softFree(); }while(0)
@ -424,15 +424,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE) #define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE)
#define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR) #define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR)
#else #else
#if ENABLED(E4_IS_TMC26X) #if AXIS_DRIVER_TYPE(E4, TMC26X)
extern TMC26XStepper stepperE4; extern TMC26XStepper stepperE4;
#define E4_ENABLE_INIT NOOP #define E4_ENABLE_INIT NOOP
#define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE) #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
#define E4_ENABLE_READ stepperE4.isEnabled() #define E4_ENABLE_READ stepperE4.isEnabled()
#else #else
#if ENABLED(E4_IS_TMC2130) #if AXIS_DRIVER_TYPE(E4, TMC2130)
extern TMC2130Stepper stepperE4; extern TMC2130Stepper stepperE4;
#elif ENABLED(E4_IS_TMC2208) #elif AXIS_DRIVER_TYPE(E4, TMC2208)
extern TMC2208Stepper stepperE4; extern TMC2208Stepper stepperE4;
#endif #endif
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)

View file

@ -33,10 +33,8 @@
// //
// TMC2130 Configuration_adv defaults for EinsyRambo // TMC2130 Configuration_adv defaults for EinsyRambo
// //
#if DISABLED(HAVE_TMC2130) #if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130)
#error "You must enable TMC2130 support in Configuration_adv.h for EinsyRambo." #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRambo."
#elif DISABLED(X_IS_TMC2130) || DISABLED(Y_IS_TMC2130) || DISABLED(Z_IS_TMC2130) || DISABLED(E0_IS_TMC2130)
#error "You must enable ([XYZ]|E0)_IS_TMC2130 in Configuration_adv.h for EinsyRambo."
#endif #endif
// TMC2130 Diag Pins (currently just for reference) // TMC2130 Diag Pins (currently just for reference)

View file

@ -33,10 +33,8 @@
// //
// TMC2130 Configuration_adv defaults for EinsyRetro // TMC2130 Configuration_adv defaults for EinsyRetro
// //
#if DISABLED(HAVE_TMC2130) #if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130)
#error "You must enable TMC2130 support in Configuration_adv.h for EinsyRetro." #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRetro."
#elif DISABLED(X_IS_TMC2130) || DISABLED(Y_IS_TMC2130) || DISABLED(Z_IS_TMC2130) || DISABLED(E0_IS_TMC2130)
#error "You must enable ([XYZ]|E0)_IS_TMC2130 in Configuration_adv.h for EinsyRetro."
#endif #endif
// TMC2130 Diag Pins (currently just for reference) // TMC2130 Diag Pins (currently just for reference)

View file

@ -146,7 +146,7 @@
#endif #endif
#endif #endif
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
/** /**
* TMC2208 stepper drivers * TMC2208 stepper drivers
* *

View file

@ -178,7 +178,7 @@
#endif // ULTRA_LCD #endif // ULTRA_LCD
#if ENABLED(HAVE_TMC2208) #if HAS_DRIVER(TMC2208)
/** /**
* TMC2208 stepper drivers * TMC2208 stepper drivers
* *

View file

@ -287,14 +287,20 @@ exec_test $1 $2 "Delta Config (FLSUN AC because it's complex)"
# #
use_example_configs SCARA use_example_configs SCARA
opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER
opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130 opt_set X_DRIVER_TYPE TMC2130
opt_set Y_DRIVER_TYPE TMC2130
opt_set Z_DRIVER_TYPE TMC2130
opt_set E0_DRIVER_TYPE TMC2130
opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING
exec_test $1 $2 "SCARA with TMC2130" exec_test $1 $2 "SCARA with TMC2130"
# #
# TMC2208 Config # TMC2208 Config
# #
restore_configs restore_configs
opt_enable_adv HAVE_TMC2208 X_IS_TMC2208 Y_IS_TMC2208 Z_IS_TMC2208 opt_set X_DRIVER_TYPE TMC2208
opt_set Y_DRIVER_TYPE TMC2208
opt_set Z_DRIVER_TYPE TMC2208
opt_set E0_DRIVER_TYPE TMC2208
opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG
exec_test $1 $2 "TMC2208 Config" exec_test $1 $2 "TMC2208 Config"
# #