Added Y_DUAL_STEPPER_DRIVERS
Enables two stepper drivers to be used for the Y axis (useful for Shapeoko style machines) Each Y driver can be stepped in either the same way or in opposite directions, accounting for different hardware setups (leadscrew vs. belt driven)
This commit is contained in:
parent
f4a59e4ce5
commit
ed1ab42186
|
@ -152,6 +152,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
|
||||
|
||||
//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
|
||||
#define X_HOME_RETRACT_MM 5
|
||||
#define Y_HOME_RETRACT_MM 5
|
||||
|
|
|
@ -105,8 +105,13 @@ void manage_inactivity();
|
|||
#endif
|
||||
|
||||
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
|
||||
#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() ;
|
||||
|
|
|
@ -357,10 +357,20 @@ ISR(TIMER1_COMPA_vect)
|
|||
}
|
||||
if((out_bits & (1<<Y_AXIS))!=0){
|
||||
WRITE(Y_DIR_PIN, INVERT_Y_DIR);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_DIR_PIN, !(INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
#endif
|
||||
|
||||
count_direction[Y_AXIS]=-1;
|
||||
}
|
||||
else{
|
||||
WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
|
||||
|
||||
#ifdef Y_DUAL_STEPPER_DRIVERS
|
||||
WRITE(Y2_DIR_PIN, (INVERT_Y_DIR == INVERT_Y2_VS_Y_DIR));
|
||||
#endif
|
||||
|
||||
count_direction[Y_AXIS]=1;
|
||||
}
|
||||
|
||||
|
@ -516,9 +526,18 @@ ISR(TIMER1_COMPA_vect)
|
|||
counter_y += current_block->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;
|
||||
|
@ -687,6 +706,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);
|
||||
|
@ -714,6 +737,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);
|
||||
|
@ -791,6 +819,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)
|
||||
|
|
Loading…
Reference in a new issue