From 0f612d5021eaef366cee80d4068d8a8f6a081b1b Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 23 Jan 2021 06:23:35 +0100 Subject: [PATCH] lcd_put_wchar_max for COLOR_UI (#20838) Co-Authored-By: Victor Oliveira --- Marlin/src/inc/SanityCheck.h | 16 ++++++++++++---- Marlin/src/lcd/tft/ui_320x240.cpp | 7 +++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2d4b073e15..95210d4527 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -357,10 +357,6 @@ #error "FILAMENT_CHANGE_LOAD_LENGTH is now FILAMENT_CHANGE_FAST_LOAD_LENGTH." #elif defined(LEVEL_CORNERS_INSET) #error "LEVEL_CORNERS_INSET is now LEVEL_CORNERS_INSET_LFRB." -#elif ENABLED(LEVEL_BED_CORNERS) && !defined(LEVEL_CORNERS_INSET_LFRB) - #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values." -#elif BOTH(LEVEL_CORNERS_USE_PROBE, SENSORLESS_PROBING) - #error "LEVEL_CORNERS_USE_PROBE is incompatible with SENSORLESS_PROBING." #elif defined(BEZIER_JERK_CONTROL) #error "BEZIER_JERK_CONTROL is now S_CURVE_ACCELERATION." #elif HAS_JUNCTION_DEVIATION && defined(JUNCTION_DEVIATION_FACTOR) @@ -1433,6 +1429,18 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif +#if ENABLED(LEVEL_BED_CORNERS) + #ifndef LEVEL_CORNERS_INSET_LFRB + #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values." + #elif ENABLED(LEVEL_CORNERS_USE_PROBE) + #if !HAS_BED_PROBE + #error "LEVEL_CORNERS_USE_PROBE requires a real probe." + #elif ENABLED(SENSORLESS_PROBING) + #error "LEVEL_CORNERS_USE_PROBE is incompatible with SENSORLESS_PROBING." + #endif + #endif +#endif + /** * Allow only one bed leveling option to be defined */ diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 4c09d9803e..aea0039698 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -668,6 +668,13 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { tft.set_background(COLOR_BACKGROUND); } +int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { + tft_string.set(); + tft_string.add(c); + tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); + return tft_string.width(); +} + int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { tft_string.set(utf8_str_P); tft_string.trim();