diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ae4acaa56b..ffcecc3533 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1628,7 +1628,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, HAS_MARLINUI_HD44780) + #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, HAS_MARLINUI_HD44780, HAS_GRAPHICAL_TFT) //#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 e0a42cdf37..f5c593fccd 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -399,8 +399,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_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." +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) && NONE(TFT_COLOR_UI, HAS_MARLINUI_HD44780, HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI) + #error "SHOW_CUSTOM_BOOTSCREEN requires Character LCD, Graphical LCD, TOUCH_UI_FTDI_EVE, or TFT_COLOR_UI." #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/tft/canvas.cpp b/Marlin/src/lcd/tft/canvas.cpp index 0f77149a5a..a237bb8434 100644 --- a/Marlin/src/lcd/tft/canvas.cpp +++ b/Marlin/src/lcd/tft/canvas.cpp @@ -134,11 +134,22 @@ void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) uint32_t rle_offset; } rle_state; + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + static MarlinImage last_image = noImage; + #endif + // RLE16 HIGHCOLOR - 16 bits per pixel if (color_mode == RLE16) { uint8_t *bytedata = (uint8_t *)images[image].data; if (!bytedata) return; + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) // Reset RLE state if a different image + if (image != last_image) { + rle_state.has_rle_state = false; + last_image = image; + } + #endif + // Loop through the image data advancing the row and column as needed int16_t srcy = 0, srcx = 0, // Image data line / column index dsty = y, dstx = x; // Destination line / column index diff --git a/Marlin/src/lcd/tft/tft_image.cpp b/Marlin/src/lcd/tft/tft_image.cpp index 1d287f4ba6..25fefbf8c5 100644 --- a/Marlin/src/lcd/tft/tft_image.cpp +++ b/Marlin/src/lcd/tft/tft_image.cpp @@ -30,40 +30,41 @@ const tImage NoLogo = { nullptr, 0, 0, NOCOLORS }; const tImage images[imgCount] = { - TERN(SHOW_BOOTSCREEN, BOOTSCREEN_LOGO, NoLogo), // imgBootScreen - HotEnd_64x64x4, // imgHotEnd - Bed_64x64x4, // imgBed - Bed_Heated_64x64x4, // imgBedHeated - Chamber_64x64x4, // imgChamber - Chamber_Heated_64x64x4, // imgChamberHeated - Fan0_64x64x4, // imgFanIdle - Fan_Slow0_64x64x4, // imgFanSlow0 - Fan_Slow1_64x64x4, // imgFanSlow1 - Fan_Fast0_64x64x4, // imgFanFast0 - Fan_Fast1_64x64x4, // imgFanFast1 - Feedrate_32x32x4, // imgFeedRate - Flowrate_32x32x4, // imgFlowRate - SD_64x64x4, // imgSD - Menu_64x64x4, // imgMenu - Settings_64x64x4, // imgSettings - Directory_32x32x4, // imgDirectory - Confirm_64x64x4, // imgConfirm - Cancel_64x64x4, // imgCancel - Increase_64x64x4, // imgIncrease - Decrease_64x64x4, // imgDecrease - Back_32x32x4, // imgBack - Up_32x32x4, // imgUp - Down_32x32x4, // imgDown - Left_32x32x4, // imgLeft - Right_32x32x4, // imgRight - Refresh_32x32x4, // imgRefresh - Leveling_32x32x4, // imgLeveling - Slider8x16x4, // imgSlider - Home_64x64x4, // imgHome - BtnRounded_64x52x4, // imgBtn52Rounded - BtnRounded_42x39x4, // imgBtn39Rounded - Time_Elapsed_32x32x4, // imgTimeElapsed - Time_Remaining_32x32x4, // imgTimeRemaining + TERN(SHOW_CUSTOM_BOOTSCREEN, CUSTOM_BOOTSCREEN, NoLogo), // imgCustomBoot + TERN(SHOW_BOOTSCREEN, BOOTSCREEN_LOGO, NoLogo), // imgBootScreen + HotEnd_64x64x4, // imgHotEnd + Bed_64x64x4, // imgBed + Bed_Heated_64x64x4, // imgBedHeated + Chamber_64x64x4, // imgChamber + Chamber_Heated_64x64x4, // imgChamberHeated + Fan0_64x64x4, // imgFanIdle + Fan_Slow0_64x64x4, // imgFanSlow0 + Fan_Slow1_64x64x4, // imgFanSlow1 + Fan_Fast0_64x64x4, // imgFanFast0 + Fan_Fast1_64x64x4, // imgFanFast1 + Feedrate_32x32x4, // imgFeedRate + Flowrate_32x32x4, // imgFlowRate + SD_64x64x4, // imgSD + Menu_64x64x4, // imgMenu + Settings_64x64x4, // imgSettings + Directory_32x32x4, // imgDirectory + Confirm_64x64x4, // imgConfirm + Cancel_64x64x4, // imgCancel + Increase_64x64x4, // imgIncrease + Decrease_64x64x4, // imgDecrease + Back_32x32x4, // imgBack + Up_32x32x4, // imgUp + Down_32x32x4, // imgDown + Left_32x32x4, // imgLeft + Right_32x32x4, // imgRight + Refresh_32x32x4, // imgRefresh + Leveling_32x32x4, // imgLeveling + Slider8x16x4, // imgSlider + Home_64x64x4, // imgHome + BtnRounded_64x52x4, // imgBtn52Rounded + BtnRounded_42x39x4, // imgBtn39Rounded + Time_Elapsed_32x32x4, // imgTimeElapsed + Time_Remaining_32x32x4, // imgTimeRemaining }; #endif // HAS_GRAPHICAL_TFT diff --git a/Marlin/src/lcd/tft/tft_image.h b/Marlin/src/lcd/tft/tft_image.h index 8abca6f330..e1f078a90b 100644 --- a/Marlin/src/lcd/tft/tft_image.h +++ b/Marlin/src/lcd/tft/tft_image.h @@ -25,12 +25,21 @@ #if ENABLED(COMPACT_MARLIN_BOOT_LOGO) #define MARLIN_LOGO_CHOSEN(W,H) { (void *)marlin_logo_##W##x##H##x16_rle16, W, H, RLE16 } + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + #define _CUSTOM_BOOTSCREEN_CHOSEN(W,H) { (void *)custom_bootscreen_##W##x##H##x16_rle16, W, H, RLE16 } + #define CUSTOM_BOOTSCREEN_CHOSEN(W,H) _CUSTOM_BOOTSCREEN_CHOSEN(W,H) + #endif #else #define MARLIN_LOGO_CHOSEN(W,H) { (void *)marlin_logo_##W##x##H##x16, W, H, HIGHCOLOR } + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + #define _CUSTOM_BOOTSCREEN_CHOSEN(W,H){ (void *)custom_bootscreen_##W##x##H##x16, W, H, HIGHCOLOR } + #define CUSTOM_BOOTSCREEN_CHOSEN(W,H) _CUSTOM_BOOTSCREEN_CHOSEN(W,H) + #endif #endif enum MarlinImage : uint8_t { - imgBootScreen = 0x00, // BOOTSCREEN_LOGO / NoLogo + imgCustomBoot = 0x00, // CUSTOM_BOOTSCREEN + imgBootScreen, // BOOTSCREEN_LOGO / NoLogo imgHotEnd, // HotEnd_64x64x4 imgBed, // Bed_64x64x4 imgBedHeated, // Bed_Heated_64x64x4 diff --git a/Marlin/src/lcd/tft/ui_color_ui.cpp b/Marlin/src/lcd/tft/ui_color_ui.cpp index 6c90cb6c36..3287285f69 100644 --- a/Marlin/src/lcd/tft/ui_color_ui.cpp +++ b/Marlin/src/lcd/tft/ui_color_ui.cpp @@ -64,6 +64,20 @@ void MarlinUI::tft_idle() { #if ENABLED(SHOW_BOOTSCREEN) void MarlinUI::show_bootscreen() { + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + tft.queue.reset(); + tft.canvas(CUSTOM_BOOTSCREEN_X, CUSTOM_BOOTSCREEN_Y, CUSTOM_BOOTSCREEN_WIDTH, CUSTOM_BOOTSCREEN_HEIGHT); + tft.set_background(COLOR_BACKGROUND); + tft.add_image(0, 0, imgCustomBoot); + tft.queue.sync(); + #ifndef CUSTOM_BOOTSCREEN_TIMEOUT + #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 + #endif + #if CUSTOM_BOOTSCREEN_TIMEOUT + safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); + #endif + #endif + tft.queue.reset(); tft.canvas(0, 0, TFT_WIDTH, TFT_HEIGHT); diff --git a/Marlin/src/lcd/tft/ui_common.h b/Marlin/src/lcd/tft/ui_common.h index ef26d6745f..f43dc95fb2 100644 --- a/Marlin/src/lcd/tft/ui_common.h +++ b/Marlin/src/lcd/tft/ui_common.h @@ -30,14 +30,37 @@ #include "tft.h" #include "tft_image.h" +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + #include "../../../_Bootscreen.h" + + #ifndef CUSTOM_BOOTSCREEN + #define CUSTOM_BOOTSCREEN CustomBootscreen + #endif + #ifndef CUSTOM_BOOTSCREEN_WIDTH + #define CUSTOM_BOOTSCREEN_WIDTH TFT_WIDTH + #endif + #ifndef CUSTOM_BOOTSCREEN_HEIGHT + #define CUSTOM_BOOTSCREEN_HEIGHT TFT_HEIGHT + #endif + + #ifndef CUSTOM_BOOTSCREEN_X + #define CUSTOM_BOOTSCREEN_X ((TFT_WIDTH - (CUSTOM_BOOTSCREEN_WIDTH)) / 2) + #endif + #ifndef CUSTOM_BOOTSCREEN_Y + #define CUSTOM_BOOTSCREEN_Y ((TFT_HEIGHT - (CUSTOM_BOOTSCREEN_HEIGHT)) / 2) + #endif + + const tImage CustomBootscreen = CUSTOM_BOOTSCREEN_CHOSEN(CUSTOM_BOOTSCREEN_WIDTH, CUSTOM_BOOTSCREEN_HEIGHT); + +#endif // SHOW_CUSTOM_BOOTSCREEN + #if ENABLED(TOUCH_SCREEN) #include "touch.h" extern bool draw_menu_navigation; #else // add_control() function is used to display encoder-controlled elements - enum TouchControlType : uint16_t { - NONE = 0x0000, - }; + enum TouchControlType : uint16_t { NONE = 0x0000 }; #endif #define UI_INCL_(W, H) STRINGIFY_(ui_##W##x##H.h)