Fix CoreXY Homing Routine.

Fixed how stepper ISR figure it out when the head (extruder) is going to
Min or Max direction.
Added Homing to Max Endstops.
This commit is contained in:
alexborro 2015-02-13 14:38:05 -02:00
parent 7866fa161f
commit afc737ca0c
3 changed files with 20 additions and 13 deletions

View File

@ -326,11 +326,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS
// Disable max endstops for compatibility with endstop checking routine
#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
#define DISABLE_MAX_ENDSTOPS
#endif
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
#define X_ENABLE_ON 0 #define X_ENABLE_ON 0
#define Y_ENABLE_ON 0 #define Y_ENABLE_ON 0

View File

@ -629,13 +629,21 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
block->direction_bits |= (1<<Y_AXIS); block->direction_bits |= (1<<Y_AXIS);
} }
#else #else
if (target[X_AXIS] < position[X_AXIS])
{
block->direction_bits |= (1<<X_HEAD); //AlexBorro: Save the real Extruder (head) direction in X Axis
}
if (target[Y_AXIS] < position[Y_AXIS])
{
block->direction_bits |= (1<<Y_HEAD); //AlexBorro: Save the real Extruder (head) direction in Y Axis
}
if ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]) < 0) if ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]) < 0)
{ {
block->direction_bits |= (1<<X_AXIS); block->direction_bits |= (1<<X_AXIS); //AlexBorro: Motor A direction (Incorrectly implemented as X_AXIS)
} }
if ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]) < 0) if ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]) < 0)
{ {
block->direction_bits |= (1<<Y_AXIS); block->direction_bits |= (1<<Y_AXIS); //AlexBorro: Motor B direction (Incorrectly implemented as Y_AXIS)
} }
#endif #endif
if (target[Z_AXIS] < position[Z_AXIS]) if (target[Z_AXIS] < position[Z_AXIS])

View File

@ -401,10 +401,11 @@ ISR(TIMER1_COMPA_vect)
// Set direction en check limit switches // Set direction en check limit switches
#ifndef COREXY #ifndef COREXY
if ((out_bits & (1<<X_AXIS)) != 0) { // stepping along -X axis if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis
#else #else
if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) != 0)) { //-X occurs for -A and -B if ((out_bits & (1<<X_HEAD)) != 0) //AlexBorro: Head direction in -X axis for CoreXY bots.
#endif #endif
{
CHECK_ENDSTOPS CHECK_ENDSTOPS
{ {
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
@ -425,7 +426,8 @@ ISR(TIMER1_COMPA_vect)
} }
} }
} }
else { // +direction else
{ // +direction
CHECK_ENDSTOPS CHECK_ENDSTOPS
{ {
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
@ -448,10 +450,11 @@ ISR(TIMER1_COMPA_vect)
} }
#ifndef COREXY #ifndef COREXY
if ((out_bits & (1<<Y_AXIS)) != 0) { // -direction if ((out_bits & (1<<Y_AXIS)) != 0) // -direction
#else #else
if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) == 0)) { // -Y occurs for -A and +B if ((out_bits & (1<<Y_HEAD)) != 0) //AlexBorro: Head direction in -Y axis for CoreXY bots.
#endif #endif
{
CHECK_ENDSTOPS CHECK_ENDSTOPS
{ {
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
@ -465,7 +468,8 @@ ISR(TIMER1_COMPA_vect)
#endif #endif
} }
} }
else { // +direction else
{ // +direction
CHECK_ENDSTOPS CHECK_ENDSTOPS
{ {
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1 #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1