From 5f824c5708191f8d170a735e1a2ab2257fdc9e54 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sun, 7 Feb 2021 20:43:18 -0600
Subject: [PATCH] Fix animated boot screen

---
 Marlin/src/lcd/dogm/dogm_Bootscreen.h |  4 ++++
 Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 15 ++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h
index 0b8845ed794..42408614715 100644
--- a/Marlin/src/lcd/dogm/dogm_Bootscreen.h
+++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h
@@ -39,6 +39,10 @@
 
   #include "../../../_Bootscreen.h"
 
+  #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED) && DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) && !defined(CUSTOM_BOOTSCREEN_FRAME_TIME)
+    #define CUSTOM_BOOTSCREEN_FRAME_TIME 500 // (ms)
+  #endif
+
   #ifndef CUSTOM_BOOTSCREEN_BMPWIDTH
     #define CUSTOM_BOOTSCREEN_BMPWIDTH 128
   #endif
diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp
index c7c5908b36b..d2b1ce7740f 100644
--- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp
+++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp
@@ -118,12 +118,10 @@ bool MarlinUI::detected() { return true; }
       #endif
 
       #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
-        const void * const frame_ptr = pgm_read_ptr(&custom_bootscreen_animation[frame]);
-        #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
-          const boot_frame_t * const frame_info = (boot_frame_t*)frame_ptr;
-          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&frame_info->bitmap);
+        #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
+          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame].bitmap);
         #else
-          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)frame_ptr;
+          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame]);
         #endif
       #else
         const u8g_pgm_uint8_t * const bmp = custom_start_bmp;
@@ -150,16 +148,15 @@ bool MarlinUI::detected() { return true; }
         constexpr millis_t frame_time = 0;
         constexpr uint8_t f = 0;
       #else
-        #if DISABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
+        #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
           constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
         #endif
         LOOP_L_N(f, COUNT(custom_bootscreen_animation))
       #endif
         {
-          #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
+          #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
             const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_animation) - 1);
-            const boot_frame_t * const frame_info = (boot_frame_t*)pgm_read_ptr(&custom_bootscreen_animation[fr]);
-            const millis_t frame_time = pgm_read_word(&frame_info->duration);
+            const millis_t frame_time = pgm_read_word(&custom_bootscreen_animation[fr].duration);
           #endif
           u8g.firstPage();
           do { draw_custom_bootscreen(f); } while (u8g.nextPage());