Fix animated boot screen
This commit is contained in:
parent
127a4ada93
commit
86fd38ef42
@ -39,6 +39,10 @@
|
|||||||
|
|
||||||
#include "../../../_Bootscreen.h"
|
#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
|
#ifndef CUSTOM_BOOTSCREEN_BMPWIDTH
|
||||||
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128
|
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128
|
||||||
#endif
|
#endif
|
||||||
|
@ -118,12 +118,10 @@ bool MarlinUI::detected() { return true; }
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
|
#if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
|
||||||
const void * const frame_ptr = pgm_read_ptr(&custom_bootscreen_animation[frame]);
|
#if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
|
||||||
#if ENABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
|
const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame].bitmap);
|
||||||
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);
|
|
||||||
#else
|
#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
|
#endif
|
||||||
#else
|
#else
|
||||||
const u8g_pgm_uint8_t * const bmp = custom_start_bmp;
|
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 millis_t frame_time = 0;
|
||||||
constexpr uint8_t f = 0;
|
constexpr uint8_t f = 0;
|
||||||
#else
|
#else
|
||||||
#if DISABLED(CUSTOM_BOOTSCREEN_TIME_PER_FRAME)
|
#if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME)
|
||||||
constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
|
constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME;
|
||||||
#endif
|
#endif
|
||||||
LOOP_L_N(f, COUNT(custom_bootscreen_animation))
|
LOOP_L_N(f, COUNT(custom_bootscreen_animation))
|
||||||
#endif
|
#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 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(&custom_bootscreen_animation[fr].duration);
|
||||||
const millis_t frame_time = pgm_read_word(&frame_info->duration);
|
|
||||||
#endif
|
#endif
|
||||||
u8g.firstPage();
|
u8g.firstPage();
|
||||||
do { draw_custom_bootscreen(f); } while (u8g.nextPage());
|
do { draw_custom_bootscreen(f); } while (u8g.nextPage());
|
||||||
|
Loading…
Reference in New Issue
Block a user