Browse Source

Fix animated boot screen

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
5f824c5708
  1. 4
      Marlin/src/lcd/dogm/dogm_Bootscreen.h
  2. 15
      Marlin/src/lcd/dogm/marlinui_DOGM.cpp

4
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

15
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());

Loading…
Cancel
Save