Procházet zdrojové kódy

Fix animated boot screen

Scott Lahteine před 3 roky
rodič
revize
5f824c5708

+ 4
- 0
Marlin/src/lcd/dogm/dogm_Bootscreen.h Zobrazit soubor

@@ -39,6 +39,10 @@
39 39
 
40 40
   #include "../../../_Bootscreen.h"
41 41
 
42
+  #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED) && DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) && !defined(CUSTOM_BOOTSCREEN_FRAME_TIME)
43
+    #define CUSTOM_BOOTSCREEN_FRAME_TIME 500 // (ms)
44
+  #endif
45
+
42 46
   #ifndef CUSTOM_BOOTSCREEN_BMPWIDTH
43 47
     #define CUSTOM_BOOTSCREEN_BMPWIDTH 128
44 48
   #endif

+ 6
- 9
Marlin/src/lcd/dogm/marlinui_DOGM.cpp Zobrazit soubor

@@ -118,12 +118,10 @@ bool MarlinUI::detected() { return true; }
118 118
       #endif
119 119
 
120 120
       #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
121
-        const void * const frame_ptr = pgm_read_ptr(&custom_bootscreen_animation[frame]);
122
-        #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
123
-          const boot_frame_t * const frame_info = (boot_frame_t*)frame_ptr;
124
-          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&frame_info->bitmap);
121
+        #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
122
+          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame].bitmap);
125 123
         #else
126
-          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)frame_ptr;
124
+          const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame]);
127 125
         #endif
128 126
       #else
129 127
         const u8g_pgm_uint8_t * const bmp = custom_start_bmp;
@@ -150,16 +148,15 @@ bool MarlinUI::detected() { return true; }
150 148
         constexpr millis_t frame_time = 0;
151 149
         constexpr uint8_t f = 0;
152 150
       #else
153
-        #if DISABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
151
+        #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
154 152
           constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
155 153
         #endif
156 154
         LOOP_L_N(f, COUNT(custom_bootscreen_animation))
157 155
       #endif
158 156
         {
159
-          #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
157
+          #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
160 158
             const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_animation) - 1);
161
-            const boot_frame_t * const frame_info = (boot_frame_t*)pgm_read_ptr(&custom_bootscreen_animation[fr]);
162
-            const millis_t frame_time = pgm_read_word(&frame_info->duration);
159
+            const millis_t frame_time = pgm_read_word(&custom_bootscreen_animation[fr].duration);
163 160
           #endif
164 161
           u8g.firstPage();
165 162
           do { draw_custom_bootscreen(f); } while (u8g.nextPage());

Loading…
Zrušit
Uložit