From a7317de3b43f4332d79c1efa45e6fc361c553acd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 19 May 2024 14:08:41 -0500 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=A8=20Sim=20needs=20GLM=5FENABLE?= =?UTF-8?q?=5FEXPERIMENTAL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/native.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ini/native.ini b/ini/native.ini index 3da0237c0f2e..28c558d39f39 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -49,8 +49,9 @@ build_flags = ${env:linux_native.build_flags} -Werror [simulator_common] platform = native framework = -build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS +build_flags = ${common.build_flags} -std=gnu++17 -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g + -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -DGLM_ENABLE_EXPERIMENTAL build_src_flags = -Wall -Wno-expansion-to-defined -Wno-deprecated-declarations -Wcast-align release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb @@ -153,5 +154,4 @@ build_src_flags = ${simulator_common.build_src_flags} -fpermissive build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp - -DGLM_ENABLE_EXPERIMENTAL build_type = debug From a97d1088f0042c2d9caab8528e1a80ea43274f34 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 19 May 2024 18:42:07 -0500 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20Ensure=20distinct=20language?= =?UTF-8?q?s=20(#27107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/MarlinConfig.h | 7 +++++-- Marlin/src/inc/SanityCheck.h | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index 4058761b9f7c..807082d839d6 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -52,8 +52,6 @@ #include HAL_PATH(.., inc/Conditionals_type.h) #include "Changes.h" - #include "SanityCheck.h" - #include HAL_PATH(.., inc/SanityCheck.h) // Include all core headers #include "../core/language.h" @@ -65,3 +63,8 @@ #endif #include "../core/multi_language.h" + +#ifndef __MARLIN_DEPS__ + #include "SanityCheck.h" + #include HAL_PATH(.., inc/SanityCheck.h) +#endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 339cd4087caa..2e935c4f4b9c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2703,6 +2703,28 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i #undef IS_U8GLIB_SSD1306 #undef IS_EXTUI +/** + * Make sure LCD language settings are distinct + */ +#if NUM_LANGUAGES > 1 + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_2), STRINGIFY(LCD_LANGUAGE)), "Error: LCD_LANGUAGE_2 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE."); +#endif +#if NUM_LANGUAGES > 2 + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_3), STRINGIFY(LCD_LANGUAGE)), "Error: LCD_LANGUAGE_3 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_3), STRINGIFY(LCD_LANGUAGE_2)), "Error: LCD_LANGUAGE_3 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_2."); +#endif +#if NUM_LANGUAGES > 3 + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_4), STRINGIFY(LCD_LANGUAGE)), "Error: LCD_LANGUAGE_4 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_4), STRINGIFY(LCD_LANGUAGE_2)), "Error: LCD_LANGUAGE_4 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_2."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_4), STRINGIFY(LCD_LANGUAGE_3)), "Error: LCD_LANGUAGE_4 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_3."); +#endif +#if NUM_LANGUAGES > 4 + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_5), STRINGIFY(LCD_LANGUAGE)), "Error: LCD_LANGUAGE_5 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_5), STRINGIFY(LCD_LANGUAGE_2)), "Error: LCD_LANGUAGE_5 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_2."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_5), STRINGIFY(LCD_LANGUAGE_3)), "Error: LCD_LANGUAGE_5 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_3."); + static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_5), STRINGIFY(LCD_LANGUAGE_4)), "Error: LCD_LANGUAGE_5 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_4."); +#endif + #if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, \ TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0) #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) From eec1aec071df9ef2a78d577d0f6b4ed76cb6c6ff Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 19 May 2024 18:43:04 -0500 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=90=9B=20Fix=20multi-byte=20menu=20st?= =?UTF-8?q?ring=20buffer=20overrun=20(#27100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/lcdprint.cpp | 2 +- Marlin/src/module/motion.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index ea833f53a1df..475664f45a0e 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -114,7 +114,7 @@ lcd_uint_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t in * Return the number of characters emitted */ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { - char estr[maxlen + 2]; + char estr[maxlen * LANG_CHARSIZE + 2]; const lcd_uint_t outlen = expand_u8str_P(estr, ptpl, ind, cstr, fstr, maxlen); lcd_put_u8str_max(estr, maxlen * (MENU_FONT_WIDTH)); return outlen; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 26181d83966d..473d54cc382b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1637,8 +1637,7 @@ void prepare_line_to_destination() { SERIAL_ECHO_START(); msg.echoln(); - msg.setf(GET_TEXT_F(MSG_HOME_FIRST), need); - ui.set_status(msg); + ui.status_printf(0, GET_TEXT_F(MSG_HOME_FIRST), need); return true; } From feca9a33d5c9a06aa3c0b878acfbb8a552b70c1b Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 20 May 2024 11:51:52 +1200 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8=20SHOW=5FCUSTOM=5FBOOTSCREEN=20fo?= =?UTF-8?q?r=20HD44780=20(#26793)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 2 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 69 ++++++++++++++++++--- Marlin/src/lcd/HD44780/marlinui_HD44780.h | 14 +++++ Marlin/src/lcd/marlinui.h | 3 +- 5 files changed, 78 insertions(+), 14 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index f0066338c177..5f5f07d19eb2 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1584,7 +1584,7 @@ #if HAS_MARLINUI_U8GLIB //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash. #endif - #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE) + #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780) //#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup. #endif #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2e935c4f4b9c..665a7306f8dc 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -388,8 +388,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Custom Boot and Status screens */ -#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI) - #error "SHOW_CUSTOM_BOOTSCREEN requires Graphical LCD or TOUCH_UI_FTDI_EVE." +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(HAS_MARLINUI_HD44780, HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI) + #error "SHOW_CUSTOM_BOOTSCREEN requires Character LCD, Graphical LCD, or TOUCH_UI_FTDI_EVE." #elif ENABLED(SHOW_CUSTOM_BOOTSCREEN) && DISABLED(SHOW_BOOTSCREEN) #error "SHOW_CUSTOM_BOOTSCREEN requires SHOW_BOOTSCREEN." #elif ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) && !HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 0ab045bda37a..686d0972b975 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -331,15 +331,24 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS #endif // HAS_MEDIA - #if ENABLED(SHOW_BOOTSCREEN) - // Set boot screen corner characters - if (screen_charset == CHARSET_BOOT) { - for (uint8_t i = 4; i--;) - createChar_P(i, corner[i]); - } - else - #endif - { // Info Screen uses 5 special characters + switch (screen_charset) { + + #if ENABLED(SHOW_BOOTSCREEN) + case CHARSET_BOOT: { + // Set boot screen corner characters + for (uint8_t i = 4; i--;) createChar_P(i, corner[i]); + } break; + #endif + + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + case CHARSET_BOOT_CUSTOM: { + for (uint8_t i = COUNT(customBootChars); i--;) + createChar_P(i, customBootChars[i]); + } break; + #endif + + default: { + // Info Screen uses 5 special characters createChar_P(LCD_STR_BEDTEMP[0], bedTemp); createChar_P(LCD_STR_DEGREE[0], degree); createChar_P(LCD_STR_THERMOMETER[0], thermometer); @@ -361,7 +370,9 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS createChar_P(LCD_STR_FOLDER[0], folder); #endif } - } + } break; + + } } @@ -400,6 +411,42 @@ bool MarlinUI::detected() { return TERN1(DETECT_I2C_LCD_DEVICE, lcd.LcdDetected() == 1); } +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + #ifndef CUSTOM_BOOTSCREEN_X + #define CUSTOM_BOOTSCREEN_X -1 + #endif + #ifndef CUSTOM_BOOTSCREEN_Y + #define CUSTOM_BOOTSCREEN_Y ((LCD_HEIGHT - COUNT(custom_boot_lines)) / 2) + #endif + #ifndef CUSTOM_BOOTSCREEN_TIMEOUT + #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 + #endif + + void MarlinUI::draw_custom_bootscreen(const uint8_t/*=0*/) { + set_custom_characters(CHARSET_BOOT_CUSTOM); + lcd.clear(); + const int8_t sx = CUSTOM_BOOTSCREEN_X; + const uint8_t sy = CUSTOM_BOOTSCREEN_Y; + for (lcd_uint_t i = 0; i < COUNT(custom_boot_lines); ++i) { + PGM_P const pstr = (PGM_P)pgm_read_ptr(&custom_boot_lines[i]); + const uint8_t clen = utf8_strlen_P(pstr); + const lcd_uint_t x = sx >= 0 ? sx : (LCD_WIDTH - clen) / 2; + for (lcd_uint_t j = 0; j < clen; ++j) { + const lchar_t c = pgm_read_byte(&pstr[j]); + lcd_put_lchar(x + j, sy + i, c == '\x08' ? '\x00' : c); + } + } + } + + // Shows the custom bootscreen and delays + void MarlinUI::show_custom_bootscreen() { + draw_custom_bootscreen(); + safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); + } + +#endif // SHOW_CUSTOM_BOOTSCREEN + #if HAS_SLOW_BUTTONS uint8_t MarlinUI::read_slow_buttons() { #if ENABLED(LCD_I2C_TYPE_MCP23017) @@ -466,6 +513,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); } } void MarlinUI::show_bootscreen() { + TERN_(SHOW_CUSTOM_BOOTSCREEN, show_custom_bootscreen()); + set_custom_characters(CHARSET_BOOT); lcd.clear(); diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.h b/Marlin/src/lcd/HD44780/marlinui_HD44780.h index 6f6f5a6855b6..15f268f8d996 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.h +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.h @@ -27,6 +27,20 @@ #include "../../inc/MarlinConfig.h" +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + #include "../../../_Bootscreen.h" + + #ifdef CUSTOM_BOOTSCREEN_Y + #define CUSTOM_BOOT_LAST COUNT(custom_boot_lines) + CUSTOM_BOOTSCREEN_Y + #else + #define CUSTOM_BOOT_LAST COUNT(custom_boot_lines) + #endif + + static_assert(CUSTOM_BOOT_LAST <= LCD_HEIGHT, "custom_boot_lines (plus CUSTOM_BOOTSCREEN_Y) doesn't fit on the selected LCD."); + +#endif + #if ENABLED(LCD_I2C_TYPE_PCF8575) // NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins. diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ad4be0390060..53300a4400a6 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -105,7 +105,8 @@ typedef bool (*statusResetFunc_t)(); enum HD44780CharSet : uint8_t { CHARSET_MENU, CHARSET_INFO, - CHARSET_BOOT + CHARSET_BOOT, + CHARSET_BOOT_CUSTOM }; #endif From 0e2bd069d4e0ae3cfcc5a15ec86c865d4eeef21c Mon Sep 17 00:00:00 2001 From: Dave Gateman Date: Sun, 19 May 2024 17:53:38 -0600 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20cutter=20power=20extra?= =?UTF-8?q?=20'%'=20(#27105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 686d0972b975..ea732432503e 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -709,9 +709,6 @@ FORCE_INLINE void _draw_bed_status(const bool blink) { lcd_put_u8str(F("K")); #else lcd_put_u8str(cutter_power2str(cutter.unitPower)); - #if CUTTER_UNIT_IS(PERCENT) - lcd_put_u8str(F("%")); - #endif #endif lcd_put_u8str(F(" "));