Browse Source

Automatically set X2 stepper pins

Scott Lahteine 8 years ago
parent
commit
07c9a11c3c

+ 1
- 1
.travis.yml View File

@@ -107,7 +107,7 @@ script:
107 107
   # Test DUAL_X_CARRIAGE
108 108
   #
109 109
   - restore_configs
110
-  - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
110
+  - opt_set MOTHERBOARD BOARD_RUMBA
111 111
   - opt_set EXTRUDERS 2
112 112
   - opt_set TEMP_SENSOR_1 1
113 113
   - opt_enable USE_XMAX_PLUG

+ 1
- 6
Marlin/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/K8200/Configuration_adv.h View File

@@ -233,7 +233,7 @@
233 233
 // Enable this for dual x-carriage printers.
234 234
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
235 235
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
236
-// allowing faster printing speeds.
236
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
237 237
 //#define DUAL_X_CARRIAGE
238 238
 #if ENABLED(DUAL_X_CARRIAGE)
239 239
   // Configuration for second X-carriage
@@ -248,11 +248,6 @@
248 248
       // without modifying the firmware (through the "M218 T1 X???" command).
249 249
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
250 250
 
251
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
252
-  #define X2_ENABLE_PIN 29
253
-  #define X2_STEP_PIN 25
254
-  #define X2_DIR_PIN 23
255
-
256 251
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
257 252
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
258 253
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

@@ -235,7 +235,7 @@
235 235
 // Enable this for dual x-carriage printers.
236 236
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
237 237
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
238
-// allowing faster printing speeds.
238
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
239 239
 //#define DUAL_X_CARRIAGE
240 240
 #if ENABLED(DUAL_X_CARRIAGE)
241 241
   // Configuration for second X-carriage
@@ -250,11 +250,6 @@
250 250
       // without modifying the firmware (through the "M218 T1 X???" command).
251 251
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
252 252
 
253
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
254
-  #define X2_ENABLE_PIN 29
255
-  #define X2_STEP_PIN 25
256
-  #define X2_DIR_PIN 23
257
-
258 253
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
259 254
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
260 255
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -232,7 +232,7 @@
232 232
 // Enable this for dual x-carriage printers.
233 233
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
234 234
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
235
-// allowing faster printing speeds.
235
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
236 236
 //#define DUAL_X_CARRIAGE
237 237
 #if ENABLED(DUAL_X_CARRIAGE)
238 238
   // Configuration for second X-carriage
@@ -247,11 +247,6 @@
247 247
       // without modifying the firmware (through the "M218 T1 X???" command).
248 248
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
249 249
 
250
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
251
-  #define X2_ENABLE_PIN 29
252
-  #define X2_STEP_PIN 25
253
-  #define X2_DIR_PIN 23
254
-
255 250
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
256 251
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
257 252
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 1
- 6
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -227,7 +227,7 @@
227 227
 // Enable this for dual x-carriage printers.
228 228
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
229 229
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
230
-// allowing faster printing speeds.
230
+// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
231 231
 //#define DUAL_X_CARRIAGE
232 232
 #if ENABLED(DUAL_X_CARRIAGE)
233 233
   // Configuration for second X-carriage
@@ -242,11 +242,6 @@
242 242
       // without modifying the firmware (through the "M218 T1 X???" command).
243 243
       // Remember: you should set the second extruder x-offset to 0 in your slicer.
244 244
 
245
-  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
246
-  #define X2_ENABLE_PIN 29
247
-  #define X2_STEP_PIN 25
248
-  #define X2_DIR_PIN 23
249
-
250 245
   // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
251 246
   //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
252 247
   //                           as long as it supports dual x-carriages. (M605 S0)

+ 26
- 0
Marlin/macros.h View File

@@ -55,6 +55,32 @@
55 55
 #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-')
56 56
 #define COUNT(a) (sizeof(a)/sizeof(*a))
57 57
 
58
+// Macros for adding
59
+#define INC_0 1
60
+#define INC_1 2
61
+#define INC_2 3
62
+#define INC_3 4
63
+#define INC_4 5
64
+#define INC_5 6
65
+#define INC_6 7
66
+#define INC_7 8
67
+#define INC_8 9
68
+#define INCREMENT_(n) INC_ ##n
69
+#define INCREMENT(n) INCREMENT_(n)
70
+
71
+// Macros for subtracting
72
+#define DEC_1 0
73
+#define DEC_2 1
74
+#define DEC_3 2
75
+#define DEC_4 3
76
+#define DEC_5 4
77
+#define DEC_6 5
78
+#define DEC_7 6
79
+#define DEC_8 7
80
+#define DEC_9 8
81
+#define DECREMENT_(n) DEC_ ##n
82
+#define DECREMENT(n) DECREMENT_(n)
83
+
58 84
 #define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0)
59 85
 
60 86
 #define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)

+ 32
- 13
Marlin/pins.h View File

@@ -259,9 +259,6 @@
259 259
       #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
260 260
     #endif
261 261
   #endif
262
-#elif ENABLED(Y_DUAL_STEPPER_DRIVERS) || ENABLED(Z_DUAL_STEPPER_DRIVERS)
263
-  #undef _E1_PINS
264
-  #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN,
265 262
 #endif
266 263
 
267 264
 #define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN),
@@ -338,25 +335,46 @@
338 335
 #endif
339 336
 
340 337
 //
341
-// Dual Y and Dual Z support
342
-// These options are mutually-exclusive
338
+// Dual X-carriage, Dual Y, Dual Z support
343 339
 //
344 340
 
341
+#define _X2_PINS
342
+#define _Y2_PINS
343
+#define _Z2_PINS
344
+
345 345
 #define __EPIN(p,q) E##p##_##q##_PIN
346 346
 #define _EPIN(p,q) __EPIN(p,q)
347 347
 
348
+#if ENABLED(DUAL_X_CARRIAGE)
349
+  // The X2 axis, if any, should be the next open extruder port
350
+  #ifndef X2_STEP_PIN
351
+    #define X2_STEP_PIN   _EPIN(EXTRUDERS, STEP)
352
+    #define X2_DIR_PIN    _EPIN(EXTRUDERS, DIR)
353
+    #define X2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE)
354
+  #endif
355
+  #undef _X2_PINS
356
+  #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
357
+  #define Y2_Z2_E_INDEX INCREMENT(EXTRUDERS)
358
+#else
359
+  #define Y2_Z2_E_INDEX EXTRUDERS
360
+#endif
361
+
348 362
 // The Y2 axis, if any, should be the next open extruder port
349
-#ifndef Y2_STEP_PIN
350
-  #define Y2_STEP_PIN   _EPIN(EXTRUDERS, STEP)
351
-  #define Y2_DIR_PIN    _EPIN(EXTRUDERS, DIR)
352
-  #define Y2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE)
363
+#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !defined(Y2_STEP_PIN)
364
+  #define Y2_STEP_PIN   _EPIN(Y2_Z2_E_INDEX, STEP)
365
+  #define Y2_DIR_PIN    _EPIN(Y2_Z2_E_INDEX, DIR)
366
+  #define Y2_ENABLE_PIN _EPIN(Y2_Z2_E_INDEX, ENABLE)
367
+  #undef _Y2_PINS
368
+  #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
353 369
 #endif
354 370
 
355 371
 // The Z2 axis, if any, should be the next open extruder port
356
-#ifndef Z2_STEP_PIN
357
-  #define Z2_STEP_PIN   _EPIN(EXTRUDERS, STEP)
358
-  #define Z2_DIR_PIN    _EPIN(EXTRUDERS, DIR)
359
-  #define Z2_ENABLE_PIN _EPIN(EXTRUDERS, ENABLE)
372
+#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && !defined(Z2_STEP_PIN)
373
+  #define Z2_STEP_PIN   _EPIN(Y2_Z2_E_INDEX, STEP)
374
+  #define Z2_DIR_PIN    _EPIN(Y2_Z2_E_INDEX, DIR)
375
+  #define Z2_ENABLE_PIN _EPIN(Y2_Z2_E_INDEX, ENABLE)
376
+  #undef _Z2_PINS
377
+  #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,
360 378
 #endif
361 379
 
362 380
 #define SENSITIVE_PINS { 0, 1, \
@@ -365,6 +383,7 @@
365 383
     Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \
366 384
     PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLERFAN_PIN, \
367 385
     _E0_PINS _E1_PINS _E2_PINS _E3_PINS BED_PINS \
386
+    _X2_PINS _Y2_PINS _Z2_PINS \
368 387
     X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \
369 388
   }
370 389
 

+ 17
- 13
Marlin/stepper.cpp View File

@@ -491,29 +491,30 @@ void Stepper::init() {
491 491
   #if HAS_X_ENABLE
492 492
     X_ENABLE_INIT;
493 493
     if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
494
+    #if ENABLED(DUAL_X_CARRIAGE) && HAS_X2_ENABLE
495
+      X2_ENABLE_INIT;
496
+      if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
497
+    #endif
494 498
   #endif
495
-  #if HAS_X2_ENABLE
496
-    X2_ENABLE_INIT;
497
-    if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
498
-  #endif
499
+
499 500
   #if HAS_Y_ENABLE
500 501
     Y_ENABLE_INIT;
501 502
     if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
502
-
503
-  #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
504
-    Y2_ENABLE_INIT;
505
-    if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
506
-  #endif
503
+    #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
504
+      Y2_ENABLE_INIT;
505
+      if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
506
+    #endif
507 507
   #endif
508
+
508 509
   #if HAS_Z_ENABLE
509 510
     Z_ENABLE_INIT;
510 511
     if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
511
-
512 512
     #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
513 513
       Z2_ENABLE_INIT;
514 514
       if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
515 515
     #endif
516 516
   #endif
517
+
517 518
   #if HAS_E0_ENABLE
518 519
     E0_ENABLE_INIT;
519 520
     if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
@@ -550,10 +551,11 @@ void Stepper::init() {
550 551
   // Initialize Step Pins
551 552
   #if HAS_X_STEP
552 553
     AXIS_INIT(x, X, X);
554
+    #if ENABLED(DUAL_X_CARRIAGE) && HAS_X2_STEP
555
+      AXIS_INIT(x, X2, X);
556
+    #endif
553 557
   #endif
554
-  #if HAS_X2_STEP
555
-    AXIS_INIT(x, X2, X);
556
-  #endif
558
+
557 559
   #if HAS_Y_STEP
558 560
     #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
559 561
       Y2_STEP_INIT;
@@ -561,6 +563,7 @@ void Stepper::init() {
561 563
     #endif
562 564
     AXIS_INIT(y, Y, Y);
563 565
   #endif
566
+
564 567
   #if HAS_Z_STEP
565 568
     #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
566 569
       Z2_STEP_INIT;
@@ -568,6 +571,7 @@ void Stepper::init() {
568 571
     #endif
569 572
     AXIS_INIT(z, Z, Z);
570 573
   #endif
574
+
571 575
   #if HAS_E0_STEP
572 576
     E_AXIS_INIT(0);
573 577
   #endif

+ 35
- 29
Marlin/stepper_indirection.h View File

@@ -60,17 +60,19 @@
60 60
 #define X_ENABLE_READ READ(X_ENABLE_PIN)
61 61
 
62 62
 // X2 motor
63
-#define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
64
-#define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
65
-#define X2_STEP_READ READ(X2_STEP_PIN)
63
+#if ENABLED(DUAL_X_CARRIAGE)
64
+  #define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
65
+  #define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
66
+  #define X2_STEP_READ READ(X2_STEP_PIN)
66 67
 
67
-#define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
68
-#define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
69
-#define X2_DIR_READ READ(X_DIR_PIN)
68
+  #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
69
+  #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
70
+  #define X2_DIR_READ READ(X_DIR_PIN)
70 71
 
71
-#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
72
-#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
73
-#define X2_ENABLE_READ READ(X_ENABLE_PIN)
72
+  #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
73
+  #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
74
+  #define X2_ENABLE_READ READ(X_ENABLE_PIN)
75
+#endif // DUAL_X_CARRIAGE
74 76
 
75 77
 // Y motor
76 78
 #define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
@@ -86,17 +88,19 @@
86 88
 #define Y_ENABLE_READ READ(Y_ENABLE_PIN)
87 89
 
88 90
 // Y2 motor
89
-#define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
90
-#define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
91
-#define Y2_STEP_READ READ(Y2_STEP_PIN)
91
+#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
92
+  #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
93
+  #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
94
+  #define Y2_STEP_READ READ(Y2_STEP_PIN)
92 95
 
93
-#define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
94
-#define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
95
-#define Y2_DIR_READ READ(Y2_DIR_PIN)
96
+  #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
97
+  #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
98
+  #define Y2_DIR_READ READ(Y2_DIR_PIN)
96 99
 
97
-#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
98
-#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
99
-#define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
100
+  #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
101
+  #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
102
+  #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
103
+#endif // Y_DUAL_STEPPER_DRIVERS
100 104
 
101 105
 // Z motor
102 106
 #define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
@@ -112,17 +116,19 @@
112 116
 #define Z_ENABLE_READ READ(Z_ENABLE_PIN)
113 117
 
114 118
 // Z2 motor
115
-#define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
116
-#define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
117
-#define Z2_STEP_READ READ(Z2_STEP_PIN)
118
-
119
-#define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
120
-#define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
121
-#define Z2_DIR_READ READ(Z2_DIR_PIN)
122
-
123
-#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
124
-#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
125
-#define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
119
+#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
120
+  #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
121
+  #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
122
+  #define Z2_STEP_READ READ(Z2_STEP_PIN)
123
+
124
+  #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
125
+  #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
126
+  #define Z2_DIR_READ READ(Z2_DIR_PIN)
127
+
128
+  #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
129
+  #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
130
+  #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
131
+#endif // Z_DUAL_STEPPER_DRIVERS
126 132
 
127 133
 // E0 motor
128 134
 #define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)

Loading…
Cancel
Save