From 91bd6eade701ea1c5e4027d4bee0a245b8391005 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 11 Jul 2016 10:19:01 -0700 Subject: [PATCH 1/2] X_DUAL_STEPPER_DRIVERS configuration option --- Marlin/Configuration_adv.h | 33 ++++++++++++------- Marlin/SanityCheck.h | 18 +++++----- .../Cartesio/Configuration_adv.h | 33 ++++++++++++------- .../Felix/Configuration_adv.h | 33 ++++++++++++------- .../Hephestos/Configuration_adv.h | 33 ++++++++++++------- .../Hephestos_2/Configuration_adv.h | 33 ++++++++++++------- .../K8200/Configuration_adv.h | 33 ++++++++++++------- .../RigidBot/Configuration_adv.h | 33 ++++++++++++------- .../SCARA/Configuration_adv.h | 33 ++++++++++++------- .../TAZ4/Configuration_adv.h | 33 ++++++++++++------- .../WITBOX/Configuration_adv.h | 33 ++++++++++++------- .../delta/biv2.5/Configuration_adv.h | 33 ++++++++++++------- .../delta/generic/Configuration_adv.h | 33 ++++++++++++------- .../delta/kossel_mini/Configuration_adv.h | 33 ++++++++++++------- .../delta/kossel_pro/Configuration_adv.h | 33 ++++++++++++------- .../delta/kossel_xl/Configuration_adv.h | 33 ++++++++++++------- .../makibox/Configuration_adv.h | 33 ++++++++++++------- .../tvrrug/Round2/Configuration_adv.h | 33 ++++++++++++------- 18 files changed, 365 insertions(+), 214 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 82b19dea3f..027132d775 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 17d6cff5f9..9c48e9e872 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -76,8 +76,14 @@ /** * Dual Stepper Drivers */ -#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && ENABLED(Y_DUAL_STEPPER_DRIVERS) - #error "You cannot have dual stepper drivers for both Y and Z." +#if ENABLED(X_DUAL_STEPPER_DRIVERS) && ENABLED(DUAL_X_CARRIAGE) + #error "DUAL_X_CARRIAGE is not compatible with X_DUAL_STEPPER_DRIVERS." +#elif ENABLED(X_DUAL_STEPPER_DRIVERS) && (!HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR) + #error "X_DUAL_STEPPER_DRIVERS requires X2 pins (and an extra E plug)." +#elif ENABLED(Y_DUAL_STEPPER_DRIVERS) && (!HAS_Y2_ENABLE || !HAS_Y2_STEP || !HAS_Y2_DIR) + #error "Y_DUAL_STEPPER_DRIVERS requires Y2 pins (and an extra E plug)." +#elif ENABLED(Z_DUAL_STEPPER_DRIVERS) && (!HAS_Z2_ENABLE || !HAS_Z2_STEP || !HAS_Z2_DIR) + #error "Z_DUAL_STEPPER_DRIVERS requires Z2 pins (and an extra E plug)." #endif /** @@ -152,14 +158,6 @@ #error "EXTRUDERS must be 1 with HEATERS_PARALLEL." #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #error "EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS." - #endif - - #if ENABLED(Z_DUAL_STEPPER_DRIVERS) - #error "EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS." - #endif - #elif ENABLED(SINGLENOZZLE) #error "SINGLENOZZLE requires 2 or more EXTRUDERS." #endif diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 53ee0908ea..5fb71efe6d 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 77148dc88e..05189ecfc7 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index e1e6666df5..1aa7c218bd 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index e08dd26dc0..95b8c89b8c 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index b3b7b26ae8..2d0afdff3b 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -235,11 +235,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -261,14 +278,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 70debaca90..e3af83bada 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 81b83c18c4..a7285ffd2c 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 20e7ac19e7..116c99abb4 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -237,11 +237,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -263,14 +280,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index e1e6666df5..1aa7c218bd 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 8464cc7b06..3e9fd8670a 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 874031addc..1dfeb8c712 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 1f130084f8..e2bb764765 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index db1a8e3c89..3baf693908 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -234,11 +234,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -260,14 +277,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index fc309285ee..3b82e06fb3 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 960d186306..bdf8209370 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index b044402457..9c04c46506 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -229,11 +229,28 @@ //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. +// Dual X Steppers +// Uncomment this option to drive two X axis motors. +// The next unused E driver will be assigned to the second X stepper. +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + // Set true if the two X motors need to rotate in opposite directions + #define INVERT_X2_VS_X_DIR true +#endif + + +// Dual Y Steppers +// Uncomment this option to drive two Y axis motors. +// The next unused E driver will be assigned to the second Y stepper. +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + // Set true if the two Y motors need to rotate in opposite directions + #define INVERT_Y2_VS_Y_DIR true +#endif + // A single Z stepper driver is usually used to drive 2 stepper motors. -// Uncomment this define to utilize a separate stepper driver for each Z axis motor. -// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used -// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. -// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. +// Uncomment this option to use a separate stepper driver for each Z axis motor. +// The next unused E driver will be assigned to the second Z stepper. //#define Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS) @@ -255,14 +272,6 @@ #endif // Z_DUAL_STEPPER_DRIVERS -// Same again but for Y Axis. -//#define Y_DUAL_STEPPER_DRIVERS - -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - // Define if the two Y drives need to rotate in opposite directions - #define INVERT_Y2_VS_Y_DIR true -#endif - // 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 From 4b4a582c4fe148c1c92a7371d36a1ba81d6030fb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 11 Jul 2016 10:19:07 -0700 Subject: [PATCH 2/2] X_DUAL_STEPPER_DRIVERS implementation --- Marlin/Marlin.h | 72 +++++++++++++++++------------------- Marlin/pins.h | 31 ++++++++++------ Marlin/stepper.cpp | 24 +++++++----- Marlin/stepper_indirection.h | 6 +-- 4 files changed, 70 insertions(+), 63 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 5c698834b7..792001bc6e 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -134,73 +134,69 @@ void manage_inactivity(bool ignore_stepper_queue = false); extern bool extruder_duplication_enabled; #endif -#if ENABLED(DUAL_X_CARRIAGE) && HAS_X_ENABLE && HAS_X2_ENABLE - #define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0) - #define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0) +#if HAS_X2_ENABLE + #define enable_x() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0) + #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0) #elif HAS_X_ENABLE #define enable_x() X_ENABLE_WRITE( X_ENABLE_ON) - #define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } + #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0) #else - #define enable_x() ; - #define disable_x() ; + #define enable_x() NOOP + #define disable_x() NOOP #endif -#if HAS_Y_ENABLE - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); } - #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } - #else - #define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON) - #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } - #endif +#if HAS_Y2_ENABLE + #define enable_y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0) + #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0) +#elif HAS_Y_ENABLE + #define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON) + #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0) #else - #define enable_y() ; - #define disable_y() ; + #define enable_y() NOOP + #define disable_y() NOOP #endif -#if HAS_Z_ENABLE - #if ENABLED(Z_DUAL_STEPPER_DRIVERS) - #define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); } - #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } - #else - #define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON) - #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } - #endif +#if HAS_Z2_ENABLE + #define enable_z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0) + #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0) +#elif HAS_Z_ENABLE + #define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON) + #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0) #else - #define enable_z() ; - #define disable_z() ; + #define enable_z() NOOP + #define disable_z() NOOP #endif #if HAS_E0_ENABLE - #define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON) + #define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON) #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON) #else - #define enable_e0() /* nothing */ - #define disable_e0() /* nothing */ + #define enable_e0() NOOP + #define disable_e0() NOOP #endif #if (EXTRUDERS > 1) && HAS_E1_ENABLE - #define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON) + #define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON) #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON) #else - #define enable_e1() /* nothing */ - #define disable_e1() /* nothing */ + #define enable_e1() NOOP + #define disable_e1() NOOP #endif #if (EXTRUDERS > 2) && HAS_E2_ENABLE - #define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON) + #define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON) #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON) #else - #define enable_e2() /* nothing */ - #define disable_e2() /* nothing */ + #define enable_e2() NOOP + #define disable_e2() NOOP #endif #if (EXTRUDERS > 3) && HAS_E3_ENABLE - #define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON) + #define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON) #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON) #else - #define enable_e3() /* nothing */ - #define disable_e3() /* nothing */ + #define enable_e3() NOOP + #define disable_e3() NOOP #endif /** diff --git a/Marlin/pins.h b/Marlin/pins.h index bd251216e1..1d4de00f8b 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -369,8 +369,8 @@ #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 +// The X2 axis, if any, should be the next open extruder port +#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) #ifndef X2_STEP_PIN #define X2_STEP_PIN _EPIN(EXTRUDERS, STEP) #define X2_DIR_PIN _EPIN(EXTRUDERS, DIR) @@ -378,25 +378,32 @@ #endif #undef _X2_PINS #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, - #define Y2_Z2_E_INDEX INCREMENT(EXTRUDERS) + #define Y2_E_INDEX INCREMENT(EXTRUDERS) #else - #define Y2_Z2_E_INDEX EXTRUDERS + #define Y2_E_INDEX EXTRUDERS #endif // The Y2 axis, if any, should be the next open extruder port -#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) +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #ifndef Y2_STEP_PIN + #define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP) + #define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR) + #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE) + #endif #undef _Y2_PINS #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, + #define Z2_E_INDEX INCREMENT(Y2_E_INDEX) +#else + #define Z2_E_INDEX Y2_E_INDEX #endif // The Z2 axis, if any, should be the next open extruder port -#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) +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + #ifndef Z2_STEP_PIN + #define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP) + #define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR) + #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE) + #endif #undef _Z2_PINS #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, #endif diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 300bd286f5..57fa3b5b72 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -120,7 +120,10 @@ unsigned short Stepper::OCR1A_nominal; volatile long Stepper::endstops_trigsteps[3]; -#if ENABLED(DUAL_X_CARRIAGE) +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) != INVERT_X2_VS_X_DIR); }while(0) + #define X_APPLY_STEP(v,Q) do{ X_STEP_WRITE(v); X2_STEP_WRITE(v); }while(0) +#elif ENABLED(DUAL_X_CARRIAGE) #define X_APPLY_DIR(v,ALWAYS) \ if (extruder_duplication_enabled || ALWAYS) { \ X_DIR_WRITE(v); \ @@ -143,15 +146,15 @@ volatile long Stepper::endstops_trigsteps[3]; #endif #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); } - #define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); } + #define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }while(0) + #define Y_APPLY_STEP(v,Q) do{ Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }while(0) #else #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v) #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v) #endif #if ENABLED(Z_DUAL_STEPPER_DRIVERS) - #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); } + #define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }while(0) #if ENABLED(Z_DUAL_ENDSTOPS) #define Z_APPLY_STEP(v,Q) \ if (performing_homing) { \ @@ -169,7 +172,7 @@ volatile long Stepper::endstops_trigsteps[3]; Z2_STEP_WRITE(v); \ } #else - #define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); } + #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }while(0) #endif #else #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v) @@ -669,14 +672,15 @@ 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); + #if ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE) + X2_STEP_INIT; + X2_STEP_WRITE(INVERT_X_STEP_PIN); #endif + AXIS_INIT(x, X, X); #endif #if HAS_Y_STEP - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP + #if ENABLED(Y_DUAL_STEPPER_DRIVERS) Y2_STEP_INIT; Y2_STEP_WRITE(INVERT_Y_STEP_PIN); #endif @@ -684,7 +688,7 @@ void Stepper::init() { #endif #if HAS_Z_STEP - #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP + #if ENABLED(Z_DUAL_STEPPER_DRIVERS) Z2_STEP_INIT; Z2_STEP_WRITE(INVERT_Z_STEP_PIN); #endif diff --git a/Marlin/stepper_indirection.h b/Marlin/stepper_indirection.h index 24e4c7c0ac..56c15060ec 100644 --- a/Marlin/stepper_indirection.h +++ b/Marlin/stepper_indirection.h @@ -60,7 +60,7 @@ #define X_ENABLE_READ READ(X_ENABLE_PIN) // X2 motor -#if ENABLED(DUAL_X_CARRIAGE) +#if HAS_X2_ENABLE #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) @@ -88,7 +88,7 @@ #define Y_ENABLE_READ READ(Y_ENABLE_PIN) // Y2 motor -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) +#if HAS_Y2_ENABLE #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) @@ -116,7 +116,7 @@ #define Z_ENABLE_READ READ(Z_ENABLE_PIN) // Z2 motor -#if ENABLED(Z_DUAL_STEPPER_DRIVERS) +#if HAS_Z2_ENABLE #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)