diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index dd9645900407..9464c15942de 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/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/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 55f426017cef..095c587d3b35 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 4dce109b4277..c6c6cd59ae0e 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,101 @@ 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_MIN || HAS_X_MAX + STOP_ITEM(X,); + #if ENABLED(X_DUAL_ENDSTOPS) + STOP_ITEM(X,2); + #endif + #endif + #if HAS_Y_MIN || HAS_Y_MAX + STOP_ITEM(Y,); + #if ENABLED(Y_DUAL_ENDSTOPS) + STOP_ITEM(Y,2); + #endif + #endif + #if HAS_Z_MIN || HAS_Z_MAX + 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_MIN || HAS_I_MAX + STOP_ITEM(I,); + #if I_DUAL_ENDSTOPS + STOP_ITEM(I,2); + #endif + #endif + #if HAS_J_MIN || HAS_J_MAX + STOP_ITEM(J,); + #if J_DUAL_ENDSTOPS + STOP_ITEM(J,2); + #endif + #endif + #if HAS_K_MIN || HAS_K_MAX + STOP_ITEM(K,); + #if K_DUAL_ENDSTOPS + STOP_ITEM(K,2); + #endif + #endif + #if HAS_U_MIN || HAS_U_MAX + STOP_ITEM(U,); + #if U_DUAL_ENDSTOPS + STOP_ITEM(U,2); + #endif + #endif + #if HAS_V_MIN || HAS_V_MAX + STOP_ITEM(V,); + #if V_DUAL_ENDSTOPS + STOP_ITEM(V,2); + #endif + #endif + #if HAS_W_MIN || HAS_W_MAX + STOP_ITEM(W,); + #if W_DUAL_ENDSTOPS + STOP_ITEM(W,2); + #endif + #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_S(1, INCREMENT(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 +200,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(); } diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index 101861074d95..a4b90471c820 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 76c8d454d7b8..e09f49425622 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -67,10 +67,10 @@ enum EndstopEnum : char { #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) + #if NUM_Z_STEPPERS >= 4 + _ES_ITEM(HAS_Z_MIN, Z4_MIN) + _ES_ITEM(HAS_Z_MAX, Z4_MAX) + #endif #endif #endif @@ -97,6 +97,15 @@ enum EndstopEnum : char { #endif #if HAS_Z_MIN || HAS_Z_MAX || HOMING_Z_WITH_PROBE , Z_ENDSTOP = TERN(Z_HOME_TO_MAX, Z_MAX, TERN(HOMING_Z_WITH_PROBE, Z_MIN_PROBE, 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 , I_ENDSTOP = TERN(I_HOME_TO_MAX, I_MAX, I_MIN) @@ -107,6 +116,15 @@ enum EndstopEnum : char { #if HAS_K_MIN || HAS_K_MAX , K_ENDSTOP = TERN(K_HOME_TO_MAX, K_MAX, K_MIN) #endif + #if HAS_U_MIN || HAS_U_MAX + , U_ENDSTOP = TERN(U_HOME_TO_MAX, U_MAX, U_MIN) + #endif + #if HAS_V_MIN || HAS_V_MAX + , V_ENDSTOP = TERN(V_HOME_TO_MAX, V_MAX, V_MIN) + #endif + #if HAS_W_MIN || HAS_W_MAX + , W_ENDSTOP = TERN(W_HOME_TO_MAX, W_MAX, W_MIN) + #endif }; #undef __ES_ITEM diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 0f2fca119c6d..92fe439b7de3 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"); }