CoreYX/YZ/ZX needs different endstop logic than CoreXY/YZ/XZ
In the endstop testing section, add the "reverse" logic in addition to "normal" core handling. In CoreXY/YZ/XZ steppers rotating the same direction gives X movement. Opposing directions produces Y movement. In CoreYX/ZY/ZX this is reversed. Same = Y, Opposite = X. ---- Fixes the issue where the Y endstop was being checked when moving in the X direction, etc.
This commit is contained in:
parent
493e738575
commit
c5e08e8761
2 changed files with 30 additions and 14 deletions
|
@ -226,10 +226,10 @@ script:
|
||||||
- opt_enable COREXY
|
- opt_enable COREXY
|
||||||
- build_marlin
|
- build_marlin
|
||||||
#
|
#
|
||||||
# Enable COREXZ
|
# Enable COREYX (swapped)
|
||||||
#
|
#
|
||||||
- restore_configs
|
- restore_configs
|
||||||
- opt_enable COREXZ
|
- opt_enable COREYX
|
||||||
- build_marlin
|
- build_marlin
|
||||||
#
|
#
|
||||||
# Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
|
# Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
|
||||||
|
|
|
@ -274,16 +274,23 @@ void Endstops::update() {
|
||||||
|
|
||||||
#if CORE_IS_XY || CORE_IS_XZ
|
#if CORE_IS_XY || CORE_IS_XZ
|
||||||
// Head direction in -X axis for CoreXY and CoreXZ bots.
|
// Head direction in -X axis for CoreXY and CoreXZ bots.
|
||||||
// If DeltaA == -DeltaB, the movement is only in Y or Z axis
|
// If DeltaA == -DeltaB, the movement is only in only one axis
|
||||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) == stepper.motor_direction(CORE_AXIS_2))) {
|
#if ENABLED(COREYX) || ENABLED(COREZX)
|
||||||
if (stepper.motor_direction(X_HEAD))
|
#define CORE_X_CMP !=
|
||||||
|
#define CORE_X_NOT !
|
||||||
|
#else
|
||||||
|
#define CORE_X_CMP ==
|
||||||
|
#define CORE_X_NOT
|
||||||
|
#endif
|
||||||
|
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 (CORE_X_NOT stepper.motor_direction(X_HEAD))
|
||||||
#else
|
#else
|
||||||
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 == -1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == -1))
|
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
|
||||||
|
@ -294,7 +301,7 @@ 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 == 1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == 1))
|
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
|
||||||
|
@ -306,11 +313,20 @@ void Endstops::update() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle swapped vs. typical Core axis order
|
||||||
|
#if ENABLED(COREYX) || ENABLED(COREZY) || ENABLED(COREZX)
|
||||||
|
#define CORE_YZ_CMP ==
|
||||||
|
#define CORE_YZ_NOT !
|
||||||
|
#elif CORE_IS_XY || CORE_IS_YZ || CORE_IS_XZ
|
||||||
|
#define CORE_YZ_CMP !=
|
||||||
|
#define CORE_YZ_NOT
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CORE_IS_XY || CORE_IS_YZ
|
#if CORE_IS_XY || CORE_IS_YZ
|
||||||
// Head direction in -Y axis for CoreXY / CoreYZ bots.
|
// Head direction in -Y axis for CoreXY / CoreYZ bots.
|
||||||
// If DeltaA == DeltaB, the movement is only in X or Y axis
|
// If DeltaA == DeltaB, the movement is in only one axis
|
||||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
|
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 (stepper.motor_direction(Y_HEAD))
|
if (CORE_YZ_NOT stepper.motor_direction(Y_HEAD))
|
||||||
#else
|
#else
|
||||||
if (stepper.motor_direction(Y_AXIS)) // -direction
|
if (stepper.motor_direction(Y_AXIS)) // -direction
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,9 +346,9 @@ void Endstops::update() {
|
||||||
|
|
||||||
#if CORE_IS_XZ || CORE_IS_YZ
|
#if CORE_IS_XZ || CORE_IS_YZ
|
||||||
// Head direction in -Z axis for CoreXZ or CoreYZ bots.
|
// Head direction in -Z axis for CoreXZ or CoreYZ bots.
|
||||||
// If DeltaA == DeltaB, the movement is only in X or Y axis
|
// If DeltaA == DeltaB, the movement is in only one axis
|
||||||
if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
|
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 (stepper.motor_direction(Z_HEAD))
|
if (CORE_YZ_NOT stepper.motor_direction(Z_HEAD))
|
||||||
#else
|
#else
|
||||||
if (stepper.motor_direction(Z_AXIS))
|
if (stepper.motor_direction(Z_AXIS))
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in a new issue