From 4233e4864f0c621612ce35a9b6ca882312e3aa4d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 22 Apr 2023 01:56:10 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20MarlinUI=20Endstop=20Test=20Scre?= =?UTF-8?q?en,=20and=20more=20(#25667)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 3 + Marlin/src/gcode/calibrate/G425.cpp | 36 +- Marlin/src/gcode/calibrate/M425.cpp | 7 +- Marlin/src/inc/Conditionals_post.h | 51 +- Marlin/src/inc/SanityCheck.h | 108 +-- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 35 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 40 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 32 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 36 +- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 34 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 88 +- Marlin/src/lcd/language/language_en.h | 3 + Marlin/src/lcd/menu/menu.h | 5 +- Marlin/src/lcd/menu/menu_configuration.cpp | 89 +- Marlin/src/lcd/menu/menu_info.cpp | 96 +- Marlin/src/lcd/menu/menu_item.h | 32 +- Marlin/src/lcd/tft/ui_common.cpp | 23 +- Marlin/src/module/endstops.h | 91 +- Marlin/src/module/motion.cpp | 29 +- Marlin/src/module/probe.cpp | 8 +- Marlin/src/pins/pins_postprocess.h | 898 +++++++++---------- buildroot/tests/STM32F103RE_creality | 15 +- 22 files changed, 960 insertions(+), 799 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 294cc4448795..993e0d8dde71 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1512,6 +1512,9 @@ // Insert a menu for preheating at the top level to allow for quick access //#define PREHEAT_SHORTCUT_MENU_ITEM + // Add Configuration > Debug Menu > Endstop Test for endstop/probe/runout testing + //#define LCD_ENDSTOP_TEST + #endif // HAS_MARLINUI_MENU #if HAS_DISPLAY diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index a22608f5b42b..e3f8913125ff 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -271,10 +271,10 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t #if AXIS_CAN_CALIBRATE(X) _ACASE(X, RIGHT, LEFT); #endif - #if HAS_Y_AXIS && AXIS_CAN_CALIBRATE(Y) + #if AXIS_CAN_CALIBRATE(Y) _ACASE(Y, BACK, FRONT); #endif - #if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z) + #if AXIS_CAN_CALIBRATE(Z) case TOP: { const float measurement = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); m.obj_center.z = measurement - dimensions.z / 2; @@ -282,22 +282,22 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t return; } #endif - #if HAS_I_AXIS && AXIS_CAN_CALIBRATE(I) + #if AXIS_CAN_CALIBRATE(I) _PCASE(I); #endif - #if HAS_J_AXIS && AXIS_CAN_CALIBRATE(J) + #if AXIS_CAN_CALIBRATE(J) _PCASE(J); #endif - #if HAS_K_AXIS && AXIS_CAN_CALIBRATE(K) + #if AXIS_CAN_CALIBRATE(K) _PCASE(K); #endif - #if HAS_U_AXIS && AXIS_CAN_CALIBRATE(U) + #if AXIS_CAN_CALIBRATE(U) _PCASE(U); #endif - #if HAS_V_AXIS && AXIS_CAN_CALIBRATE(V) + #if AXIS_CAN_CALIBRATE(V) _PCASE(V); #endif - #if HAS_W_AXIS && AXIS_CAN_CALIBRATE(W) + #if AXIS_CAN_CALIBRATE(W) _PCASE(W); #endif default: return; @@ -395,7 +395,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { #if ENABLED(CALIBRATION_REPORTING) inline void report_measured_faces(const measurements_t &m) { SERIAL_ECHOLNPGM("Sides:"); - #if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z) + #if AXIS_CAN_CALIBRATE(Z) SERIAL_ECHOLNPGM(" Top: ", m.obj_side[TOP]); #endif #if ENABLED(CALIBRATION_MEASURE_LEFT) @@ -503,7 +503,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" Right: ", m.backlash[RIGHT]); #endif #endif - #if HAS_Y_AXIS && AXIS_CAN_CALIBRATE(Y) + #if AXIS_CAN_CALIBRATE(Y) #if ENABLED(CALIBRATION_MEASURE_FRONT) SERIAL_ECHOLNPGM(" Front: ", m.backlash[FRONT]); #endif @@ -511,10 +511,10 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" Back: ", m.backlash[BACK]); #endif #endif - #if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z) + #if AXIS_CAN_CALIBRATE(Z) SERIAL_ECHOLNPGM(" Top: ", m.backlash[TOP]); #endif - #if HAS_I_AXIS && AXIS_CAN_CALIBRATE(I) + #if AXIS_CAN_CALIBRATE(I) #if ENABLED(CALIBRATION_MEASURE_IMIN) SERIAL_ECHOLNPGM(" " STR_I_MIN ": ", m.backlash[IMINIMUM]); #endif @@ -522,7 +522,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" " STR_I_MAX ": ", m.backlash[IMAXIMUM]); #endif #endif - #if HAS_J_AXIS && AXIS_CAN_CALIBRATE(J) + #if AXIS_CAN_CALIBRATE(J) #if ENABLED(CALIBRATION_MEASURE_JMIN) SERIAL_ECHOLNPGM(" " STR_J_MIN ": ", m.backlash[JMINIMUM]); #endif @@ -530,7 +530,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" " STR_J_MAX ": ", m.backlash[JMAXIMUM]); #endif #endif - #if HAS_K_AXIS && AXIS_CAN_CALIBRATE(K) + #if AXIS_CAN_CALIBRATE(K) #if ENABLED(CALIBRATION_MEASURE_KMIN) SERIAL_ECHOLNPGM(" " STR_K_MIN ": ", m.backlash[KMINIMUM]); #endif @@ -538,7 +538,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" " STR_K_MAX ": ", m.backlash[KMAXIMUM]); #endif #endif - #if HAS_U_AXIS && AXIS_CAN_CALIBRATE(U) + #if AXIS_CAN_CALIBRATE(U) #if ENABLED(CALIBRATION_MEASURE_UMIN) SERIAL_ECHOLNPGM(" " STR_U_MIN ": ", m.backlash[UMINIMUM]); #endif @@ -546,7 +546,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" " STR_U_MAX ": ", m.backlash[UMAXIMUM]); #endif #endif - #if HAS_V_AXIS && AXIS_CAN_CALIBRATE(V) + #if AXIS_CAN_CALIBRATE(V) #if ENABLED(CALIBRATION_MEASURE_VMIN) SERIAL_ECHOLNPGM(" " STR_V_MIN ": ", m.backlash[VMINIMUM]); #endif @@ -554,7 +554,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM(" " STR_V_MAX ": ", m.backlash[VMAXIMUM]); #endif #endif - #if HAS_W_AXIS && AXIS_CAN_CALIBRATE(W) + #if AXIS_CAN_CALIBRATE(W) #if ENABLED(CALIBRATION_MEASURE_WMIN) SERIAL_ECHOLNPGM(" " STR_W_MIN ": ", m.backlash[WMINIMUM]); #endif @@ -575,7 +575,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { #if HAS_Y_CENTER && AXIS_CAN_CALIBRATE(Y) SERIAL_ECHOLNPGM_P(SP_Y_STR, m.pos_error.y); #endif - #if HAS_Z_AXIS && AXIS_CAN_CALIBRATE(Z) + #if AXIS_CAN_CALIBRATE(Z) SERIAL_ECHOLNPGM_P(SP_Z_STR, m.pos_error.z); #endif #if HAS_I_CENTER && AXIS_CAN_CALIBRATE(I) diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp index a6c6ff9dae3e..0432b4c96275 100644 --- a/Marlin/src/gcode/calibrate/M425.cpp +++ b/Marlin/src/gcode/calibrate/M425.cpp @@ -46,12 +46,13 @@ void GcodeSuite::M425() { bool noArgs = true; - auto axis_can_calibrate = [](const uint8_t a) { - #define _CAN_CASE(N) case N##_AXIS: return AXIS_CAN_CALIBRATE(N); + auto axis_can_calibrate = [](const uint8_t a) -> bool { + #define _CAN_CASE(N) case N##_AXIS: return bool(AXIS_CAN_CALIBRATE(N)); switch (a) { - default: return false; MAIN_AXIS_MAP(_CAN_CASE) + default: break; } + return false; }; LOOP_NUM_AXES(a) { diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 96b7313f29d2..eaf2d03cea52 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -255,12 +255,14 @@ // Calibration codes only for non-core axes #if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE) #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) - #define CAN_CALIBRATE(A,B) (_AXIS(A) == B) + #define CAN_CALIBRATE(A,B) TERN0(HAS_##A##_AXIS, (_AXIS(A) == B)) #else - #define CAN_CALIBRATE(A,B) true + #define CAN_CALIBRATE(A,B) ENABLED(HAS_##A##_AXIS) #endif + #define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS) +#else + #define AXIS_CAN_CALIBRATE(A) false #endif -#define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS) /** * No adjustable bed on non-cartesians @@ -2296,6 +2298,49 @@ #define HAS_Z4_MAX 1 #endif +#if HAS_X_MIN || HAS_X_MAX + #define HAS_X_ENDSTOP 1 +#endif +#if HAS_X2_MIN || HAS_X2_MAX + #define HAS_X2_ENDSTOP 1 +#endif +#if HAS_Y_MIN || HAS_Y_MAX + #define HAS_Y_ENDSTOP 1 +#endif +#if HAS_Y2_MIN || HAS_Y2_MAX + #define HAS_Y2_ENDSTOP 1 +#endif +#if HAS_Z_MIN || HAS_Z_MAX + #define HAS_Z_ENDSTOP 1 +#endif +#if HAS_Z2_MIN || HAS_Z2_MAX + #define HAS_Z2_ENDSTOP 1 +#endif +#if HAS_Z3_MIN || HAS_Z3_MAX + #define HAS_Z3_ENDSTOP 1 +#endif +#if HAS_Z4_MIN || HAS_Z4_MAX + #define HAS_Z4_ENDSTOP 1 +#endif +#if HAS_I_MIN || HAS_I_MAX + #define HAS_I_ENDSTOP 1 +#endif +#if HAS_J_MIN || HAS_J_MAX + #define HAS_J_ENDSTOP 1 +#endif +#if HAS_K_MIN || HAS_K_MAX + #define HAS_K_ENDSTOP 1 +#endif +#if HAS_U_MIN || HAS_U_MAX + #define HAS_U_ENDSTOP 1 +#endif +#if HAS_V_MIN || HAS_V_MAX + #define HAS_V_ENDSTOP 1 +#endif +#if HAS_W_MIN || HAS_W_MAX + #define HAS_W_ENDSTOP 1 +#endif + #if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE) #define HAS_Z_MIN_PROBE_PIN 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index f5d0c785ebed..a7aec8e83383 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3618,41 +3618,41 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #if NONE(SPI_ENDSTOPS, ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS) #if X_SENSORLESS && X_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_XMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) for X_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMIN (or ENDSTOPPULLUPS) for X MIN homing." #elif X_SENSORLESS && X_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_XMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) for X_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_XMAX (or ENDSTOPPULLUPS) for X MAX homing." #elif Y_SENSORLESS && Y_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_YMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) for Y_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMIN (or ENDSTOPPULLUPS) for Y MIN homing." #elif Y_SENSORLESS && Y_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_YMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) for Y_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_YMAX (or ENDSTOPPULLUPS) for Y MAX homing." #elif Z_SENSORLESS && Z_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_ZMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) for Z_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) for Z MIN homing." #elif Z_SENSORLESS && Z_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_ZMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) for Z_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) for Z MAX homing." #elif I_SENSORLESS && I_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_IMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMIN (or ENDSTOPPULLUPS) for I_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMIN (or ENDSTOPPULLUPS) for I MIN homing." #elif I_SENSORLESS && I_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_IMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMAX (or ENDSTOPPULLUPS) for I_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMAX (or ENDSTOPPULLUPS) for I MAX homing." #elif J_SENSORLESS && J_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_JMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMIN (or ENDSTOPPULLUPS) for J_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMIN (or ENDSTOPPULLUPS) for J MIN homing." #elif J_SENSORLESS && J_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_JMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMAX (or ENDSTOPPULLUPS) for J_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMAX (or ENDSTOPPULLUPS) for J MAX homing." #elif K_SENSORLESS && K_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_KMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMIN (or ENDSTOPPULLUPS) for K_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMIN (or ENDSTOPPULLUPS) for K MIN homing." #elif K_SENSORLESS && K_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_KMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMAX (or ENDSTOPPULLUPS) for K_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMAX (or ENDSTOPPULLUPS) for K MAX homing." #elif U_SENSORLESS && U_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_UMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMIN (or ENDSTOPPULLUPS) for U_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMIN (or ENDSTOPPULLUPS) for U MIN homing." #elif U_SENSORLESS && U_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_UMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMAX (or ENDSTOPPULLUPS) for U_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_UMAX (or ENDSTOPPULLUPS) for U MAX homing." #elif V_SENSORLESS && V_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_VMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMIN (or ENDSTOPPULLUPS) for V_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMIN (or ENDSTOPPULLUPS) for V MIN homing." #elif V_SENSORLESS && V_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_VMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMAX (or ENDSTOPPULLUPS) for V_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_VMAX (or ENDSTOPPULLUPS) for V MAX homing." #elif W_SENSORLESS && W_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_WMIN) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMIN (or ENDSTOPPULLUPS) for W_MIN homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMIN (or ENDSTOPPULLUPS) for W MIN homing." #elif W_SENSORLESS && W_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_WMAX) - #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMAX (or ENDSTOPPULLUPS) for W_MAX homing." + #error "SENSORLESS_HOMING requires ENDSTOPPULLUP_WMAX (or ENDSTOPPULLUPS) for W MAX homing." #endif #endif @@ -3668,15 +3668,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(X,TMC2209) #if X_HOME_TO_MIN && X_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE HIGH for X_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE HIGH for X MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE LOW for X_MIN homing." + #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_HIT_STATE LOW for X MIN homing." #endif #elif X_HOME_TO_MAX && X_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE HIGH for X_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE HIGH for X MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE LOW for X_MAX homing." + #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_HIT_STATE LOW for X MAX homing." #endif #endif #undef _HIT_STATE @@ -3686,15 +3686,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(Y,TMC2209) #if Y_HOME_TO_MIN && Y_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE HIGH for Y_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE HIGH for Y MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE LOW for Y_MIN homing." + #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_HIT_STATE LOW for Y MIN homing." #endif #elif Y_HOME_TO_MAX && Y_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires Y_MAY_ENDSTOP_HIT_STATE HIGH for Y_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_HIT_STATE HIGH for Y MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires Y_MAY_ENDSTOP_HIT_STATE LOW for Y_MAX homing." + #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_HIT_STATE LOW for Y MAX homing." #endif #endif #undef _HIT_STATE @@ -3704,15 +3704,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(Z,TMC2209) #if Z_HOME_TO_MIN && Z_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE HIGH for Z_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE HIGH for Z MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE LOW for Z_MIN homing." + #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_HIT_STATE LOW for Z MIN homing." #endif #elif Z_HOME_TO_MAX && Z_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires Z_MAZ_ENDSTOP_HIT_STATE HIGH for Z_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_HIT_STATE HIGH for Z MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires Z_MAZ_ENDSTOP_HIT_STATE LOW for Z_MAX homing." + #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_HIT_STATE LOW for Z MAX homing." #endif #endif #undef _HIT_STATE @@ -3722,15 +3722,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(I,TMC2209) #if I_HOME_TO_MIN && I_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE HIGH for I_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE HIGH for I MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE LOW for I_MIN homing." + #error "SENSORLESS_HOMING requires I_MIN_ENDSTOP_HIT_STATE LOW for I MIN homing." #endif #elif I_HOME_TO_MAX && I_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires I_MAI_ENDSTOP_HIT_STATE HIGH for I_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires I_MAX_ENDSTOP_HIT_STATE HIGH for I MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires I_MAI_ENDSTOP_HIT_STATE LOW for I_MAX homing." + #error "SENSORLESS_HOMING requires I_MAX_ENDSTOP_HIT_STATE LOW for I MAX homing." #endif #endif #undef _HIT_STATE @@ -3740,15 +3740,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(J,TMC2209) #if J_HOME_TO_MIN && J_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE HIGH for J_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE HIGH for J MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE LOW for J_MIN homing." + #error "SENSORLESS_HOMING requires J_MIN_ENDSTOP_HIT_STATE LOW for J MIN homing." #endif #elif J_HOME_TO_MAX && J_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires J_MAJ_ENDSTOP_HIT_STATE HIGH for J_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires J_MAX_ENDSTOP_HIT_STATE HIGH for J MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires J_MAJ_ENDSTOP_HIT_STATE LOW for J_MAX homing." + #error "SENSORLESS_HOMING requires J_MAX_ENDSTOP_HIT_STATE LOW for J MAX homing." #endif #endif #undef _HIT_STATE @@ -3758,15 +3758,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(K,TMC2209) #if K_HOME_TO_MIN && K_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE HIGH for K_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE HIGH for K MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE LOW for K_MIN homing." + #error "SENSORLESS_HOMING requires K_MIN_ENDSTOP_HIT_STATE LOW for K MIN homing." #endif #elif K_HOME_TO_MAX && K_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires K_MAK_ENDSTOP_HIT_STATE HIGH for K_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires K_MAX_ENDSTOP_HIT_STATE HIGH for K MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires K_MAK_ENDSTOP_HIT_STATE LOW for K_MAX homing." + #error "SENSORLESS_HOMING requires K_MAX_ENDSTOP_HIT_STATE LOW for K MAX homing." #endif #endif #undef _HIT_STATE @@ -3776,15 +3776,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(U,TMC2209) #if U_HOME_TO_MIN && U_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE HIGH for U_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE HIGH for U MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE LOW for U_MIN homing." + #error "SENSORLESS_HOMING requires U_MIN_ENDSTOP_HIT_STATE LOW for U MIN homing." #endif #elif U_HOME_TO_MAX && U_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires U_MAU_ENDSTOP_HIT_STATE HIGH for U_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires U_MAX_ENDSTOP_HIT_STATE HIGH for U MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires U_MAU_ENDSTOP_HIT_STATE LOW for U_MAX homing." + #error "SENSORLESS_HOMING requires U_MAX_ENDSTOP_HIT_STATE LOW for U MAX homing." #endif #endif #undef _HIT_STATE @@ -3794,15 +3794,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(V,TMC2209) #if V_HOME_TO_MIN && V_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE HIGH for V_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE HIGH for V MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE LOW for V_MIN homing." + #error "SENSORLESS_HOMING requires V_MIN_ENDSTOP_HIT_STATE LOW for V MIN homing." #endif #elif V_HOME_TO_MAX && V_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires V_MAV_ENDSTOP_HIT_STATE HIGH for V_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires V_MAX_ENDSTOP_HIT_STATE HIGH for V MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires V_MAV_ENDSTOP_HIT_STATE LOW for V_MAX homing." + #error "SENSORLESS_HOMING requires V_MAX_ENDSTOP_HIT_STATE LOW for V MAX homing." #endif #endif #undef _HIT_STATE @@ -3812,15 +3812,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #define _HIT_STATE AXIS_DRIVER_TYPE(W,TMC2209) #if W_HOME_TO_MIN && W_MIN_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE HIGH for W_MIN homing with TMC2209." + #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE HIGH for W MIN homing with TMC2209." #else - #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE LOW for W_MIN homing." + #error "SENSORLESS_HOMING requires W_MIN_ENDSTOP_HIT_STATE LOW for W MIN homing." #endif #elif W_HOME_TO_MAX && W_MAX_ENDSTOP_HIT_STATE != _HIT_STATE #if _HIT_STATE - #error "SENSORLESS_HOMING requires W_MAW_ENDSTOP_HIT_STATE HIGH for W_MAX homing with TMC2209." + #error "SENSORLESS_HOMING requires W_MAX_ENDSTOP_HIT_STATE HIGH for W MAX homing with TMC2209." #else - #error "SENSORLESS_HOMING requires W_MAW_ENDSTOP_HIT_STATE LOW for W_MAX homing." + #error "SENSORLESS_HOMING requires W_MAX_ENDSTOP_HIT_STATE LOW for W MAX homing." #endif #endif #undef _HIT_STATE diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index e4c0317d1239..8a5e5c5ad9e5 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -1137,17 +1137,38 @@ void MarlinUI::draw_status_screen() { #endif // ADVANCED_PAUSE_FEATURE // Draw a static item with no left-right margin required. Centered by default. - void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { - int8_t n = LCD_WIDTH; + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { lcd_moveto(0, row); + + int8_t n = LCD_WIDTH; + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); const int8_t plen = fstr ? utf8_strlen(fstr) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; - if (style & SS_CENTER) { - int8_t pad = (LCD_WIDTH - plen - vlen) / 2; - while (--pad >= 0) { lcd_put_u8str(F(" ")); n--; } + int8_t pad = (center || full) ? n - plen - vlen : 0; + + // SS_CENTER: Pad with half of the unused space first + if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) { lcd_put_u8str(F(" ")); n--; } + + // Draw as much of the label as fits + if (plen) { + const int8_t expl = n; + n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); + pad -= (expl - n - plen); // Reduce the padding } - if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); - if (vlen) n -= lcd_put_u8str_max(vstr, n); + + if (vlen && n > 0) { + // SS_FULL: Pad with enough space to justify the value + if (full && !center) { + // Move the leading colon from the value to the label + if (*vstr == ':') { n -= lcd_put_u8str(F(":")); vstr++; } + // Move spaces to the padding + while (*vstr == ' ') { vstr++; pad++; } + // Pad in-between + for (; pad > 0; --pad) { lcd_put_u8str(F(" ")); n--; } + } + n -= lcd_put_u8str_max(vstr, n); + } + for (; n > 0; --n) lcd_put_u8str(F(" ")); } diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index e4f9e4eafc08..fc568c55db1c 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -962,17 +962,41 @@ void MarlinUI::draw_status_screen() { #endif // Draw a static item with no left-right margin required. Centered by default. - void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const valstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { if (!PanelDetected) return; - uint8_t n = LCD_WIDTH; lcd_moveto(0, row); - if ((style & SS_CENTER) && !valstr) { - int8_t pad = (LCD_WIDTH - utf8_strlen(fstr)) / 2; - while (--pad >= 0) { lcd.write(' '); n--; } + + uint8_t n = LCD_WIDTH; + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); + const int8_t plen = fstr ? utf8_strlen(fstr) : 0, + vlen = vstr ? utf8_strlen(vstr) : 0; + int8_t pad = (center || full) ? n - plen - vlen : 0; + + // SS_CENTER: Pad with half of the unused space first + if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) { lcd.write(' '); n--; } + + // Draw as much of the label as fits + if (plen) { + const int8_t expl = n; + n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); + pad -= (expl - n - plen); // Reduce the padding } - n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); - if (valstr) n -= lcd_put_u8str_max(valstr, n); - for (; n; --n) lcd.write(' '); + + if (vlen && n > 0) { + // SS_FULL: Pad with enough space to justify the value + if (full && !center) { + // Move the leading colon from the value to the label + if (*vstr == ':') { lcd.write(':'); vstr++; n--; } + // Move spaces to the padding + while (*vstr == ' ') { vstr++; pad++; } + // Pad in-between + for (; pad > 0; --pad) { lcd.write(' '); n--; } + } + n -= lcd_put_u8str_max(vstr, n); + } + + for (; n > 0; --n) lcd.write(' '); + lcd.print_line(); } diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index aa32fd403f45..ce9a31668aa5 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -411,20 +411,38 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { if (mark_as_selected(row, style & SS_INVERT)) { pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed - const int plen = ftpl ? calculateWidth(ftpl) : 0, + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); + const int pwide = ftpl ? calculateWidth(ftpl) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; - if (style & SS_CENTER) { - int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2; - while (--pad >= 0) n -= lcd_put_u8str(F(" ")); + int pad = (center || full) ? ((LCD_PIXEL_WIDTH) - pwide - vlen * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH) : 0; + + // SS_CENTER: Pad with half of the unused space first + if (center) for (int lpad = pad / 2; lpad > 0; --lpad) n -= lcd_put_u8str(F(" ")); + + // Draw as much of the label as fits + if (pwide) { + const pixel_len_t expw = n; + n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); + pad -= (expw - n - pwide) / (MENU_FONT_WIDTH); // Reduce the padding } - if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); - if (vlen) n -= lcd_put_u8str_max(vstr, n); + if (vlen) { + // SS_FULL: Pad with enough space to justify the value + if (full && !center && n > MENU_FONT_WIDTH) { + // Move the leading colon from the value to the label + if (*vstr == ':') { n -= lcd_put_u8str(F(":")); vstr++; } + // Move spaces to the padding + while (*vstr == ' ') { vstr++; pad++; } + // Pad in-between + for (; pad > 0; --pad) n -= lcd_put_u8str(F(" ")); + } + n -= lcd_put_u8str_max(vstr, n); + } while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" ")); } } diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 778bed633590..c267d3204873 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -311,7 +311,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { // Call mark_as_selected to draw a bigger selection box // and draw the text without a background if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) { @@ -320,20 +320,38 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_font.fg = Color_White; dwin_string.set(); + + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); const int8_t plen = ftpl ? utf8_strlen(ftpl) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; - if (style & SS_CENTER) { - int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; - while (--pad) dwin_string.add(' '); + int8_t pad = (center || full) ? (LCD_WIDTH) - 1 - plen - vlen : 0; + + // SS_CENTER: Pad with half of the unused space first + if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) dwin_string.add(' '); + + // Append the templated label string + if (plen) { + dwin_string.add(ftpl, itemIndex, itemStringC, itemStringF); + pad -= dwin_string.length - plen; } - if (plen) dwin_string.add(ftpl, itemIndex, itemStringC, itemStringF); - if (vlen) dwin_string.add(vstr); - if (style & SS_CENTER) { - int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; - while (--pad) dwin_string.add(' '); + // SS_FULL: Pad with enough space to justify the value + if (vlen) { + if (full && !center) { + // Move the leading colon from the value to the label + if (*vstr == ':') { dwin_string.add(':'); vstr++; } + // Move spaces to the padding + while (*vstr == ' ') { vstr++; pad++; } + // Pad in-between + for (; pad > 0; --pad) dwin_string.add(' '); + } + // Append the value + dwin_string.add(vstr); } + // SS_CENTER: Pad the rest of the string + if (center) for (int8_t rpad = pad - (pad / 2); rpad > 0; --rpad) dwin_string.add(' '); + lcd_moveto(1, row); lcd_put_dwin_string(); } diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index c3edba53dff5..96ee73267833 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -66,42 +66,26 @@ void draw_es_state(const bool is_hit) { } void ESDiagClass::Draw() { - Title.ShowCaption(F("End-stops Diagnostic")); + Title.ShowCaption(GET_TEXT_F(MSG_ENDSTOP_TEST)); DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); DWINUI::Draw_Button(BTN_Continue, 86, 250); DWINUI::cursor.y = 80; #define ES_LABEL(S) draw_es_label(F(STR_##S)) - #if HAS_X_MIN - ES_LABEL(X_MIN); - #endif - #if HAS_Y_MIN - ES_LABEL(Y_MIN); - #endif - #if HAS_Z_MIN - ES_LABEL(Z_MIN); - #endif - #if HAS_FILAMENT_SENSOR - draw_es_label(F(STR_FILAMENT)); - #endif + TERN_(HAS_X_MIN, ES_LABEL(X_MIN)); TERN_(HAS_X_MAX, ES_LABEL(X_MAX)); + TERN_(HAS_Y_MIN, ES_LABEL(Y_MIN)); TERN_(HAS_Y_MAX, ES_LABEL(Y_MAX)); + TERN_(HAS_Z_MIN, ES_LABEL(Z_MIN)); TERN_(HAS_Z_MAX, ES_LABEL(Z_MAX)); + TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT))); Update(); } void ESDiagClass::Update() { DWINUI::cursor.y = 80; #define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) - #if HAS_X_MIN - ES_REPORT(X_MIN); - #endif - #if HAS_Y_MIN - ES_REPORT(Y_MIN); - #endif - #if HAS_Z_MIN - ES_REPORT(Z_MIN); - #endif - #if HAS_FILAMENT_SENSOR - draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE); - #endif + TERN_(HAS_X_MIN, ES_REPORT(X_MIN)); TERN_(HAS_X_MAX, ES_REPORT(X_MAX)); + TERN_(HAS_Y_MIN, ES_REPORT(Y_MIN)); TERN_(HAS_Y_MAX, ES_REPORT(Y_MAX)); + TERN_(HAS_Z_MIN, ES_REPORT(Z_MIN)); TERN_(HAS_Z_MAX, ES_REPORT(Z_MAX)); + TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)); DWIN_UpdateLCD(); } diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index d1679d402f09..24e177df392c 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -45,32 +45,32 @@ #if PIN_EXISTS(MT_DET_2) bool mt_det2_sta; #endif - #if X_HOME_DIR + #if HAS_X_ENDSTOP bool endstopx1_sta; #else constexpr static bool endstopx1_sta = true; #endif - #if HAS_X2_MIN || HAS_X2_MAX + #if HAS_X2_ENDSTOP bool endstopx2_sta; #else constexpr static bool endstopx2_sta = true; #endif - #if HAS_Y_AXIS && Y_HOME_DIR + #if HAS_Y_ENDSTOP bool endstopy1_sta; #else constexpr static bool endstopy1_sta = true; #endif - #if HAS_Y2_MIN || HAS_Y2_MAX + #if HAS_Y2_ENDSTOP bool endstopy2_sta; #else constexpr static bool endstopy2_sta = true; #endif - #if HAS_Z_AXIS && Z_HOME_DIR + #if HAS_Z_ENDSTOP bool endstopz1_sta; #else constexpr static bool endstopz1_sta = true; #endif - #if HAS_Z2_MIN || HAS_Z2_MAX + #if HAS_Z2_ENDSTOP bool endstopz2_sta; #else constexpr static bool endstopz2_sta = true; @@ -87,36 +87,12 @@ #if PIN_EXISTS(MT_DET_2) mt_det2_sta = (READ(MT_DET_2_PIN) == LOW); #endif - #if HAS_X_MIN - endstopx1_sta = ESTATE(X_MIN); - #elif HAS_X_MAX - endstopx1_sta = ESTATE(X_MAX); - #endif - #if HAS_X2_MIN - endstopx2_sta = ESTATE(X2_MIN); - #elif HAS_X2_MAX - endstopx2_sta = ESTATE(X2_MAX); - #endif - #if HAS_Y_MIN - endstopy1_sta = ESTATE(Y_MIN); - #elif HAS_Y_MAX - endstopy1_sta = ESTATE(Y_MAX); - #endif - #if HAS_Y2_MIN - endstopy2_sta = ESTATE(Y2_MIN); - #elif HAS_Y2_MAX - endstopy2_sta = ESTATE(Y2_MAX); - #endif - #if HAS_Z_MIN - endstopz1_sta = ESTATE(Z_MIN); - #elif HAS_Z_MAX - endstopz1_sta = ESTATE(Z_MAX); - #endif - #if HAS_Z2_MIN - endstopz2_sta = ESTATE(Z2_MIN); - #elif HAS_Z2_MAX - endstopz2_sta = ESTATE(Z2_MAX); - #endif + TERN_(HAS_X_ENDSTOP, endstopx1_sta = ESTATE(TERN(HAS_X_MIN, X_MIN, X_MAX))); + TERN_(HAS_X2_ENDSTOP, endstopx2_sta = ESTATE(TERN(HAS_X2_MIN, X2_MIN, X2_MAX))); + TERN_(HAS_Y_ENDSTOP, endstopy1_sta = ESTATE(TERN(HAS_Y_MIN, Y_MIN, Y_MAX))); + TERN_(HAS_Y2_ENDSTOP, endstopy2_sta = ESTATE(TERN(HAS_Y2_MIN, Y2_MIN, Y2_MAX))); + TERN_(HAS_Z_ENDSTOP, endstopz1_sta = ESTATE(TERN(HAS_Z_MIN, Z_MIN, Z_MAX))); + TERN_(HAS_Z2_ENDSTOP, endstopz2_sta = ESTATE(TERN(HAS_Z2_MIN, Z2_MIN, Z2_MAX))); } void test_gpio_readlevel_H() { @@ -128,36 +104,12 @@ #if PIN_EXISTS(MT_DET_2) mt_det2_sta = (READ(MT_DET_2_PIN) == HIGH); #endif - #if HAS_X_MIN - endstopx1_sta = !ESTATE(X_MIN); - #elif HAS_X_MAX - endstopx1_sta = !ESTATE(X_MAX); - #endif - #if HAS_X2_MIN - endstopx2_sta = !ESTATE(X2_MIN); - #elif HAS_X2_MAX - endstopx2_sta = !ESTATE(X2_MAX); - #endif - #if HAS_Y_MIN - endstopy1_sta = !ESTATE(Y_MIN); - #elif HAS_Y_MAX - endstopy1_sta = !ESTATE(Y_MAX); - #endif - #if HAS_Y2_MIN - endstopy2_sta = !ESTATE(Y2_MIN); - #elif HAS_Y2_MAX - endstopy2_sta = !ESTATE(Y2_MAX); - #endif - #if HAS_Z_MIN - endstopz1_sta = !ESTATE(Z_MIN); - #elif HAS_Z_MAX - endstopz1_sta = !ESTATE(Z_MAX); - #endif - #if HAS_Z2_MIN - endstopz2_sta = !ESTATE(Z2_MIN); - #elif HAS_Z2_MAX - endstopz2_sta = !ESTATE(Z2_MAX); - #endif + TERN_(HAS_X_ENDSTOP, endstopx1_sta = !ESTATE(TERN(HAS_X_MIN, X_MIN, X_MAX))); + TERN_(HAS_X2_ENDSTOP, endstopx2_sta = !ESTATE(TERN(HAS_X2_MIN, X2_MIN, X2_MAX))); + TERN_(HAS_Y_ENDSTOP, endstopy1_sta = !ESTATE(TERN(HAS_Y_MIN, Y_MIN, Y_MAX))); + TERN_(HAS_Y2_ENDSTOP, endstopy2_sta = !ESTATE(TERN(HAS_Y2_MIN, Y2_MIN, Y2_MAX))); + TERN_(HAS_Z_ENDSTOP, endstopz1_sta = !ESTATE(TERN(HAS_Z_MIN, Z_MIN, Z_MAX))); + TERN_(HAS_Z2_ENDSTOP, endstopz2_sta = !ESTATE(TERN(HAS_Z2_MIN, Z2_MIN, Z2_MAX))); } #include "../../../libs/buzzer.h" @@ -178,7 +130,9 @@ SET_INPUT_PULLUP(MKS_TEST_PS_ON_PIN); SET_INPUT_PULLUP(SERVO0_PIN); - OUT_WRITE(X_ENABLE_PIN, LOW); + #if HAS_X_AXIS + OUT_WRITE(X_ENABLE_PIN, LOW); + #endif #if HAS_Y_AXIS OUT_WRITE(Y_ENABLE_PIN, LOW); #endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 244d61a712ca..9a64587f15f2 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -76,6 +76,8 @@ namespace Language_en { LSTR MSG_DISABLE_STEPPERS = _UxGT("Disable Steppers"); LSTR MSG_DEBUG_MENU = _UxGT("Debug Menu"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Progress Bar Test"); + LSTR MSG_ENDSTOP_TEST = _UxGT("Endstop Test"); + LSTR MSG_Z_PROBE = _UxGT("Z Probe"); LSTR MSG_HOMING = _UxGT("Homing"); LSTR MSG_AUTO_HOME = _UxGT("Auto Home"); LSTR MSG_AUTO_HOME_A = _UxGT("Home @"); @@ -430,6 +432,7 @@ namespace Language_en { LSTR MSG_TEMPERATURE = _UxGT("Temperature"); LSTR MSG_MOTION = _UxGT("Motion"); LSTR MSG_FILAMENT = _UxGT("Filament"); + LSTR MSG_FILAMENT_EN = _UxGT("Filament *"); LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE; LSTR MSG_VOLUMETRIC_LIMIT = _UxGT("E Limit in mm") SUPERSCRIPT_THREE; LSTR MSG_VOLUMETRIC_LIMIT_E = _UxGT("E Limit *"); diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 9b9c67886880..06d9c846cc97 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -35,7 +35,8 @@ typedef void (*selectFunc_t)(); #define SS_LEFT 0x00 #define SS_CENTER 0x01 -#define SS_INVERT 0x02 +#define SS_FULL 0x02 +#define SS_INVERT 0x04 #define SS_DEFAULT SS_CENTER #if ENABLED(BABYSTEP_ZPROBE_OFFSET) && Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9 @@ -75,7 +76,7 @@ class MenuItemBase { // STATIC_ITEM(LABEL,...) class MenuItem_static : public MenuItemBase { public: - static void draw(const uint8_t row, FSTR_P const fstr, const uint8_t style=SS_DEFAULT, const char * const vstr=nullptr); + static void draw(const uint8_t row, FSTR_P const fstr, const uint8_t style=SS_DEFAULT, const char *vstr=nullptr); }; // BACK_ITEM(LABEL) diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 3ff4b2e56257..2fe4b7701843 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -32,6 +32,10 @@ #include "../../MarlinCore.h" +#if ENABLED(LCD_ENDSTOP_TEST) + #include "../../module/endstops.h" +#endif + #if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif @@ -57,7 +61,7 @@ #include "../../core/debug_out.h" -#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST) +#define HAS_DEBUG_MENU EITHER(LCD_PROGRESS_BAR_TEST, LCD_ENDSTOP_TEST) void menu_advanced_settings(); #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) @@ -90,6 +94,83 @@ void menu_advanced_settings(); #endif // LCD_PROGRESS_BAR_TEST +#if ENABLED(LCD_ENDSTOP_TEST) + + #include "../lcdprint.h" + + #define __STOP_ITEM(F,S) PSTRING_ITEM_F_P(F, TEST(stops, S) ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN), SS_FULL) + #define _STOP_ITEM(L,S) __STOP_ITEM(F(L), S) + #define STOP_ITEM(A,I) _STOP_ITEM(STRINGIFY(A) STRINGIFY(I) " " TERN(A##_HOME_TO_MAX, "Max", "Min"), A##I##_ENDSTOP) + #define FIL_ITEM(N) PSTRING_ITEM_N_P(N-1, MSG_FILAMENT_EN, (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) ? PSTR("PRESENT") : PSTR("out"), SS_FULL); + + static void endstop_test() { + if (ui.use_click()) { + ui.goto_previous_screen(); + //endstops.enable_globally(false); + return; + } + TemporaryGlobalEndstopsState temp(true); + ui.defer_status_screen(true); + const Endstops::endstop_mask_t stops = endstops.state(); + + START_SCREEN(); + STATIC_ITEM_F(GET_TEXT_F(MSG_ENDSTOP_TEST), SS_DEFAULT|SS_INVERT); + + #if HAS_X_ENDSTOP + STOP_ITEM(X,); + #if ENABLED(X_DUAL_ENDSTOPS) + STOP_ITEM(X,2); + #endif + #endif + #if HAS_Y_ENDSTOP + STOP_ITEM(Y,); + #if ENABLED(Y_DUAL_ENDSTOPS) + STOP_ITEM(Y,2); + #endif + #endif + #if HAS_Z_ENDSTOP + STOP_ITEM(Z,); + #if ENABLED(Z_MULTI_ENDSTOPS) + STOP_ITEM(Z,2); + #if NUM_Z_STEPPERS >= 3 + STOP_ITEM(Z,3); + #if NUM_Z_STEPPERS >= 4 + STOP_ITEM(Z,4); + #endif + #endif + #endif + #endif + #if HAS_I_ENDSTOP + STOP_ITEM(I,); + #endif + #if HAS_J_ENDSTOP + STOP_ITEM(J,); + #endif + #if HAS_K_ENDSTOP + STOP_ITEM(K,); + #endif + #if HAS_U_ENDSTOP + STOP_ITEM(U,); + #endif + #if HAS_V_ENDSTOP + STOP_ITEM(V,); + #endif + #if HAS_W_ENDSTOP + STOP_ITEM(W,); + #endif + #if HAS_BED_PROBE && !HAS_DELTA_SENSORLESS_PROBING + __STOP_ITEM(GET_TEXT_F(MSG_Z_PROBE), Z_MIN_PROBE); + #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + REPEAT_1(NUM_RUNOUT_SENSORS, FIL_ITEM) + #endif + + END_SCREEN(); + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + } + +#endif // LCD_ENDSTOP_TEST + #if HAS_DEBUG_MENU void menu_debug() { @@ -101,6 +182,10 @@ void menu_advanced_settings(); SUBMENU(MSG_PROGRESS_BAR_TEST, _progress_bar_test); #endif + #if ENABLED(LCD_ENDSTOP_TEST) + SUBMENU(MSG_ENDSTOP_TEST, endstop_test); + #endif + END_MENU(); } @@ -161,7 +246,7 @@ void menu_advanced_settings(); } #endif -#endif +#endif // HAS_MULTI_EXTRUDER #if HAS_HOTEND_OFFSET #include "../../module/motion.h" diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index abca4a7d1598..e2dd6c647527 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -51,40 +51,40 @@ char buffer[21]; - START_SCREEN(); // 12345678901234567890 - VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999 - VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666 + START_SCREEN(); // 12345678901234567890 + VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_FULL); // Print Count: 999 + VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_FULL); // Completed : 666 - STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT); // Total print Time: - STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_FULL); // Total print Time: + STATIC_ITEM_F(nullptr, SS_FULL, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s - STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT); // Longest job time: - STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_FULL); // Longest job time: + STATIC_ITEM_F(nullptr, SS_FULL, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s - STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total: + STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_FULL); // Extruded total: sprintf_P(buffer, PSTR("%ld.%im") , long(stats.filamentUsed / 1000) , int16_t(stats.filamentUsed / 100) % 10 ); - STATIC_ITEM_F(F("> "), SS_LEFT, buffer); // > 125m + STATIC_ITEM_F(nullptr, SS_FULL, buffer); // > 125m #if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0 strcpy_P(buffer, GET_TEXT(MSG_SERVICE_IN)); #endif #if SERVICE_INTERVAL_1 > 0 - STATIC_ITEM_F(F(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in: - STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s + STATIC_ITEM_F(F(SERVICE_NAME_1 " "), SS_FULL, buffer); // Service X in: + STATIC_ITEM_F(nullptr, SS_FULL, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s #endif #if SERVICE_INTERVAL_2 > 0 - STATIC_ITEM_F(F(SERVICE_NAME_2 " "), SS_LEFT, buffer); - STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService2).toString(buffer)); + STATIC_ITEM_F(F(SERVICE_NAME_2 " "), SS_FULL, buffer); + STATIC_ITEM_F(nullptr, SS_FULL, duration_t(stats.nextService2).toString(buffer)); #endif #if SERVICE_INTERVAL_3 > 0 - STATIC_ITEM_F(F(SERVICE_NAME_3 " "), SS_LEFT, buffer); - STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService3).toString(buffer)); + STATIC_ITEM_F(F(SERVICE_NAME_3 " "), SS_FULL, buffer); + STATIC_ITEM_F(nullptr, SS_FULL, duration_t(stats.nextService3).toString(buffer)); #endif END_SCREEN(); @@ -104,9 +104,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_0 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E0 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_1 != 0 @@ -114,9 +114,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_1 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E1 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_2 != 0 @@ -124,9 +124,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_2 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E2 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_3 != 0 @@ -134,9 +134,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_3 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E3 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_4 != 0 @@ -144,9 +144,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_4 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E4 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_5 != 0 @@ -154,9 +154,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_5 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E5 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_6 != 0 @@ -164,9 +164,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_6 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E6 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if TEMP_SENSOR_7 != 0 @@ -174,9 +174,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_7 #include "../thermistornames.h" STATIC_ITEM_F(F(STR_E7 ": " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if HAS_HEATED_BED @@ -184,9 +184,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_BED #include "../thermistornames.h" STATIC_ITEM_F(F("BED: " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if HAS_HEATED_CHAMBER @@ -194,9 +194,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_CHAMBER #include "../thermistornames.h" STATIC_ITEM_F(F("CHAM: " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif #if HAS_COOLER @@ -204,9 +204,9 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_COOLER #include "../thermistornames.h" STATIC_ITEM_F(F("COOL: " THERMISTOR_NAME), SS_INVERT); - PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(COOLER_MINTEMP), SS_LEFT); - PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(COOLER_MAXTEMP), SS_LEFT); - STATIC_ITEM(TERN(WATCH_COOLER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(COOLER_MINTEMP), SS_FULL); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(COOLER_MAXTEMP), SS_FULL); + STATIC_ITEM(TERN(WATCH_COOLER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_FULL); #endif END_SCREEN(); diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 31868520024e..805caa1d90d8 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -368,19 +368,29 @@ class MenuItem_bool : public MenuEditItemBase { NEXT_ITEM(); \ }while(0) -// PSTRING_ITEM is like STATIC_ITEM but it takes -// two PSTRs with the style as the last parameter. - -#define PSTRING_ITEM_F(FLABEL, PVAL, STYL) do{ \ - constexpr int m = 20; \ - char msg[m+1]; \ - msg[0] = ':'; msg[1] = ' '; \ - strncpy_P(msg+2, PSTR(PVAL), m-2); \ - if (msg[m-1] & 0x80) msg[m-1] = '\0'; \ - STATIC_ITEM_F(FLABEL, STYL, msg); \ +// PSTRING_ITEM is like STATIC_ITEM +// but also takes a PSTR and style. + +#define PSTRING_ITEM_F_P(FLABEL, PVAL, STYL) do{ \ + constexpr int m = 20; \ + char msg[m+1]; \ + if (_menuLineNr == _thisItemNr) { \ + msg[0] = ':'; msg[1] = ' '; \ + strncpy_P(msg+2, PVAL, m-2); \ + if (msg[m-1] & 0x80) msg[m-1] = '\0'; \ + } \ + STATIC_ITEM_F(FLABEL, STYL, msg); \ }while(0) -#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_F(GET_TEXT_F(LABEL), ##V) +#define PSTRING_ITEM_N_F_P(N, V...) do{ \ + if (_menuLineNr == _thisItemNr) \ + MenuItemBase::init(N); \ + PSTRING_ITEM_F_P(V); \ +}while(0) + +#define PSTRING_ITEM_N_P(N, LABEL, V...) PSTRING_ITEM_N_F_P(N, GET_TEXT_F(LABEL), ##V) +#define PSTRING_ITEM_P(LABEL, V...) PSTRING_ITEM_F_P(GET_TEXT_F(LABEL), ##V) +#define PSTRING_ITEM(LABEL, S, V...) PSTRING_ITEM_P(LABEL, PSTR(S), ##V) #define STATIC_ITEM(LABEL, V...) STATIC_ITEM_F(GET_TEXT_F(LABEL), ##V) #define STATIC_ITEM_N(N, LABEL, V...) STATIC_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 6fbde791548d..6dee62820e1f 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -164,11 +164,28 @@ void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr } // Draw a static item with no left-right margin required. Centered by default. -void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { +void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { menu_item(row); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); - if (vstr) tft_string.add(vstr); - tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); + + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); + if (!full || !vstr) { + if (vstr) tft_string.add(vstr); + tft.add_text(center ? tft_string.center(TFT_WIDTH) : 0, MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); + return; + } + + // Move the leading colon from the value to the label + if (*vstr == ':') { tft_string.add(':'); vstr++; } + + // Left-justified label + tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); + + // Right-justified value, after spaces + while (*vstr == ' ') vstr++; + tft_string.set(vstr); + tft.add_text(TFT_WIDTH - 1 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); } #if ENABLED(SDSUPPORT) diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index e0c0de39a176..9e942dc18e2b 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -31,46 +31,43 @@ #define __ES_ITEM(N) N, #define _ES_ITEM(K,N) TERN_(K,DEFER4(__ES_ITEM)(N)) +/** + * Basic Endstop Flag Bits: + * - Each axis gets one endstop flag bit based on the homing direction (e.g., "EndstopEnum::X_MIN"). + * (The use of "MIN" or "MAX" makes it easier to pair with similarly-named endstop pins.) + * - Multi-stepper axes can optionally enable endstops for all axis steppers. + * - The bed probe gets a 'Z_PROBE' flag bit (but DELTA sensorless probing uses 3 endstops). + * + * Endstop Flag Bit Aliases: + * - Each *_MIN or *_MAX flag is aliased to *_ENDSTOP. + * - 'Z_ENDSTOP' is aliased to 'Z_PROBE' if homing with the probe. + */ enum EndstopEnum : char { // Common XYZ (ABC) endstops. Defined according to USE_[XYZ](MIN|MAX)_PLUG settings. - _ES_ITEM(HAS_X_MIN, X_MIN) - _ES_ITEM(HAS_X_MAX, X_MAX) - _ES_ITEM(HAS_Y_MIN, Y_MIN) - _ES_ITEM(HAS_Y_MAX, Y_MAX) - _ES_ITEM(HAS_Z_MIN, Z_MIN) - _ES_ITEM(HAS_Z_MAX, Z_MAX) - _ES_ITEM(HAS_I_MIN, I_MIN) - _ES_ITEM(HAS_I_MAX, I_MAX) - _ES_ITEM(HAS_J_MIN, J_MIN) - _ES_ITEM(HAS_J_MAX, J_MAX) - _ES_ITEM(HAS_K_MIN, K_MIN) - _ES_ITEM(HAS_K_MAX, K_MAX) - _ES_ITEM(HAS_U_MIN, U_MIN) - _ES_ITEM(HAS_U_MAX, U_MAX) - _ES_ITEM(HAS_V_MIN, V_MIN) - _ES_ITEM(HAS_V_MAX, V_MAX) - _ES_ITEM(HAS_W_MIN, W_MIN) - _ES_ITEM(HAS_W_MAX, W_MAX) + _ES_ITEM(HAS_X_MIN, X_MIN) _ES_ITEM(HAS_X_MAX, X_MAX) + _ES_ITEM(HAS_Y_MIN, Y_MIN) _ES_ITEM(HAS_Y_MAX, Y_MAX) + _ES_ITEM(HAS_Z_MIN, Z_MIN) _ES_ITEM(HAS_Z_MAX, Z_MAX) + _ES_ITEM(HAS_I_MIN, I_MIN) _ES_ITEM(HAS_I_MAX, I_MAX) + _ES_ITEM(HAS_J_MIN, J_MIN) _ES_ITEM(HAS_J_MAX, J_MAX) + _ES_ITEM(HAS_K_MIN, K_MIN) _ES_ITEM(HAS_K_MAX, K_MAX) + _ES_ITEM(HAS_U_MIN, U_MIN) _ES_ITEM(HAS_U_MAX, U_MAX) + _ES_ITEM(HAS_V_MIN, V_MIN) _ES_ITEM(HAS_V_MAX, V_MAX) + _ES_ITEM(HAS_W_MIN, W_MIN) _ES_ITEM(HAS_W_MAX, W_MAX) // Extra Endstops for XYZ #if ENABLED(X_DUAL_ENDSTOPS) - _ES_ITEM(HAS_X_MIN, X2_MIN) - _ES_ITEM(HAS_X_MAX, X2_MAX) + _ES_ITEM(HAS_X_MIN, X2_MIN) _ES_ITEM(HAS_X_MAX, X2_MAX) #endif #if ENABLED(Y_DUAL_ENDSTOPS) - _ES_ITEM(HAS_Y_MIN, Y2_MIN) - _ES_ITEM(HAS_Y_MAX, Y2_MAX) + _ES_ITEM(HAS_Y_MIN, Y2_MIN) _ES_ITEM(HAS_Y_MAX, Y2_MAX) #endif #if ENABLED(Z_MULTI_ENDSTOPS) - _ES_ITEM(HAS_Z_MIN, Z2_MIN) - _ES_ITEM(HAS_Z_MAX, Z2_MAX) + _ES_ITEM(HAS_Z_MIN, Z2_MIN) _ES_ITEM(HAS_Z_MAX, Z2_MAX) #if NUM_Z_STEPPERS >= 3 - _ES_ITEM(HAS_Z_MIN, Z3_MIN) - _ES_ITEM(HAS_Z_MAX, Z3_MAX) - #endif - #if NUM_Z_STEPPERS >= 4 - _ES_ITEM(HAS_Z_MIN, Z4_MIN) - _ES_ITEM(HAS_Z_MAX, Z4_MAX) + _ES_ITEM(HAS_Z_MIN, Z3_MIN) _ES_ITEM(HAS_Z_MAX, Z3_MAX) + #if NUM_Z_STEPPERS >= 4 + _ES_ITEM(HAS_Z_MIN, Z4_MIN) _ES_ITEM(HAS_Z_MAX, Z4_MAX) + #endif #endif #endif @@ -83,30 +80,50 @@ enum EndstopEnum : char { NUM_ENDSTOP_STATES // Endstops can be either MIN or MAX but not both - #if HAS_X_MIN || HAS_X_MAX + #if HAS_X_ENDSTOP , X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN) #if ENABLED(X_DUAL_ENDSTOPS) , X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN) #endif #endif - #if HAS_Y_MIN || HAS_Y_MAX + #if HAS_Y_ENDSTOP , Y_ENDSTOP = TERN(Y_HOME_TO_MAX, Y_MAX, Y_MIN) #if ENABLED(Y_DUAL_ENDSTOPS) , Y2_ENDSTOP = TERN(Y_HOME_TO_MAX, Y2_MAX, Y2_MIN) #endif #endif - #if HAS_Z_MIN || HAS_Z_MAX || HOMING_Z_WITH_PROBE - , Z_ENDSTOP = TERN(HOMING_Z_WITH_PROBE, Z_MIN_PROBE, TERN(Z_HOME_TO_MAX, Z_MAX, Z_MIN)) + #if HOMING_Z_WITH_PROBE + , Z_ENDSTOP = Z_MIN_PROBE + #elif HAS_Z_ENDSTOP + , Z_ENDSTOP = TERN(Z_HOME_TO_MAX, Z_MAX, Z_MIN) + #if ENABLED(Z_MULTI_ENDSTOPS) + , Z2_ENDSTOP = TERN(Z_HOME_TO_MAX, Z2_MAX, Z2_MIN) + #if NUM_Z_STEPPERS >= 3 + , Z3_ENDSTOP = TERN(Z_HOME_TO_MAX, Z3_MAX, Z3_MIN) + #if NUM_Z_STEPPERS >= 4 + , Z4_ENDSTOP = TERN(Z_HOME_TO_MAX, Z4_MAX, Z4_MIN) + #endif + #endif + #endif #endif - #if HAS_I_MIN || HAS_I_MAX + #if HAS_I_ENDSTOP , I_ENDSTOP = TERN(I_HOME_TO_MAX, I_MAX, I_MIN) #endif - #if HAS_J_MIN || HAS_J_MAX + #if HAS_J_ENDSTOP , J_ENDSTOP = TERN(J_HOME_TO_MAX, J_MAX, J_MIN) #endif - #if HAS_K_MIN || HAS_K_MAX + #if HAS_K_ENDSTOP , K_ENDSTOP = TERN(K_HOME_TO_MAX, K_MAX, K_MIN) #endif + #if HAS_U_ENDSTOP + , U_ENDSTOP = TERN(U_HOME_TO_MAX, U_MAX, U_MIN) + #endif + #if HAS_V_ENDSTOP + , V_ENDSTOP = TERN(V_HOME_TO_MAX, V_MAX, V_MIN) + #endif + #if HAS_W_ENDSTOP + , W_ENDSTOP = TERN(W_HOME_TO_MAX, W_MAX, W_MIN) + #endif }; #undef __ES_ITEM diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 6917bbc42a56..589299f2f1a0 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -2171,32 +2171,9 @@ void prepare_line_to_destination() { // Check for a broken endstop EndstopEnum es; switch (axis) { - default: - case X_AXIS: es = X_ENDSTOP; break; - #if HAS_Y_AXIS - case Y_AXIS: es = Y_ENDSTOP; break; - #endif - #if HAS_Z_AXIS - case Z_AXIS: es = Z_ENDSTOP; break; - #endif - #if HAS_I_AXIS - case I_AXIS: es = I_ENDSTOP; break; - #endif - #if HAS_J_AXIS - case J_AXIS: es = J_ENDSTOP; break; - #endif - #if HAS_K_AXIS - case K_AXIS: es = K_ENDSTOP; break; - #endif - #if HAS_U_AXIS - case U_AXIS: es = U_ENDSTOP; break; - #endif - #if HAS_V_AXIS - case V_AXIS: es = V_ENDSTOP; break; - #endif - #if HAS_W_AXIS - case W_AXIS: es = W_ENDSTOP; break; - #endif + #define _ESCASE(A) case A##_AXIS: es = A##_ENDSTOP; break; + MAIN_AXIS_MAP(_ESCASE) + default: break; } if (TEST(endstops.state(), es)) { SERIAL_ECHO_MSG("Bad ", AS_CHAR(AXIS_CHAR(axis)), " Endstop?"); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 75295c5f5a4d..3e7db5a0775b 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -551,6 +551,7 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { #endif // If preheating is required before any probing... + // TODO: Consider skipping this for things like M401, G34, etc. TERN_(PREHEAT_BEFORE_PROBING, if (deploy) preheat_for_probing(PROBING_NOZZLE_TEMP, PROBING_BED_TEMP)); if (!no_return) do_blocking_move_to(old_xy); // Return to the original location unless handled externally @@ -1020,15 +1021,16 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai void Probe::refresh_largest_sensorless_adj() { DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true); largest_sensorless_adj = -3; // A reference away from any real probe height - if (TEST(endstops.state(), X_MAX)) { + const Endstops::endstop_mask_t state = endstops.state(); + if (TEST(state, X_MAX)) { NOLESS(largest_sensorless_adj, offset_sensorless_adj.a); DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX"); } - if (TEST(endstops.state(), Y_MAX)) { + if (TEST(state, Y_MAX)) { NOLESS(largest_sensorless_adj, offset_sensorless_adj.b); DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY"); } - if (TEST(endstops.state(), Z_MAX)) { + if (TEST(state, Z_MAX)) { NOLESS(largest_sensorless_adj, offset_sensorless_adj.c); DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ"); } diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 708eb7f8e6cf..6ae99d2f5706 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1867,487 +1867,467 @@ * X_DUAL_ENDSTOPS endstop reassignment */ #if ENABLED(X_DUAL_ENDSTOPS) - #if X_HOME_TO_MAX - #ifndef X2_MAX_PIN - #if PIN_EXISTS(X2_STOP) - #define X2_MAX_PIN X2_STOP_PIN - #elif X2_USE_ENDSTOP == _XMIN_ - #define X2_MAX_PIN X_MIN_PIN - #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MAX_PIN X_MAX_PIN - #elif X2_USE_ENDSTOP == _XSTOP_ - #define X2_MAX_PIN X_STOP_PIN - #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MAX_PIN Y_MIN_PIN - #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MAX_PIN Y_MAX_PIN - #elif X2_USE_ENDSTOP == _YSTOP_ - #define X2_MAX_PIN Y_STOP_PIN - #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MAX_PIN Z_MIN_PIN - #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MAX_PIN Z_MAX_PIN - #elif X2_USE_ENDSTOP == _ZSTOP_ - #define X2_MAX_PIN Z_STOP_PIN - #elif X2_USE_ENDSTOP == _XDIAG_ - #define X2_MAX_PIN X_DIAG_PIN - #elif X2_USE_ENDSTOP == _YDIAG_ - #define X2_MAX_PIN Y_DIAG_PIN - #elif X2_USE_ENDSTOP == _ZDIAG_ - #define X2_MAX_PIN Z_DIAG_PIN - #elif X2_USE_ENDSTOP == _E0DIAG_ - #define X2_MAX_PIN E0_DIAG_PIN - #elif X2_USE_ENDSTOP == _E1DIAG_ - #define X2_MAX_PIN E1_DIAG_PIN - #elif X2_USE_ENDSTOP == _E2DIAG_ - #define X2_MAX_PIN E2_DIAG_PIN - #elif X2_USE_ENDSTOP == _E3DIAG_ - #define X2_MAX_PIN E3_DIAG_PIN - #elif X2_USE_ENDSTOP == _E4DIAG_ - #define X2_MAX_PIN E4_DIAG_PIN - #elif X2_USE_ENDSTOP == _E5DIAG_ - #define X2_MAX_PIN E5_DIAG_PIN - #elif X2_USE_ENDSTOP == _E6DIAG_ - #define X2_MAX_PIN E6_DIAG_PIN - #elif X2_USE_ENDSTOP == _E7DIAG_ - #define X2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #else - #ifndef X2_MIN_PIN - #if PIN_EXISTS(X2_STOP) - #define X2_MIN_PIN X2_STOP_PIN - #elif X2_USE_ENDSTOP == _XMIN_ - #define X2_MIN_PIN X_MIN_PIN - #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MIN_PIN X_MAX_PIN - #elif X2_USE_ENDSTOP == _XSTOP_ - #define X2_MIN_PIN X_STOP_PIN - #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MIN_PIN Y_MIN_PIN - #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MIN_PIN Y_MAX_PIN - #elif X2_USE_ENDSTOP == _YSTOP_ - #define X2_MIN_PIN Y_STOP_PIN - #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MIN_PIN Z_MIN_PIN - #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MIN_PIN Z_MAX_PIN - #elif X2_USE_ENDSTOP == _ZSTOP_ - #define X2_MIN_PIN Z_STOP_PIN - #elif X2_USE_ENDSTOP == _XDIAG_ - #define X2_MIN_PIN X_DIAG_PIN - #elif X2_USE_ENDSTOP == _YDIAG_ - #define X2_MIN_PIN Y_DIAG_PIN - #elif X2_USE_ENDSTOP == _ZDIAG_ - #define X2_MIN_PIN Z_DIAG_PIN - #elif X2_USE_ENDSTOP == _E0DIAG_ - #define X2_MIN_PIN E0_DIAG_PIN - #elif X2_USE_ENDSTOP == _E1DIAG_ - #define X2_MIN_PIN E1_DIAG_PIN - #elif X2_USE_ENDSTOP == _E2DIAG_ - #define X2_MIN_PIN E2_DIAG_PIN - #elif X2_USE_ENDSTOP == _E3DIAG_ - #define X2_MIN_PIN E3_DIAG_PIN - #elif X2_USE_ENDSTOP == _E4DIAG_ - #define X2_MIN_PIN E4_DIAG_PIN - #elif X2_USE_ENDSTOP == _E5DIAG_ - #define X2_MIN_PIN E5_DIAG_PIN - #elif X2_USE_ENDSTOP == _E6DIAG_ - #define X2_MIN_PIN E6_DIAG_PIN - #elif X2_USE_ENDSTOP == _E7DIAG_ - #define X2_MIN_PIN E7_DIAG_PIN - #endif - #endif - #endif -#endif + #if X_HOME_TO_MAX && !defined(X2_MAX_PIN) + #if PIN_EXISTS(X2_STOP) + #define X2_MAX_PIN X2_STOP_PIN + #elif X2_USE_ENDSTOP == _XMIN_ + #define X2_MAX_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MAX_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MAX_PIN X_STOP_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MAX_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MAX_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MAX_PIN Y_STOP_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MAX_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MAX_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MAX_PIN Z_STOP_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MAX_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MAX_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MAX_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MAX_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MAX_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MAX_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MAX_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MAX_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MAX_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MAX_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MAX_PIN E7_DIAG_PIN + #endif + #elif X_HOME_TO_MIN && !defined(X2_MIN_PIN) + #if PIN_EXISTS(X2_STOP) + #define X2_MIN_PIN X2_STOP_PIN + #elif X2_USE_ENDSTOP == _XMIN_ + #define X2_MIN_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MIN_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MIN_PIN X_STOP_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MIN_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MIN_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MIN_PIN Y_STOP_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MIN_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MIN_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MIN_PIN Z_STOP_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MIN_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MIN_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MIN_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MIN_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MIN_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MIN_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MIN_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MIN_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MIN_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MIN_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MIN_PIN E7_DIAG_PIN + #endif + #endif +#endif // X_DUAL_ENDSTOPS /** * Y_DUAL_ENDSTOPS endstop reassignment */ #if ENABLED(Y_DUAL_ENDSTOPS) - #if Y_HOME_TO_MAX - #ifndef Y2_MAX_PIN - #if PIN_EXISTS(Y2_STOP) - #define Y2_MAX_PIN Y2_STOP_PIN - #elif Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MAX_PIN X_MIN_PIN - #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MAX_PIN X_MAX_PIN - #elif Y2_USE_ENDSTOP == _XSTOP_ - #define Y2_MAX_PIN X_STOP_PIN - #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MAX_PIN Y_MIN_PIN - #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MAX_PIN Y_MAX_PIN - #elif Y2_USE_ENDSTOP == _YSTOP_ - #define Y2_MAX_PIN Y_STOP_PIN - #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MAX_PIN Z_MIN_PIN - #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MAX_PIN Z_MAX_PIN - #elif Y2_USE_ENDSTOP == _ZSTOP_ - #define Y2_MAX_PIN Z_STOP_PIN - #elif Y2_USE_ENDSTOP == _XDIAG_ - #define Y2_MAX_PIN X_DIAG_PIN - #elif Y2_USE_ENDSTOP == _YDIAG_ - #define Y2_MAX_PIN Y_DIAG_PIN - #elif Y2_USE_ENDSTOP == _ZDIAG_ - #define Y2_MAX_PIN Z_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E0DIAG_ - #define Y2_MAX_PIN E0_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E1DIAG_ - #define Y2_MAX_PIN E1_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E2DIAG_ - #define Y2_MAX_PIN E2_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E3DIAG_ - #define Y2_MAX_PIN E3_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E4DIAG_ - #define Y2_MAX_PIN E4_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E5DIAG_ - #define Y2_MAX_PIN E5_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E6DIAG_ - #define Y2_MAX_PIN E6_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E7DIAG_ - #define Y2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #else - #ifndef Y2_MIN_PIN - #if PIN_EXISTS(Y2_STOP) - #define Y2_MIN_PIN Y2_STOP_PIN - #elif Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MIN_PIN X_MIN_PIN - #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MIN_PIN X_MAX_PIN - #elif Y2_USE_ENDSTOP == _XSTOP_ - #define Y2_MIN_PIN X_STOP_PIN - #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MIN_PIN Y_MIN_PIN - #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MIN_PIN Y_MAX_PIN - #elif Y2_USE_ENDSTOP == _YSTOP_ - #define Y2_MIN_PIN Y_STOP_PIN - #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MIN_PIN Z_MIN_PIN - #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MIN_PIN Z_MAX_PIN - #elif Y2_USE_ENDSTOP == _ZSTOP_ - #define Y2_MIN_PIN Z_STOP_PIN - #elif Y2_USE_ENDSTOP == _XDIAG_ - #define Y2_MIN_PIN X_DIAG_PIN - #elif Y2_USE_ENDSTOP == _YDIAG_ - #define Y2_MIN_PIN Y_DIAG_PIN - #elif Y2_USE_ENDSTOP == _ZDIAG_ - #define Y2_MIN_PIN Z_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E0DIAG_ - #define Y2_MIN_PIN E0_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E1DIAG_ - #define Y2_MIN_PIN E1_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E2DIAG_ - #define Y2_MIN_PIN E2_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E3DIAG_ - #define Y2_MIN_PIN E3_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E4DIAG_ - #define Y2_MIN_PIN E4_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E5DIAG_ - #define Y2_MIN_PIN E5_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E6DIAG_ - #define Y2_MIN_PIN E6_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E7DIAG_ - #define Y2_MIN_PIN E7_DIAG_PIN - #endif - #endif - #endif -#endif + #if Y_HOME_TO_MAX && !defined(Y2_MAX_PIN) + #if PIN_EXISTS(Y2_STOP) + #define Y2_MAX_PIN Y2_STOP_PIN + #elif Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MAX_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MAX_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MAX_PIN X_STOP_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MAX_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MAX_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MAX_PIN Y_STOP_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MAX_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MAX_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MAX_PIN Z_STOP_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MAX_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MAX_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MAX_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MAX_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MAX_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MAX_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MAX_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MAX_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MAX_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MAX_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MAX_PIN E7_DIAG_PIN + #endif + #elif Y_HOME_TO_MIN && !defined(Y2_MIN_PIN) + #if PIN_EXISTS(Y2_STOP) + #define Y2_MIN_PIN Y2_STOP_PIN + #elif Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MIN_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MIN_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MIN_PIN X_STOP_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MIN_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MIN_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MIN_PIN Y_STOP_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MIN_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MIN_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MIN_PIN Z_STOP_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MIN_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MIN_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MIN_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MIN_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MIN_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MIN_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MIN_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MIN_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MIN_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MIN_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MIN_PIN E7_DIAG_PIN + #endif + #endif +#endif // Y_DUAL_ENDSTOPS /** * Z_MULTI_ENDSTOPS endstop reassignment */ #if ENABLED(Z_MULTI_ENDSTOPS) - #if Z_HOME_TO_MAX - #ifndef Z2_MAX_PIN - #if PIN_EXISTS(Z2_STOP) - #define Z2_MAX_PIN Z2_STOP_PIN - #elif Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MAX_PIN X_MIN_PIN - #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MAX_PIN X_MAX_PIN - #elif Z2_USE_ENDSTOP == _XSTOP_ - #define Z2_MAX_PIN X_STOP_PIN - #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MAX_PIN Y_MIN_PIN - #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MAX_PIN Y_MAX_PIN - #elif Z2_USE_ENDSTOP == _YSTOP_ - #define Z2_MAX_PIN Y_STOP_PIN - #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MAX_PIN Z_MIN_PIN - #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MAX_PIN Z_MAX_PIN - #elif Z2_USE_ENDSTOP == _ZSTOP_ - #define Z2_MAX_PIN Z_STOP_PIN - #elif Z2_USE_ENDSTOP == _XDIAG_ - #define Z2_MAX_PIN X_DIAG_PIN - #elif Z2_USE_ENDSTOP == _YDIAG_ - #define Z2_MAX_PIN Y_DIAG_PIN - #elif Z2_USE_ENDSTOP == _ZDIAG_ - #define Z2_MAX_PIN Z_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E0DIAG_ - #define Z2_MAX_PIN E0_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E1DIAG_ - #define Z2_MAX_PIN E1_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E2DIAG_ - #define Z2_MAX_PIN E2_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E3DIAG_ - #define Z2_MAX_PIN E3_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E4DIAG_ - #define Z2_MAX_PIN E4_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E5DIAG_ - #define Z2_MAX_PIN E5_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E6DIAG_ - #define Z2_MAX_PIN E6_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E7DIAG_ - #define Z2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #else - #ifndef Z2_MIN_PIN - #if PIN_EXISTS(Z2_STOP) - #define Z2_MIN_PIN Z2_STOP_PIN - #elif Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MIN_PIN X_MIN_PIN - #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MIN_PIN X_MAX_PIN - #elif Z2_USE_ENDSTOP == _XSTOP_ - #define Z2_MIN_PIN X_STOP_PIN - #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MIN_PIN Y_MIN_PIN - #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MIN_PIN Y_MAX_PIN - #elif Z2_USE_ENDSTOP == _YSTOP_ - #define Z2_MIN_PIN Y_STOP_PIN - #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MIN_PIN Z_MIN_PIN - #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MIN_PIN Z_MAX_PIN - #elif Z2_USE_ENDSTOP == _ZSTOP_ - #define Z2_MIN_PIN Z_STOP_PIN - #elif Z2_USE_ENDSTOP == _XDIAG_ - #define Z2_MIN_PIN X_DIAG_PIN - #elif Z2_USE_ENDSTOP == _YDIAG_ - #define Z2_MIN_PIN Y_DIAG_PIN - #elif Z2_USE_ENDSTOP == _ZDIAG_ - #define Z2_MIN_PIN Z_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E0DIAG_ - #define Z2_MIN_PIN E0_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E1DIAG_ - #define Z2_MIN_PIN E1_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E2DIAG_ - #define Z2_MIN_PIN E2_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E3DIAG_ - #define Z2_MIN_PIN E3_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E4DIAG_ - #define Z2_MIN_PIN E4_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E5DIAG_ - #define Z2_MIN_PIN E5_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E6DIAG_ - #define Z2_MIN_PIN E6_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E7DIAG_ - #define Z2_MIN_PIN E7_DIAG_PIN - #endif + #if Z_HOME_TO_MAX && !defined(Z2_MAX_PIN) + #if PIN_EXISTS(Z2_STOP) + #define Z2_MAX_PIN Z2_STOP_PIN + #elif Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MAX_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MAX_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MAX_PIN X_STOP_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MAX_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MAX_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MAX_PIN Y_STOP_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MAX_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MAX_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MAX_PIN Z_STOP_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MAX_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MAX_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MAX_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MAX_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MAX_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MAX_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MAX_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MAX_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MAX_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MAX_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MAX_PIN E7_DIAG_PIN + #endif + #elif Z_HOME_TO_MIN && !defined(Z2_MIN_PIN) + #if PIN_EXISTS(Z2_STOP) + #define Z2_MIN_PIN Z2_STOP_PIN + #elif Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MIN_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MIN_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MIN_PIN X_STOP_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MIN_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MIN_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MIN_PIN Y_STOP_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MIN_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MIN_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MIN_PIN Z_STOP_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MIN_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MIN_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MIN_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MIN_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MIN_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MIN_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MIN_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MIN_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MIN_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MIN_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MIN_PIN E7_DIAG_PIN #endif #endif #if NUM_Z_STEPPERS >= 3 - #if Z_HOME_TO_MAX - #ifndef Z3_MAX_PIN - #if PIN_EXISTS(Z3_STOP) - #define Z3_MAX_PIN Z3_STOP_PIN - #elif Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MAX_PIN X_MIN_PIN - #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MAX_PIN X_MAX_PIN - #elif Z3_USE_ENDSTOP == _XSTOP_ - #define Z3_MAX_PIN X_STOP_PIN - #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MAX_PIN Y_MIN_PIN - #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MAX_PIN Y_MAX_PIN - #elif Z3_USE_ENDSTOP == _YSTOP_ - #define Z3_MAX_PIN Y_STOP_PIN - #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MAX_PIN Z_MIN_PIN - #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MAX_PIN Z_MAX_PIN - #elif Z3_USE_ENDSTOP == _ZSTOP_ - #define Z3_MAX_PIN Z_STOP_PIN - #elif Z3_USE_ENDSTOP == _XDIAG_ - #define Z3_MAX_PIN X_DIAG_PIN - #elif Z3_USE_ENDSTOP == _YDIAG_ - #define Z3_MAX_PIN Y_DIAG_PIN - #elif Z3_USE_ENDSTOP == _ZDIAG_ - #define Z3_MAX_PIN Z_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E0DIAG_ - #define Z3_MAX_PIN E0_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E1DIAG_ - #define Z3_MAX_PIN E1_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E2DIAG_ - #define Z3_MAX_PIN E2_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E3DIAG_ - #define Z3_MAX_PIN E3_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E4DIAG_ - #define Z3_MAX_PIN E4_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E5DIAG_ - #define Z3_MAX_PIN E5_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E6DIAG_ - #define Z3_MAX_PIN E6_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E7DIAG_ - #define Z3_MAX_PIN E7_DIAG_PIN - #endif + #if Z_HOME_TO_MAX && !defined(Z3_MAX_PIN) + #if PIN_EXISTS(Z3_STOP) + #define Z3_MAX_PIN Z3_STOP_PIN + #elif Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MAX_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MAX_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MAX_PIN X_STOP_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MAX_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MAX_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MAX_PIN Y_STOP_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MAX_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MAX_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MAX_PIN Z_STOP_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MAX_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MAX_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MAX_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MAX_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MAX_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MAX_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MAX_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MAX_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MAX_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MAX_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MAX_PIN E7_DIAG_PIN #endif - #else - #ifndef Z3_MIN_PIN - #if PIN_EXISTS(Z3_STOP) - #define Z3_MIN_PIN Z3_STOP_PIN - #elif Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MIN_PIN X_MIN_PIN - #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MIN_PIN X_MAX_PIN - #elif Z3_USE_ENDSTOP == _XSTOP_ - #define Z3_MIN_PIN X_STOP_PIN - #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MIN_PIN Y_MIN_PIN - #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MIN_PIN Y_MAX_PIN - #elif Z3_USE_ENDSTOP == _YSTOP_ - #define Z3_MIN_PIN Y_STOP_PIN - #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MIN_PIN Z_MIN_PIN - #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MIN_PIN Z_MAX_PIN - #elif Z3_USE_ENDSTOP == _ZSTOP_ - #define Z3_MIN_PIN Z_STOP_PIN - #elif Z3_USE_ENDSTOP == _XDIAG_ - #define Z3_MIN_PIN X_DIAG_PIN - #elif Z3_USE_ENDSTOP == _YDIAG_ - #define Z3_MIN_PIN Y_DIAG_PIN - #elif Z3_USE_ENDSTOP == _ZDIAG_ - #define Z3_MIN_PIN Z_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E0DIAG_ - #define Z3_MIN_PIN E0_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E1DIAG_ - #define Z3_MIN_PIN E1_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E2DIAG_ - #define Z3_MIN_PIN E2_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E3DIAG_ - #define Z3_MIN_PIN E3_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E4DIAG_ - #define Z3_MIN_PIN E4_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E5DIAG_ - #define Z3_MIN_PIN E5_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E6DIAG_ - #define Z3_MIN_PIN E6_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E7DIAG_ - #define Z3_MIN_PIN E7_DIAG_PIN - #endif + #elif Z_HOME_TO_MIN && !defined(Z3_MIN_PIN) + #if PIN_EXISTS(Z3_STOP) + #define Z3_MIN_PIN Z3_STOP_PIN + #elif Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MIN_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MIN_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MIN_PIN X_STOP_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MIN_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MIN_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MIN_PIN Y_STOP_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MIN_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MIN_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MIN_PIN Z_STOP_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MIN_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MIN_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MIN_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MIN_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MIN_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MIN_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MIN_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MIN_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MIN_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MIN_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MIN_PIN E7_DIAG_PIN #endif #endif #endif #if NUM_Z_STEPPERS >= 4 - #if Z_HOME_TO_MAX - #ifndef Z4_MAX_PIN - #if PIN_EXISTS(Z4_STOP) - #define Z4_MAX_PIN Z4_STOP_PIN - #elif Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MAX_PIN X_MIN_PIN - #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MAX_PIN X_MAX_PIN - #elif Z4_USE_ENDSTOP == _XSTOP_ - #define Z4_MAX_PIN X_STOP_PIN - #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MAX_PIN Y_MIN_PIN - #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MAX_PIN Y_MAX_PIN - #elif Z4_USE_ENDSTOP == _YSTOP_ - #define Z4_MAX_PIN Y_STOP_PIN - #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MAX_PIN Z_MIN_PIN - #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MAX_PIN Z_MAX_PIN - #elif Z4_USE_ENDSTOP == _ZSTOP_ - #define Z4_MAX_PIN Z_STOP_PIN - #elif Z4_USE_ENDSTOP == _XDIAG_ - #define Z4_MAX_PIN X_DIAG_PIN - #elif Z4_USE_ENDSTOP == _YDIAG_ - #define Z4_MAX_PIN Y_DIAG_PIN - #elif Z4_USE_ENDSTOP == _ZDIAG_ - #define Z4_MAX_PIN Z_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E0DIAG_ - #define Z4_MAX_PIN E0_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E1DIAG_ - #define Z4_MAX_PIN E1_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E2DIAG_ - #define Z4_MAX_PIN E2_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E3DIAG_ - #define Z4_MAX_PIN E3_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E4DIAG_ - #define Z4_MAX_PIN E4_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E5DIAG_ - #define Z4_MAX_PIN E5_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E6DIAG_ - #define Z4_MAX_PIN E6_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E7DIAG_ - #define Z4_MAX_PIN E7_DIAG_PIN - #endif + #if Z_HOME_TO_MAX && !defined(Z4_MAX_PIN) + #if PIN_EXISTS(Z4_STOP) + #define Z4_MAX_PIN Z4_STOP_PIN + #elif Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MAX_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MAX_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MAX_PIN X_STOP_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MAX_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MAX_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MAX_PIN Y_STOP_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MAX_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MAX_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MAX_PIN Z_STOP_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MAX_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MAX_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MAX_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MAX_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MAX_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MAX_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MAX_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MAX_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MAX_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MAX_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MAX_PIN E7_DIAG_PIN #endif - #else - #ifndef Z4_MIN_PIN - #if PIN_EXISTS(Z4_STOP) - #define Z4_MIN_PIN Z4_STOP_PIN - #elif Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MIN_PIN X_MIN_PIN - #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MIN_PIN X_MAX_PIN - #elif Z4_USE_ENDSTOP == _XSTOP_ - #define Z4_MIN_PIN X_STOP_PIN - #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MIN_PIN Y_MIN_PIN - #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MIN_PIN Y_MAX_PIN - #elif Z4_USE_ENDSTOP == _YSTOP_ - #define Z4_MIN_PIN Y_STOP_PIN - #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MIN_PIN Z_MIN_PIN - #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MIN_PIN Z_MAX_PIN - #elif Z4_USE_ENDSTOP == _ZSTOP_ - #define Z4_MIN_PIN Z_STOP_PIN - #elif Z4_USE_ENDSTOP == _XDIAG_ - #define Z4_MIN_PIN X_DIAG_PIN - #elif Z4_USE_ENDSTOP == _YDIAG_ - #define Z4_MIN_PIN Y_DIAG_PIN - #elif Z4_USE_ENDSTOP == _ZDIAG_ - #define Z4_MIN_PIN Z_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E0DIAG_ - #define Z4_MIN_PIN E0_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E1DIAG_ - #define Z4_MIN_PIN E1_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E2DIAG_ - #define Z4_MIN_PIN E2_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E3DIAG_ - #define Z4_MIN_PIN E3_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E4DIAG_ - #define Z4_MIN_PIN E4_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E5DIAG_ - #define Z4_MIN_PIN E5_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E6DIAG_ - #define Z4_MIN_PIN E6_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E7DIAG_ - #define Z4_MIN_PIN E7_DIAG_PIN - #endif + #elif Z_HOME_TO_MIN && !defined(Z4_MIN_PIN) + #if PIN_EXISTS(Z4_STOP) + #define Z4_MIN_PIN Z4_STOP_PIN + #elif Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MIN_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MIN_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MIN_PIN X_STOP_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MIN_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MIN_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MIN_PIN Y_STOP_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MIN_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MIN_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MIN_PIN Z_STOP_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MIN_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MIN_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MIN_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MIN_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MIN_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MIN_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MIN_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MIN_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MIN_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MIN_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MIN_PIN E7_DIAG_PIN #endif #endif #endif diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index d407dc430153..834580fac8e3 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -11,12 +11,17 @@ set -e # use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_enable MARLIN_DEV_MODE BUFFER_MONITORING BLTOUCH AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING -exec_test $1 $2 "Ender-3 v2 with CrealityUI" "$3" +exec_test $1 $2 "Ender-3 v2 - CrealityUI" "$3" use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY -exec_test $1 $2 "Ender-3 v2 with JyersUI" "$3" +exec_test $1 $2 "Ender-3 v2 - JyersUI (ABL Bilinear/Manual)" "$3" + +use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" +opt_disable DWIN_CREALITY_LCD PIDTEMP +opt_enable DWIN_MARLINUI_LANDSCAPE LCD_ENDSTOP_TEST AUTO_BED_LEVELING_UBL BLTOUCH Z_SAFE_HOMING MPCTEMP MPC_AUTOTUNE +exec_test $1 $2 "Ender-3 v2 - MarlinUI (UBL+BLTOUCH, MPCTEMP, LCD_ENDSTOP_TEST)" "$3" use_example_configs "Creality/Ender-3 S1/STM32F1" opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CANCEL_OBJECTS FWRETRACT @@ -25,11 +30,7 @@ opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU SET_PROGRESS_MANUALLY S BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \ LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 -exec_test $1 $2 "Ender-3 S1 with ProUI (PIDTEMP)" "$3" - -opt_disable PIDTEMP -opt_enable MPCTEMP MPC_AUTOTUNE -exec_test $1 $2 "Ender-3 S1 with ProUI (MPCTEMP)" "$3" +exec_test $1 $2 "Ender-3 S1 - ProUI (PIDTEMP)" "$3" restore_configs opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1