mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 20:18:52 +00:00
CORExx endstop detection fixes
1. The CORExx printers were checking more endstop axis than needed. 2. Removed all the CORE_xx_NOT logic. The motor_direction(xx) routine always returns the correct data so it is not needed. It was actually cause the wrong direction to be checked in some cases. 3. Made the logic/defines for X, Y & Z axis all the same. The old logic checked inappropriate configurations for Y and didn't check all the correct configurations on Z. 4. Added a check for zero steps before the X, Y & Z axis. Previously would check the they axis even if there were no movement.
This commit is contained in:
parent
28fec61f92
commit
445d39e95a
@ -266,39 +266,48 @@ void Endstops::update() {
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
|
#if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
|
||||||
// If G38 command then check Z_MIN_PROBE for every axis and every direction
|
// If G38 command is active check Z_MIN_PROBE for ALL movement
|
||||||
if (G38_move) {
|
if (G38_move) {
|
||||||
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
|
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
|
||||||
if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
|
if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
|
||||||
if (stepper.current_block->steps[_AXIS(X)] > 0) {_ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X));}
|
if (stepper.current_block->steps[_AXIS(X)] > 0) { _ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X)); }
|
||||||
else if (stepper.current_block->steps[_AXIS(Y)] > 0) {_ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y));}
|
else if (stepper.current_block->steps[_AXIS(Y)] > 0) { _ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y)); }
|
||||||
else if (stepper.current_block->steps[_AXIS(Z)] > 0) {_ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z));}
|
else if (stepper.current_block->steps[_AXIS(Z)] > 0) { _ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z)); }
|
||||||
G38_endstop_hit = true;
|
G38_endstop_hit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CORE_IS_XY || CORE_IS_XZ
|
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
||||||
#if ENABLED(COREYX) || ENABLED(COREZX)
|
|
||||||
#define CORE_X_CMP !=
|
|
||||||
#define CORE_X_NOT !
|
|
||||||
#else
|
|
||||||
#define CORE_X_CMP ==
|
#define CORE_X_CMP ==
|
||||||
#define CORE_X_NOT
|
#elif ENABLED(COREYX) || ENABLED(COREZX)
|
||||||
|
#define CORE_X_CMP !=
|
||||||
#endif
|
#endif
|
||||||
// Head direction in -X axis for CoreXY and CoreXZ bots.
|
|
||||||
// If steps differ, both axes are moving.
|
/**
|
||||||
// If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below)
|
* Head direction in -X axis for CoreXY and CoreXZ bots.
|
||||||
// If DeltaA == DeltaB, the movement is only in the 1st axis (X)
|
*
|
||||||
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_X_CMP stepper.motor_direction(CORE_AXIS_2)) {
|
* If steps differ, both axes are moving.
|
||||||
if (CORE_X_NOT stepper.motor_direction(X_HEAD))
|
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below)
|
||||||
|
* If DeltaA == DeltaB, the movement is only in the 1st axis (X)
|
||||||
|
*/
|
||||||
|
#if CORE_IS_XY || CORE_IS_XZ
|
||||||
|
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]
|
||||||
|
|| ( stepper.current_block->steps[CORE_AXIS_1] > 0
|
||||||
|
&& stepper.motor_direction(CORE_AXIS_1) CORE_X_CMP stepper.motor_direction(CORE_AXIS_2)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (stepper.motor_direction(X_HEAD))
|
||||||
#else
|
#else
|
||||||
|
if (stepper.current_block->steps[X_AXIS] > 0)
|
||||||
if (stepper.motor_direction(X_AXIS)) // stepping along -X axis (regular Cartesian bot)
|
if (stepper.motor_direction(X_AXIS)) // stepping along -X axis (regular Cartesian bot)
|
||||||
#endif
|
#endif
|
||||||
{ // -direction
|
{ // -direction
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
||||||
if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR < 0) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR < 0))
|
if ( (stepper.current_block->active_extruder == 0 && X_HOME_DIR < 0)
|
||||||
|
|| (stepper.current_block->active_extruder != 0 && X2_HOME_DIR < 0)
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if HAS_X_MIN
|
#if HAS_X_MIN
|
||||||
@ -309,7 +318,9 @@ void Endstops::update() {
|
|||||||
else { // +direction
|
else { // +direction
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
||||||
if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR > 0) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR > 0))
|
if ( (stepper.current_block->active_extruder == 0 && X_HOME_DIR > 0)
|
||||||
|
|| (stepper.current_block->active_extruder != 0 && X2_HOME_DIR > 0)
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if HAS_X_MAX
|
#if HAS_X_MAX
|
||||||
@ -322,22 +333,28 @@ void Endstops::update() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handle swapped vs. typical Core axis order
|
// Handle swapped vs. typical Core axis order
|
||||||
#if ENABLED(COREYX) || ENABLED(COREZY) || ENABLED(COREZX)
|
#if ENABLED(COREYX) || ENABLED(COREYZ)
|
||||||
#define CORE_YZ_CMP ==
|
#define CORE_YZ_CMP ==
|
||||||
#define CORE_YZ_NOT !
|
#elif ENABLED(COREXY) || ENABLED(COREZY)
|
||||||
#elif CORE_IS_XY || CORE_IS_YZ || CORE_IS_XZ
|
|
||||||
#define CORE_YZ_CMP !=
|
#define CORE_YZ_CMP !=
|
||||||
#define CORE_YZ_NOT
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CORE_IS_XY || CORE_IS_YZ
|
#if CORE_IS_XY || CORE_IS_YZ
|
||||||
// Head direction in -Y axis for CoreXY / CoreYZ bots.
|
/**
|
||||||
// If steps differ, both axes are moving
|
* Head direction in -Y axis for CoreXY / CoreYZ bots.
|
||||||
// If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y)
|
*
|
||||||
// If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z)
|
* If steps differ, both axes are moving
|
||||||
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)) {
|
* If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y)
|
||||||
if (CORE_YZ_NOT stepper.motor_direction(Y_HEAD))
|
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z)
|
||||||
|
*/
|
||||||
|
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]
|
||||||
|
|| ( stepper.current_block->steps[CORE_AXIS_1] > 0
|
||||||
|
&& stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (stepper.motor_direction(Y_HEAD))
|
||||||
#else
|
#else
|
||||||
|
if (stepper.current_block->steps[Y_AXIS] > 0)
|
||||||
if (stepper.motor_direction(Y_AXIS)) // -direction
|
if (stepper.motor_direction(Y_AXIS)) // -direction
|
||||||
#endif
|
#endif
|
||||||
{ // -direction
|
{ // -direction
|
||||||
@ -354,19 +371,33 @@ void Endstops::update() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if ENABLED(COREZX) || ENABLED(COREZY)
|
||||||
|
#define CORE_YZ_CMP ==
|
||||||
|
#elif ENABLED(COREXZ) || ENABLED(COREYZ)
|
||||||
|
#define CORE_YZ_CMP !=
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CORE_IS_XZ || CORE_IS_YZ
|
#if CORE_IS_XZ || CORE_IS_YZ
|
||||||
// Head direction in -Z axis for CoreXZ or CoreYZ bots.
|
/**
|
||||||
// If steps differ, both axes are moving
|
* Head direction in -Z axis for CoreXZ or CoreYZ bots.
|
||||||
// If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above)
|
*
|
||||||
// If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z)
|
* If steps differ, both axes are moving
|
||||||
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2] || stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)) {
|
* If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above)
|
||||||
if (CORE_YZ_NOT stepper.motor_direction(Z_HEAD))
|
* If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z)
|
||||||
|
*/
|
||||||
|
if (stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]
|
||||||
|
|| ( stepper.current_block->steps[CORE_AXIS_1] > 0
|
||||||
|
&& stepper.motor_direction(CORE_AXIS_1) CORE_YZ_CMP stepper.motor_direction(CORE_AXIS_2)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (stepper.motor_direction(Z_HEAD))
|
||||||
#else
|
#else
|
||||||
|
if (stepper.current_block->steps[Z_AXIS] > 0)
|
||||||
if (stepper.motor_direction(Z_AXIS))
|
if (stepper.motor_direction(Z_AXIS))
|
||||||
#endif
|
#endif
|
||||||
{ // Z -direction. Gantry down, bed up.
|
{ // Z -direction. Gantry down, bed up.
|
||||||
#if HAS_Z_MIN
|
#if HAS_Z_MIN
|
||||||
|
|
||||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
|
||||||
UPDATE_ENDSTOP_BIT(Z, MIN);
|
UPDATE_ENDSTOP_BIT(Z, MIN);
|
||||||
|
Loading…
Reference in New Issue
Block a user