Invariant Marlin bootscreen (#15057)
This commit is contained in:
@ -386,6 +386,8 @@
|
||||
#error "MKS_ROBIN_TFT is now FSMC_GRAPHICAL_TFT. Please update your configuration."
|
||||
#elif defined(SDPOWER)
|
||||
#error "SDPOWER is now SDPOWER_PIN. Please update your configuration and/or pins."
|
||||
#elif defined(STRING_SPLASH_LINE1) || defined(STRING_SPLASH_LINE2)
|
||||
#error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
|
||||
#endif
|
||||
|
||||
#define BOARD_MKS_13 -1109
|
||||
|
@ -449,59 +449,28 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
|
||||
}
|
||||
|
||||
#ifdef STRING_SPLASH_LINE1
|
||||
//
|
||||
// Show the Marlin logo with splash line 1
|
||||
//
|
||||
if (LCD_EXTRA_SPACE >= utf8_strlen(SHORT_BUILD_VERSION) + 1) {
|
||||
//
|
||||
// Show the Marlin logo with splash line 1
|
||||
// Show the Marlin logo, splash line1, and splash line 2
|
||||
//
|
||||
if (LCD_EXTRA_SPACE >= utf8_strlen(STRING_SPLASH_LINE1) + 1) {
|
||||
//
|
||||
// Show the Marlin logo, splash line1, and splash line 2
|
||||
//
|
||||
logo_lines(PSTR(" " STRING_SPLASH_LINE1));
|
||||
#ifdef STRING_SPLASH_LINE2
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
|
||||
#else
|
||||
safe_delay(2000);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Show the Marlin logo with splash line 1
|
||||
// After a delay show splash line 2, if it exists
|
||||
//
|
||||
#ifdef STRING_SPLASH_LINE2
|
||||
#define _SPLASH_WAIT_1 1500
|
||||
#else
|
||||
#define _SPLASH_WAIT_1 2000
|
||||
#endif
|
||||
logo_lines(PSTR(""));
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE1, _SPLASH_WAIT_1);
|
||||
#ifdef STRING_SPLASH_LINE2
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 1500);
|
||||
#ifdef STRING_SPLASH_LINE3
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#elif defined(STRING_SPLASH_LINE2)
|
||||
logo_lines(PSTR(" " SHORT_BUILD_VERSION));
|
||||
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 2000);
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Show splash line 2 only, alongside the logo if possible
|
||||
//
|
||||
if (LCD_EXTRA_SPACE >= utf8_strlen(STRING_SPLASH_LINE2) + 1) {
|
||||
logo_lines(PSTR(" " STRING_SPLASH_LINE2));
|
||||
safe_delay(2000);
|
||||
}
|
||||
else {
|
||||
logo_lines(PSTR(""));
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
|
||||
}
|
||||
#else
|
||||
//
|
||||
// Show only the Marlin logo
|
||||
// Show the Marlin logo and short build version
|
||||
// After a delay show the website URL
|
||||
//
|
||||
logo_lines(PSTR(""));
|
||||
safe_delay(2000);
|
||||
#endif
|
||||
CENTER_OR_SCROLL(SHORT_BUILD_VERSION, 1500);
|
||||
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 1500);
|
||||
#ifdef STRING_SPLASH_LINE3
|
||||
CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
|
||||
#endif
|
||||
}
|
||||
|
||||
lcd.clear();
|
||||
safe_delay(100);
|
||||
@ -585,11 +554,13 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char pref
|
||||
|
||||
FORCE_INLINE void _draw_bed_status(const bool blink) {
|
||||
_draw_heater_status(H_BED, (
|
||||
#if HAS_LEVELING
|
||||
planner.leveling_active && blink ? '_' :
|
||||
#endif
|
||||
LCD_STR_BEDTEMP[0]
|
||||
), blink);
|
||||
#if HAS_LEVELING
|
||||
planner.leveling_active && blink ? '_' :
|
||||
#endif
|
||||
LCD_STR_BEDTEMP[0]
|
||||
),
|
||||
blink
|
||||
);
|
||||
}
|
||||
|
||||
#if HAS_PRINT_PROGRESS
|
||||
|
@ -159,23 +159,17 @@ bool MarlinUI::detected() { return true; }
|
||||
}
|
||||
#endif // SHOW_CUSTOM_BOOTSCREEN
|
||||
|
||||
// Draws a slice of the Marlin bootscreen, without the u8g loop
|
||||
void MarlinUI::draw_marlin_bootscreen() {
|
||||
// Screen dimensions.
|
||||
//const u8g_uint_t width = u8g.getWidth(), height = u8g.getHeight();
|
||||
constexpr u8g_uint_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
|
||||
|
||||
// Draw the static Marlin bootscreen from a u8g loop
|
||||
// or the animated boot screen within its own u8g loop
|
||||
void MarlinUI::draw_marlin_bootscreen(const bool line2/*=false*/) {
|
||||
// Determine text space needed
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
constexpr u8g_uint_t text_total_height = MENU_FONT_HEIGHT,
|
||||
text_width_2 = 0;
|
||||
#else
|
||||
constexpr u8g_uint_t text_total_height = (MENU_FONT_HEIGHT) * 2,
|
||||
text_width_2 = u8g_uint_t((sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH));
|
||||
#endif
|
||||
constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)),
|
||||
constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(SHORT_BUILD_VERSION) - 1) * (MENU_FONT_WIDTH)),
|
||||
text_width_2 = u8g_uint_t((sizeof(MARLIN_WEBSITE_URL) - 1) * (MENU_FONT_WIDTH)),
|
||||
text_max_width = _MAX(text_width_1, text_width_2),
|
||||
text_total_height = (MENU_FONT_HEIGHT) * 2,
|
||||
width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT,
|
||||
rspace = width - (START_BMPWIDTH);
|
||||
constexpr bool two_part = (height - (START_BMPHEIGHT)) < ((MENU_FONT_ASCENT) * 2);
|
||||
|
||||
u8g_int_t offx, offy, txt_base, txt_offx_1, txt_offx_2;
|
||||
|
||||
@ -189,8 +183,8 @@ bool MarlinUI::detected() { return true; }
|
||||
}
|
||||
else {
|
||||
constexpr int8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space
|
||||
offy = inter; // V-align boot logo proportionally
|
||||
offx = rspace / 2; // Center the boot logo in the whole space
|
||||
offy = inter; // V-align boot logo proportionally
|
||||
txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered
|
||||
txt_offx_2 = (width - text_width_2) / 2; // Text 2 centered
|
||||
txt_base = offy + START_BMPHEIGHT + offy + text_total_height - (MENU_FONT_DESCENT); // Even spacing looks best
|
||||
@ -201,12 +195,8 @@ bool MarlinUI::detected() { return true; }
|
||||
auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
|
||||
u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
|
||||
set_font(FONT_MENU);
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
lcd_put_u8str_P(txt_offx_1, txt_base, PSTR(STRING_SPLASH_LINE1));
|
||||
#else
|
||||
lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(STRING_SPLASH_LINE1));
|
||||
lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(STRING_SPLASH_LINE2));
|
||||
#endif
|
||||
if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(SHORT_BUILD_VERSION));
|
||||
if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(MARLIN_WEBSITE_URL));
|
||||
};
|
||||
|
||||
#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
||||
@ -229,9 +219,15 @@ bool MarlinUI::detected() { return true; }
|
||||
#ifndef BOOTSCREEN_TIMEOUT
|
||||
#define BOOTSCREEN_TIMEOUT 2500
|
||||
#endif
|
||||
u8g.firstPage();
|
||||
do { draw_marlin_bootscreen(); } while (u8g.nextPage());
|
||||
safe_delay(BOOTSCREEN_TIMEOUT);
|
||||
for (uint8_t q = 2; q--;) {
|
||||
#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
||||
u8g.firstPage();
|
||||
do { draw_marlin_bootscreen(q == 0); } while (u8g.nextPage());
|
||||
#else
|
||||
draw_marlin_bootscreen(q == 0);
|
||||
#endif
|
||||
safe_delay((BOOTSCREEN_TIMEOUT) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
|
@ -319,7 +319,7 @@ public:
|
||||
#endif
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static void draw_marlin_bootscreen();
|
||||
static void draw_marlin_bootscreen(const bool line2=false);
|
||||
static void show_marlin_bootscreen();
|
||||
static void show_bootscreen();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user