|
@@ -110,19 +110,21 @@ bool MarlinUI::detected() { return true; }
|
110
|
110
|
// Draws a slice of a particular frame of the custom bootscreen, without the u8g loop
|
111
|
111
|
void MarlinUI::draw_custom_bootscreen(const uint8_t frame/*=0*/) {
|
112
|
112
|
constexpr u8g_uint_t left = u8g_uint_t((LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2),
|
113
|
|
- top = u8g_uint_t((LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2);
|
|
113
|
+ top = u8g_uint_t(CUSTOM_BOOTSCREEN_Y);
|
114
|
114
|
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
|
115
|
115
|
constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH,
|
116
|
116
|
bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT;
|
117
|
117
|
#endif
|
118
|
118
|
|
119
|
|
- const u8g_pgm_uint8_t * const bmp =
|
120
|
|
- #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
|
121
|
|
- (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame])
|
122
|
|
- #else
|
123
|
|
- custom_start_bmp
|
124
|
|
- #endif
|
125
|
|
- ;
|
|
119
|
+ const void * const frame_ptr = pgm_read_ptr(&custom_bootscreen_animation[frame]);
|
|
120
|
+
|
|
121
|
+ #if BOTH(CUSTOM_BOOTSCREEN_ANIMATED, CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
|
|
122
|
+ const boot_frame_t * const frame_info = (boot_frame_t*)frame_ptr;
|
|
123
|
+ const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&frame_info->bitmap);
|
|
124
|
+ #else
|
|
125
|
+ const u8g_pgm_uint8_t * const bmp = TERN(CUSTOM_BOOTSCREEN_ANIMATED, (u8g_pgm_uint8_t*)frame_ptr, custom_start_bmp);
|
|
126
|
+ #endif
|
|
127
|
+
|
126
|
128
|
UNUSED(frame);
|
127
|
129
|
|
128
|
130
|
u8g.drawBitmapP(left, top, CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH, CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp);
|
|
@@ -141,22 +143,23 @@ bool MarlinUI::detected() { return true; }
|
141
|
143
|
// Shows the custom bootscreen, with the u8g loop, animations and delays
|
142
|
144
|
void MarlinUI::show_custom_bootscreen() {
|
143
|
145
|
#if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED)
|
144
|
|
- constexpr millis_t d = 0;
|
|
146
|
+ constexpr millis_t frame_time = 0;
|
145
|
147
|
constexpr uint8_t f = 0;
|
146
|
148
|
#else
|
147
|
|
- #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
|
148
|
|
- constexpr millis_t d = CUSTOM_BOOTSCREEN_FRAME_TIME;
|
|
149
|
+ #if DISABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
|
|
150
|
+ constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
|
149
|
151
|
#endif
|
150
|
152
|
LOOP_L_N(f, COUNT(custom_bootscreen_animation))
|
151
|
153
|
#endif
|
152
|
154
|
{
|
153
|
|
- #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
|
154
|
|
- const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_frame_time) - 1);
|
155
|
|
- const millis_t d = custom_bootscreen_frame_time[fr];
|
|
155
|
+ #if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
|
|
156
|
+ const uint8_t fr = _MIN(f, COUNT(custom_bootscreen_animation) - 1);
|
|
157
|
+ const boot_frame_t * const frame_info = (boot_frame_t*)pgm_read_ptr(&custom_bootscreen_animation[fr]);
|
|
158
|
+ const millis_t frame_time = pgm_read_word(&frame_info->duration);
|
156
|
159
|
#endif
|
157
|
160
|
u8g.firstPage();
|
158
|
161
|
do { draw_custom_bootscreen(f); } while (u8g.nextPage());
|
159
|
|
- if (d) safe_delay(d);
|
|
162
|
+ if (frame_time) safe_delay(frame_time);
|
160
|
163
|
}
|
161
|
164
|
|
162
|
165
|
#ifndef CUSTOM_BOOTSCREEN_TIMEOUT
|
|
@@ -218,10 +221,10 @@ bool MarlinUI::detected() { return true; }
|
218
|
221
|
#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
219
|
222
|
draw_bootscreen_bmp(start_bmp);
|
220
|
223
|
#else
|
221
|
|
- constexpr millis_t d = MARLIN_BOOTSCREEN_FRAME_TIME;
|
|
224
|
+ constexpr millis_t frame_time = MARLIN_BOOTSCREEN_FRAME_TIME;
|
222
|
225
|
LOOP_L_N(f, COUNT(marlin_bootscreen_animation)) {
|
223
|
226
|
draw_bootscreen_bmp((uint8_t*)pgm_read_ptr(&marlin_bootscreen_animation[f]));
|
224
|
|
- if (d) safe_delay(d);
|
|
227
|
+ if (frame_time) safe_delay(frame_time);
|
225
|
228
|
}
|
226
|
229
|
#endif
|
227
|
230
|
}
|