Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] bugfix-2.1.x from MarlinFirmware:bugfix-2.1.x #474

Merged
merged 5 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/inc/MarlinConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -65,3 +63,8 @@
#endif

#include "../core/multi_language.h"

#ifndef __MARLIN_DEPS__
#include "SanityCheck.h"
#include HAL_PATH(.., inc/SanityCheck.h)
#endif
26 changes: 24 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
72 changes: 59 additions & 13 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -361,7 +370,9 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
createChar_P(LCD_STR_FOLDER[0], folder);
#endif
}
}
} break;

}

}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -660,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(" "));
Expand Down
14 changes: 14 additions & 0 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/lcdprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ typedef bool (*statusResetFunc_t)();
enum HD44780CharSet : uint8_t {
CHARSET_MENU,
CHARSET_INFO,
CHARSET_BOOT
CHARSET_BOOT,
CHARSET_BOOT_CUSTOM
};
#endif

Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions ini/native.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading