From cb676cdf39d3631dd1366e85221bda6c1f1f5f1b Mon Sep 17 00:00:00 2001 From: alexborro Date: Mon, 16 Mar 2015 16:31:25 -0300 Subject: [PATCH] Fix CoreXY homing bug introduced by PR #1606 The Check Endstop logic must be: if (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) == TEST(out_bits, Y_AXIS))) if (TEST(out_bits, X_HEAD)) not if (TEST(out_bits, X_HEAD) && (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) == TEST(out_bits, Y_AXIS)))) Same applies for Y axis. --- Marlin/stepper.cpp | 75 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index eb904bb2d..780712ba7 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -413,48 +413,49 @@ ISR(TIMER1_COMPA_vect) { #else // Head direction in -X axis for CoreXY bots. // If DeltaX == -DeltaY, the movement is only in Y axis - if (TEST(out_bits, X_HEAD) && (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) == TEST(out_bits, Y_AXIS)))) + if (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) == TEST(out_bits, Y_AXIS))) + if (TEST(out_bits, X_HEAD)) #endif - { // -direction - #ifdef DUAL_X_CARRIAGE - // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder - if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) - #endif - { - #if defined(X_MIN_PIN) && X_MIN_PIN >= 0 - UPDATE_ENDSTOP(x, X, min, MIN); + { // -direction + #ifdef DUAL_X_CARRIAGE + // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder + if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) + #endif + { + #if defined(X_MIN_PIN) && X_MIN_PIN >= 0 + UPDATE_ENDSTOP(x, X, min, MIN); + #endif + } + } + else { // +direction + #ifdef DUAL_X_CARRIAGE + // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder + if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1)) #endif + { + #if defined(X_MAX_PIN) && X_MAX_PIN >= 0 + UPDATE_ENDSTOP(x, X, max, MAX); + #endif + } } - } - else { // +direction - #ifdef DUAL_X_CARRIAGE - // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder - if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1)) - #endif - { - #if defined(X_MAX_PIN) && X_MAX_PIN >= 0 - UPDATE_ENDSTOP(x, X, max, MAX); + #ifndef COREXY + if (TEST(out_bits, Y_AXIS)) // -direction + #else + // Head direction in -Y axis for CoreXY bots. + // If DeltaX == DeltaY, the movement is only in X axis + if (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) != TEST(out_bits, Y_AXIS))) + if (TEST(out_bits, Y_HEAD)) + #endif + { // -direction + #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0 + UPDATE_ENDSTOP(y, Y, min, MIN); + #endif + } + else { // +direction + #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0 + UPDATE_ENDSTOP(y, Y, max, MAX); #endif } - } - - #ifndef COREXY - if (TEST(out_bits, Y_AXIS)) // -direction - #else - // Head direction in -Y axis for CoreXY bots. - // If DeltaX == DeltaY, the movement is only in X axis - if (TEST(out_bits, Y_HEAD) && (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) != TEST(out_bits, Y_AXIS)))) - #endif - { // -direction - #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0 - UPDATE_ENDSTOP(y, Y, min, MIN); - #endif - } - else { // +direction - #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0 - UPDATE_ENDSTOP(y, Y, max, MAX); - #endif - } } if (TEST(out_bits, Z_AXIS)) { // -direction