Skip to content

Commit

Permalink
Small / Large Boot Screen option for TFT_COLOR_UI (#20578)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiskeithb authored Dec 28, 2020
1 parent 91c350e commit cfcfc80
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
4 changes: 3 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions Marlin/src/lcd/tft/ui_320x240.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_320x240.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 13 additions & 7 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_480x320.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

2 comments on commit cfcfc80

@th0m4sek
Copy link

@th0m4sek th0m4sek commented on cfcfc80 Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is wrong
I'm using MKS Robin Nano V1.2 and mks_robin_nano35_stm32
with small logo

Building .pio/build/mks_robin_nano35_stm32/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [======== ] 75.7% (used 49620 bytes from 65536 bytes)
Flash: [===== ] 50.3% (used 263488 bytes from 524288 bytes)
encrypt([".pio/build/mks_robin_nano35_stm32/firmware.bin"], [".pio/build/mks_robin_nano35_stm32/firmware.elf"])

when #define BOOT_MARLIN_LOGO_SMALL is commented marli is not compilling

Compiling .pio/build/mks_robin_nano35_stm32/src/src/sd/cardreader.cpp.o
Linking .pio/build/mks_robin_nano35_stm32/firmware.elf
/home/th0m4s/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/mks_robin_nano35_stm32/firmware.elf section .rodata' will not fit in region FLASH'
/home/th0m4s/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 52644 bytes
collect2: error: ld returned 1 exit status
*** [.pio/build/mks_robin_nano35_stm32/firmware.elf] Error 1
============================================== [FAILED] Took 98.74 seconds ==============================================

Environment Status Duration


mks_robin_nano35_stm32 FAILED 00:01:38.740

#define SHOW_BOOTSCREEN also cannot be commented at this point.

@thisiskeithb
Copy link
Member Author

@thisiskeithb thisiskeithb commented on cfcfc80 Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ld: region `FLASH' overflowed by 52644 bytes

@th0m4sek: The 480x320 UI is now using the larger 480x320 bootscreen when BOOT_MARLIN_LOGO_SMALL is disabled, which takes up a lot more flash.

You need to leave BOOT_MARLIN_LOGO_SMALL enabled for it to fit in the smaller flash size on the Robin Nano V1.2.

Edit: I see now see that disabling SHOW_BOOTSCREEN causes the build to grow larger. I'm looking into it...

Please sign in to comment.