diff --git a/.travis.yml b/.travis.yml index f32778b3a2..8d22bd06ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,7 +107,7 @@ script: # Test DUAL_X_CARRIAGE # - restore_configs - - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB + - opt_set MOTHERBOARD BOARD_RUMBA - opt_set EXTRUDERS 2 - opt_set TEMP_SENSOR_1 1 - opt_enable USE_XMAX_PLUG diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 5209f3d719..f04ca2eb99 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 313ac6b016..58256be885 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 1ddfa5c65e..2d5a149c82 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index ead4ecb067..04bf2b1bcf 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 408667d0a0..2eccfff556 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -233,7 +233,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -248,11 +248,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index cd5b5ee151..6b0c88bf32 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 955ad4f06c..5bd27cd609 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index ce5ee33dab..f113ece373 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -235,7 +235,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -250,11 +250,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 1ddfa5c65e..2d5a149c82 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 066a5204c7..d3bf8d8bbe 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 16ced546f3..094f54b0a3 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 3d833b7ca1..81a9f9aa88 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index b8bf9d6383..89e3ef3b42 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -232,7 +232,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -247,11 +247,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 13e3f741a1..37bddc291c 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 229fe63aba..4a51392674 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 679dc2ef9a..4c4458ecbe 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -227,7 +227,7 @@ // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage -// allowing faster printing speeds. +// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage @@ -242,11 +242,6 @@ // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. - // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) - #define X2_ENABLE_PIN 29 - #define X2_STEP_PIN 25 - #define X2_DIR_PIN 23 - // There are a few selectable movement modes for dual x-carriages using M605 S // Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) diff --git a/Marlin/macros.h b/Marlin/macros.h index 69ecc6fdb8..eaa9875e0a 100644 --- a/Marlin/macros.h +++ b/Marlin/macros.h @@ -55,6 +55,32 @@ #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-') #define COUNT(a) (sizeof(a)/sizeof(*a)) +// Macros for adding +#define INC_0 1 +#define INC_1 2 +#define INC_2 3 +#define INC_3 4 +#define INC_4 5 +#define INC_5 6 +#define INC_6 7 +#define INC_7 8 +#define INC_8 9 +#define INCREMENT_(n) INC_ ##n +#define INCREMENT(n) INCREMENT_(n) + +// Macros for subtracting +#define DEC_1 0 +#define DEC_2 1 +#define DEC_3 2 +#define DEC_4 3 +#define DEC_5 4 +#define DEC_6 5 +#define DEC_7 6 +#define DEC_8 7 +#define DEC_9 8 +#define DECREMENT_(n) DEC_ ##n +#define DECREMENT(n) DECREMENT_(n) + #define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0) #define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) diff --git a/Marlin/pins.h b/Marlin/pins.h index d0295f25bb..8447db61e9 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -259,9 +259,6 @@ #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN), #endif #endif -#elif ENABLED(Y_DUAL_STEPPER_DRIVERS) || ENABLED(Z_DUAL_STEPPER_DRIVERS) - #undef _E1_PINS - #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, #endif #define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN), @@ -338,25 +335,46 @@ #endif // -// Dual Y and Dual Z support -// These options are mutually-exclusive +// Dual X-carriage, Dual Y, Dual Z support // +#define _X2_PINS +#define _Y2_PINS +#define _Z2_PINS + #define __EPIN(p,q) E##p##_##q##_PIN #define _EPIN(p,q) __EPIN(p,q) +#if ENABLED(DUAL_X_CARRIAGE) + // The X2 axis, if any, should be the next open extruder port + #ifndef X2_STEP_PIN + #define X2_STEP_PIN _EPIN(EXTRUDERS, STEP) + #define X2_DIR_PIN _EPIN(EXTRUDERS, DIR) + #define X2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE) + #endif + #undef _X2_PINS + #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, + #define Y2_Z2_E_INDEX INCREMENT(EXTRUDERS) +#else + #define Y2_Z2_E_INDEX EXTRUDERS +#endif + // The Y2 axis, if any, should be the next open extruder port -#ifndef Y2_STEP_PIN - #define Y2_STEP_PIN _EPIN(EXTRUDERS, STEP) - #define Y2_DIR_PIN _EPIN(EXTRUDERS, DIR) - #define Y2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE) +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !defined(Y2_STEP_PIN) + #define Y2_STEP_PIN _EPIN(Y2_Z2_E_INDEX, STEP) + #define Y2_DIR_PIN _EPIN(Y2_Z2_E_INDEX, DIR) + #define Y2_ENABLE_PIN _EPIN(Y2_Z2_E_INDEX, ENABLE) + #undef _Y2_PINS + #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, #endif // The Z2 axis, if any, should be the next open extruder port -#ifndef Z2_STEP_PIN - #define Z2_STEP_PIN _EPIN(EXTRUDERS, STEP) - #define Z2_DIR_PIN _EPIN(EXTRUDERS, DIR) - #define Z2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE) +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && !defined(Z2_STEP_PIN) + #define Z2_STEP_PIN _EPIN(Y2_Z2_E_INDEX, STEP) + #define Z2_DIR_PIN _EPIN(Y2_Z2_E_INDEX, DIR) + #define Z2_ENABLE_PIN _EPIN(Y2_Z2_E_INDEX, ENABLE) + #undef _Z2_PINS + #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, #endif #define SENSITIVE_PINS { 0, 1, \ @@ -365,6 +383,7 @@ Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \ PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLERFAN_PIN, \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS BED_PINS \ + _X2_PINS _Y2_PINS _Z2_PINS \ X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \ } diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 88d54ace47..909d86b555 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -491,29 +491,30 @@ void Stepper::init() { #if HAS_X_ENABLE X_ENABLE_INIT; if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH); + #if ENABLED(DUAL_X_CARRIAGE) && HAS_X2_ENABLE + X2_ENABLE_INIT; + if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); + #endif #endif - #if HAS_X2_ENABLE - X2_ENABLE_INIT; - if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); - #endif + #if HAS_Y_ENABLE Y_ENABLE_INIT; if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); + #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE + Y2_ENABLE_INIT; + if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); + #endif + #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE - Y2_ENABLE_INIT; - if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); - #endif - #endif #if HAS_Z_ENABLE Z_ENABLE_INIT; if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); - #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE Z2_ENABLE_INIT; if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); #endif #endif + #if HAS_E0_ENABLE E0_ENABLE_INIT; if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH); @@ -550,10 +551,11 @@ void Stepper::init() { // Initialize Step Pins #if HAS_X_STEP AXIS_INIT(x, X, X); + #if ENABLED(DUAL_X_CARRIAGE) && HAS_X2_STEP + AXIS_INIT(x, X2, X); + #endif #endif - #if HAS_X2_STEP - AXIS_INIT(x, X2, X); - #endif + #if HAS_Y_STEP #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP Y2_STEP_INIT; @@ -561,6 +563,7 @@ void Stepper::init() { #endif AXIS_INIT(y, Y, Y); #endif + #if HAS_Z_STEP #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP Z2_STEP_INIT; @@ -568,6 +571,7 @@ void Stepper::init() { #endif AXIS_INIT(z, Z, Z); #endif + #if HAS_E0_STEP E_AXIS_INIT(0); #endif diff --git a/Marlin/stepper_indirection.h b/Marlin/stepper_indirection.h index c013d268e3..24e4c7c0ac 100644 --- a/Marlin/stepper_indirection.h +++ b/Marlin/stepper_indirection.h @@ -60,17 +60,19 @@ #define X_ENABLE_READ READ(X_ENABLE_PIN) // X2 motor -#define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN) -#define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE) -#define X2_STEP_READ READ(X2_STEP_PIN) +#if ENABLED(DUAL_X_CARRIAGE) + #define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN) + #define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE) + #define X2_STEP_READ READ(X2_STEP_PIN) -#define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN) -#define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE) -#define X2_DIR_READ READ(X_DIR_PIN) + #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN) + #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE) + #define X2_DIR_READ READ(X_DIR_PIN) -#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) -#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) -#define X2_ENABLE_READ READ(X_ENABLE_PIN) + #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) + #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) + #define X2_ENABLE_READ READ(X_ENABLE_PIN) +#endif // DUAL_X_CARRIAGE // Y motor #define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN) @@ -86,17 +88,19 @@ #define Y_ENABLE_READ READ(Y_ENABLE_PIN) // Y2 motor -#define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN) -#define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE) -#define Y2_STEP_READ READ(Y2_STEP_PIN) +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN) + #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE) + #define Y2_STEP_READ READ(Y2_STEP_PIN) -#define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN) -#define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE) -#define Y2_DIR_READ READ(Y2_DIR_PIN) + #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN) + #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE) + #define Y2_DIR_READ READ(Y2_DIR_PIN) -#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) -#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) -#define Y2_ENABLE_READ READ(Y2_ENABLE_PIN) + #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) + #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) + #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN) +#endif // Y_DUAL_STEPPER_DRIVERS // Z motor #define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN) @@ -112,17 +116,19 @@ #define Z_ENABLE_READ READ(Z_ENABLE_PIN) // Z2 motor -#define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN) -#define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE) -#define Z2_STEP_READ READ(Z2_STEP_PIN) +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN) + #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE) + #define Z2_STEP_READ READ(Z2_STEP_PIN) -#define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN) -#define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE) -#define Z2_DIR_READ READ(Z2_DIR_PIN) + #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN) + #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE) + #define Z2_DIR_READ READ(Z2_DIR_PIN) -#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) -#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) -#define Z2_ENABLE_READ READ(Z2_ENABLE_PIN) + #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) + #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) + #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN) +#endif // Z_DUAL_STEPPER_DRIVERS // E0 motor #define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)