From a8800d5b0a7b204b8b988d633898babd9cb31532 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 27 Dec 2020 19:10:53 -0800 Subject: [PATCH] Small / Large Boot Screen option for TFT_COLOR_UI (#20578) --- Marlin/Configuration_adv.h | 4 +++- Marlin/src/lcd/tft/ui_320x240.cpp | 16 +++++++++++++--- Marlin/src/lcd/tft/ui_320x240.h | 2 +- Marlin/src/lcd/tft/ui_480x320.cpp | 20 +++++++++++++------- Marlin/src/lcd/tft/ui_480x320.h | 2 +- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d871f822da..6b1febc8f5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1140,6 +1140,9 @@ #if ENABLED(SHOW_BOOTSCREEN) #define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s) + #if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI) + #define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash) + #endif #endif // Scroll a longer status message into view @@ -1450,7 +1453,6 @@ //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar - //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~‭3260 (or ~940) bytes of PROGMEM. // Frivolous Game Options diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index bcd1cb2ab9..2cc586a48a 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -92,10 +92,20 @@ void MarlinUI::clear_lcd() { tft.queue.reset(); tft.canvas(0, 0, TFT_WIDTH, TFT_HEIGHT); - tft.add_image(0, 0, imgBootScreen); // MarlinLogo320x240x16 - + #if ENABLED(BOOT_MARLIN_LOGO_SMALL) + #define BOOT_LOGO_W 195 // MarlinLogo195x59x16 + #define BOOT_LOGO_H 59 + #define SITE_URL_Y (TFT_HEIGHT - 46) + tft.set_background(COLOR_BACKGROUND); + #else + #define BOOT_LOGO_W 320 // MarlinLogo320x240x16 + #define BOOT_LOGO_H 240 + #define SITE_URL_Y (TFT_HEIGHT - 52) + #endif + tft.add_image((TFT_WIDTH - BOOT_LOGO_W) / 2, (TFT_HEIGHT - BOOT_LOGO_H) / 2, imgBootScreen); #ifdef WEBSITE_URL - tft.add_text(4, 188, COLOR_WEBSITE_URL, WEBSITE_URL); + tft_string.set(WEBSITE_URL); + tft.add_text(tft_string.center(TFT_WIDTH), SITE_URL_Y, COLOR_WEBSITE_URL, tft_string); #endif tft.queue.sync(); diff --git a/Marlin/src/lcd/tft/ui_320x240.h b/Marlin/src/lcd/tft/ui_320x240.h index c9822f11cc..0f928eea37 100644 --- a/Marlin/src/lcd/tft/ui_320x240.h +++ b/Marlin/src/lcd/tft/ui_320x240.h @@ -44,7 +44,7 @@ void menu_item(const uint8_t row, bool sel = false); #define ABSOLUTE_ZERO -273.15 const tImage Images[imgCount] = { - MarlinLogo320x240x16, + TERN(BOOT_MARLIN_LOGO_SMALL, MarlinLogo195x59x16, MarlinLogo320x240x16), HotEnd_64x64x4, Bed_64x64x4, Bed_Heated_64x64x4, diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 9e387b2402..8d05ab7df4 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -90,18 +90,24 @@ void MarlinUI::clear_lcd() { } #if ENABLED(SHOW_BOOTSCREEN) - #undef BOOTSCREEN_TIMEOUT - #define BOOTSCREEN_TIMEOUT 5000 - void MarlinUI::show_bootscreen() { tft.queue.reset(); tft.canvas(0, 0, TFT_WIDTH, TFT_HEIGHT); - tft.set_background(COLOR_BACKGROUND); - tft.add_image(142, 130, imgBootScreen); // MarlinLogo195x59x16 - + #if ENABLED(BOOT_MARLIN_LOGO_SMALL) + #define BOOT_LOGO_W 195 // MarlinLogo195x59x16 + #define BOOT_LOGO_H 59 + #define SITE_URL_Y (TFT_HEIGHT - 70) + tft.set_background(COLOR_BACKGROUND); + #else + #define BOOT_LOGO_W 480 // MarlinLogo480x320x16 + #define BOOT_LOGO_H 320 + #define SITE_URL_Y (TFT_HEIGHT - 90) + #endif + tft.add_image((TFT_WIDTH - BOOT_LOGO_W) / 2, (TFT_HEIGHT - BOOT_LOGO_H) / 2, imgBootScreen); #ifdef WEBSITE_URL - tft.add_text(8, 250, COLOR_WEBSITE_URL, WEBSITE_URL); + tft_string.set(WEBSITE_URL); + tft.add_text(tft_string.center(TFT_WIDTH), SITE_URL_Y, COLOR_WEBSITE_URL, tft_string); #endif tft.queue.sync(); diff --git a/Marlin/src/lcd/tft/ui_480x320.h b/Marlin/src/lcd/tft/ui_480x320.h index 053ee78158..cc62ee8cce 100644 --- a/Marlin/src/lcd/tft/ui_480x320.h +++ b/Marlin/src/lcd/tft/ui_480x320.h @@ -44,7 +44,7 @@ void menu_item(const uint8_t row, bool sel = false); #define ABSOLUTE_ZERO -273.15 const tImage Images[imgCount] = { - MarlinLogo195x59x16, + TERN(BOOT_MARLIN_LOGO_SMALL, MarlinLogo195x59x16, MarlinLogo480x320x16), HotEnd_64x64x4, Bed_64x64x4, Bed_Heated_64x64x4,