From c0ad4718a4d488d5f1f951efa701d73eb52d5b36 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 11 Dec 2020 18:21:56 -0600 Subject: [PATCH] Better animated boot screen --- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 12 ++++++++++-- Marlin/src/lcd/tft/ui_320x240.cpp | 6 +----- Marlin/src/lcd/tft/ui_480x320.cpp | 6 +----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 4e265a8ee4..54735175b4 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -144,10 +144,16 @@ bool MarlinUI::detected() { return true; } constexpr millis_t d = 0; constexpr uint8_t f = 0; #else - constexpr millis_t d = CUSTOM_BOOTSCREEN_FRAME_TIME; + #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) + constexpr millis_t d = CUSTOM_BOOTSCREEN_FRAME_TIME; + #endif LOOP_L_N(f, COUNT(custom_bootscreen_animation)) #endif { + #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) + const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_frame_time) - 1); + const millis_t d = custom_bootscreen_frame_time[fr]; + #endif u8g.firstPage(); do { draw_custom_bootscreen(f); } while (u8g.nextPage()); if (d) safe_delay(d); @@ -156,7 +162,9 @@ bool MarlinUI::detected() { return true; } #ifndef CUSTOM_BOOTSCREEN_TIMEOUT #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 #endif - safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); + #if CUSTOM_BOOTSCREEN_TIMEOUT + safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); + #endif } #endif // SHOW_CUSTOM_BOOTSCREEN diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 51f65c59b5..ceea4a428e 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -88,10 +88,6 @@ void MarlinUI::clear_lcd() { } #if ENABLED(SHOW_BOOTSCREEN) - #ifndef BOOTSCREEN_TIMEOUT - #define BOOTSCREEN_TIMEOUT 1500 - #endif - void MarlinUI::show_bootscreen() { tft.queue.reset(); @@ -106,7 +102,7 @@ void MarlinUI::clear_lcd() { safe_delay(BOOTSCREEN_TIMEOUT); clear_lcd(); } -#endif // SHOW_BOOTSCREEN +#endif void MarlinUI::draw_kill_screen() { tft.queue.reset(); diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 343d187d26..9e387b2402 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -90,10 +90,6 @@ void MarlinUI::clear_lcd() { } #if ENABLED(SHOW_BOOTSCREEN) - #ifndef BOOTSCREEN_TIMEOUT - #define BOOTSCREEN_TIMEOUT 1500 - #endif - #undef BOOTSCREEN_TIMEOUT #define BOOTSCREEN_TIMEOUT 5000 @@ -112,7 +108,7 @@ void MarlinUI::clear_lcd() { safe_delay(BOOTSCREEN_TIMEOUT); clear_lcd(); } -#endif // SHOW_BOOTSCREEN +#endif void MarlinUI::draw_kill_screen() { tft.queue.reset();