Browse Source

Fix animated boot screen

Scott Lahteine 4 years ago
parent
commit
5f824c5708
2 changed files with 10 additions and 9 deletions
  1. 4
    0
      Marlin/src/lcd/dogm/dogm_Bootscreen.h
  2. 6
    9
      Marlin/src/lcd/dogm/marlinui_DOGM.cpp

+ 4
- 0
Marlin/src/lcd/dogm/dogm_Bootscreen.h View File

39
 
39
 
40
   #include "../../../_Bootscreen.h"
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
   #ifndef CUSTOM_BOOTSCREEN_BMPWIDTH
46
   #ifndef CUSTOM_BOOTSCREEN_BMPWIDTH
43
     #define CUSTOM_BOOTSCREEN_BMPWIDTH 128
47
     #define CUSTOM_BOOTSCREEN_BMPWIDTH 128
44
   #endif
48
   #endif

+ 6
- 9
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

118
       #endif
118
       #endif
119
 
119
 
120
       #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
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
         #else
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
         #endif
125
         #endif
128
       #else
126
       #else
129
         const u8g_pgm_uint8_t * const bmp = custom_start_bmp;
127
         const u8g_pgm_uint8_t * const bmp = custom_start_bmp;
150
         constexpr millis_t frame_time = 0;
148
         constexpr millis_t frame_time = 0;
151
         constexpr uint8_t f = 0;
149
         constexpr uint8_t f = 0;
152
       #else
150
       #else
153
-        #if DISABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
151
+        #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
154
           constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
152
           constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
155
         #endif
153
         #endif
156
         LOOP_L_N(f, COUNT(custom_bootscreen_animation))
154
         LOOP_L_N(f, COUNT(custom_bootscreen_animation))
157
       #endif
155
       #endif
158
         {
156
         {
159
-          #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
157
+          #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
160
             const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_animation) - 1);
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
           #endif
160
           #endif
164
           u8g.firstPage();
161
           u8g.firstPage();
165
           do { draw_custom_bootscreen(f); } while (u8g.nextPage());
162
           do { draw_custom_bootscreen(f); } while (u8g.nextPage());

Loading…
Cancel
Save