From 430eedf5c09fe48b1e5ee470f57d7cc5f13b017a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 16 Aug 2024 14:35:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Optional=20IJKUVW=20endstops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/endstops.cpp | 61 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 5cee425bef8c..8d6f384689a7 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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) @@ -944,14 +943,14 @@ 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 @@ -959,14 +958,14 @@ void Endstops::update() { } #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 @@ -974,14 +973,14 @@ void Endstops::update() { } #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 @@ -989,14 +988,14 @@ void Endstops::update() { } #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 @@ -1004,14 +1003,14 @@ void Endstops::update() { } #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 @@ -1019,14 +1018,14 @@ void Endstops::update() { } #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