diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 220458d918..06101f00c7 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -150,6 +150,21 @@ #define EXTRUDERS 1 #endif +// Same again but for Y Axis. +//#define Y_DUAL_STEPPER_DRIVERS + +// Define if the two Y drives need to rotate in opposite directions +#define INVERT_Y2_VS_Y_DIR true + +#ifdef Y_DUAL_STEPPER_DRIVERS + #undef EXTRUDERS + #define EXTRUDERS 1 +#endif + +#ifdef Z_DUAL_STEPPER_DRIVERS && Y_DUAL_STEPPER_DRIVERS + #error "You cannot have dual drivers for both Y and Z" +#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/Marlin.h b/Marlin/Marlin.h index 6da0a83b5d..fe1e751d97 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -109,8 +109,13 @@ void manage_inactivity(); #endif #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 - #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON) - #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON) + #ifdef Y_DUAL_STEPPER_DRIVERS + #define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); } + #define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); } + #else + #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON) + #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON) + #endif #else #define enable_y() ; #define disable_y() ; diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 4f11ae9e37..f45ef7d405 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -383,10 +383,20 @@ ISR(TIMER1_COMPA_vect) } if((out_bits & (1<steps_y; if (counter_y > 0) { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + + #ifdef Y_DUAL_STEPPER_DRIVERS + WRITE(Y2_STEP_PIN, !INVERT_Y_STEP_PIN); + #endif + counter_y -= current_block->step_event_count; count_position[Y_AXIS]+=count_direction[Y_AXIS]; WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + + #ifdef Y_DUAL_STEPPER_DRIVERS + WRITE(Y2_STEP_PIN, INVERT_Y_STEP_PIN); + #endif } counter_z += current_block->steps_z; @@ -756,6 +775,10 @@ void st_init() #endif #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 SET_OUTPUT(Y_DIR_PIN); + + #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && (Y2_DIR_PIN > -1) + SET_OUTPUT(Y2_DIR_PIN); + #endif #endif #if defined(Z_DIR_PIN) && Z_DIR_PIN > -1 SET_OUTPUT(Z_DIR_PIN); @@ -787,6 +810,11 @@ void st_init() #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 SET_OUTPUT(Y_ENABLE_PIN); if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH); + + #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && (Y2_ENABLE_PIN > -1) + SET_OUTPUT(Y2_ENABLE_PIN); + if(!Y_ENABLE_ON) WRITE(Y2_ENABLE_PIN,HIGH); + #endif #endif #if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 SET_OUTPUT(Z_ENABLE_PIN); @@ -869,6 +897,10 @@ void st_init() #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) SET_OUTPUT(Y_STEP_PIN); WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN); + #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1) + SET_OUTPUT(Y2_STEP_PIN); + WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN); + #endif disable_y(); #endif #if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)