Skip to content

Commit

Permalink
👷 Optional IJKUVW endstops
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 16, 2024
1 parent 793a851 commit 430eedf
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,19 +823,16 @@ void Endstops::update() {
#endif

#if ENABLED(CALIBRATION_GCODE)
if (calibration_probe_enabled) {
#if HAS_CALIBRATION_STATE
if (TEST(live_state, CALIBRATION) == calibration_stop_state) stepper.quick_stop();
#else
if (TEST(live_state, Z_MIN_PROBE) == calibration_stop_state) stepper.quick_stop();
#endif
}
if (calibration_probe_enabled
&& calibration_stop_state == TEST(live_state, TERN(HAS_CALIBRATION_STATE, CALIBRATION, Z_MIN_PROBE)))
stepper.quick_stop();
#endif

// Signal, after validation, if an endstop limit is pressed or not

#if HAS_X_AXIS
if (stepper.axis_is_moving(X_AXIS)) {
if (!stepper.motor_direction(X_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(X_AXIS_HEAD)) {
#if HAS_X_MIN_STATE
PROCESS_ENDSTOP_X(MIN);
#if CORE_DIAG(XY, Y, MIN)
Expand All @@ -849,7 +846,7 @@ void Endstops::update() {
#endif
#endif
}
else { // +direction
else {
#if HAS_X_MAX_STATE
PROCESS_ENDSTOP_X(MAX);
#if CORE_DIAG(XY, Y, MIN)
Expand All @@ -868,7 +865,7 @@ void Endstops::update() {

#if HAS_Y_AXIS
if (stepper.axis_is_moving(Y_AXIS)) {
if (!stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(Y_AXIS_HEAD)) {
#if HAS_Y_MIN_STATE
PROCESS_ENDSTOP_Y(MIN);
#if CORE_DIAG(XY, X, MIN)
Expand All @@ -882,7 +879,7 @@ void Endstops::update() {
#endif
#endif
}
else { // +direction
else {
#if HAS_Y_MAX_STATE
PROCESS_ENDSTOP_Y(MAX);
#if CORE_DIAG(XY, X, MIN)
Expand All @@ -901,7 +898,8 @@ void Endstops::update() {

#if HAS_Z_AXIS
if (stepper.axis_is_moving(Z_AXIS)) {
if (!stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
if (!stepper.motor_direction(Z_AXIS_HEAD)) {
// Z- : Gantry down, bed up
#if HAS_Z_MIN_STATE
// If the Z_MIN_PIN is being used for the probe there's no
// separate Z_MIN endstop. But a Z endstop could be wired
Expand All @@ -927,7 +925,8 @@ void Endstops::update() {
if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE);
#endif
}
else { // Z +direction. Gantry up, bed down.
else {
// Z+ : Gantry up, bed down
#if HAS_Z_MAX_STATE
PROCESS_ENDSTOP_Z(MAX);
#if CORE_DIAG(XZ, X, MIN)
Expand All @@ -944,89 +943,89 @@ void Endstops::update() {
}
#endif // HAS_Z_AXIS

#if HAS_I_AXIS
#if HAS_I_AXIS && HAS_I_STATE
if (stepper.axis_is_moving(I_AXIS)) {
if (!stepper.motor_direction(I_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(I_AXIS_HEAD)) {
#if HAS_I_MIN_STATE
PROCESS_ENDSTOP(I, MIN);
#endif
}
else { // +direction
else {
#if HAS_I_MAX_STATE
PROCESS_ENDSTOP(I, MAX);
#endif
}
}
#endif // HAS_I_AXIS

#if HAS_J_AXIS
#if HAS_J_AXIS && HAS_J_STATE
if (stepper.axis_is_moving(J_AXIS)) {
if (!stepper.motor_direction(J_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(J_AXIS_HEAD)) {
#if HAS_J_MIN_STATE
PROCESS_ENDSTOP(J, MIN);
#endif
}
else { // +direction
else {
#if HAS_J_MAX_STATE
PROCESS_ENDSTOP(J, MAX);
#endif
}
}
#endif // HAS_J_AXIS

#if HAS_K_AXIS
#if HAS_K_AXIS && HAS_K_STATE
if (stepper.axis_is_moving(K_AXIS)) {
if (!stepper.motor_direction(K_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(K_AXIS_HEAD)) {
#if HAS_K_MIN_STATE
PROCESS_ENDSTOP(K, MIN);
#endif
}
else { // +direction
else {
#if HAS_K_MAX_STATE
PROCESS_ENDSTOP(K, MAX);
#endif
}
}
#endif // HAS_K_AXIS

#if HAS_U_AXIS
#if HAS_U_AXIS && HAS_U_STATE
if (stepper.axis_is_moving(U_AXIS)) {
if (!stepper.motor_direction(U_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(U_AXIS_HEAD)) {
#if HAS_U_MIN_STATE
PROCESS_ENDSTOP(U, MIN);
#endif
}
else { // +direction
else {
#if HAS_U_MAX_STATE
PROCESS_ENDSTOP(U, MAX);
#endif
}
}
#endif // HAS_U_AXIS

#if HAS_V_AXIS
#if HAS_V_AXIS && HAS_V_STATE
if (stepper.axis_is_moving(V_AXIS)) {
if (!stepper.motor_direction(V_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(V_AXIS_HEAD)) {
#if HAS_V_MIN_STATE
PROCESS_ENDSTOP(V, MIN);
#endif
}
else { // +direction
else {
#if HAS_V_MAX_STATE
PROCESS_ENDSTOP(V, MAX);
#endif
}
}
#endif // HAS_V_AXIS

#if HAS_W_AXIS
#if HAS_W_AXIS && HAS_W_STATE
if (stepper.axis_is_moving(W_AXIS)) {
if (!stepper.motor_direction(W_AXIS_HEAD)) { // -direction
if (!stepper.motor_direction(W_AXIS_HEAD)) {
#if HAS_W_MIN_STATE
PROCESS_ENDSTOP(W, MIN);
#endif
}
else { // +direction
else {
#if HAS_W_MAX_STATE
PROCESS_ENDSTOP(W, MAX);
#endif
Expand Down

0 comments on commit 430eedf

Please sign in to comment.