|
|
@ -105,56 +105,63 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
|
|
|
|
#if ENABLED(SHOW_BOOTSCREEN)
|
|
|
|
#if ENABLED(SHOW_BOOTSCREEN)
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
|
|
|
|
// Draws a slice of a particular frame of the custom bootscreen, without the u8g loop
|
|
|
|
FORCE_INLINE void draw_custom_bootscreen(const u8g_pgm_uint8_t * const bmp, const bool erase=true) {
|
|
|
|
void MarlinUI::draw_custom_bootscreen(const uint8_t frame/*=0*/) {
|
|
|
|
constexpr u8g_uint_t left = u8g_uint_t((LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2),
|
|
|
|
constexpr u8g_uint_t left = u8g_uint_t((LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2),
|
|
|
|
top = u8g_uint_t((LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2);
|
|
|
|
top = u8g_uint_t((LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2);
|
|
|
|
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
|
|
|
|
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
|
|
|
|
constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH,
|
|
|
|
constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH,
|
|
|
|
bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT;
|
|
|
|
bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
u8g.firstPage();
|
|
|
|
|
|
|
|
do {
|
|
|
|
const u8g_pgm_uint8_t * const bmp =
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
#if ENABLED(ANIMATED_BOOTSCREEN)
|
|
|
|
left, top,
|
|
|
|
(u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame])
|
|
|
|
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
|
|
|
|
|
|
|
|
if (erase) {
|
|
|
|
|
|
|
|
u8g.setColorIndex(1);
|
|
|
|
|
|
|
|
if (top) u8g.drawBox(0, 0, LCD_PIXEL_WIDTH, top);
|
|
|
|
|
|
|
|
if (left) u8g.drawBox(0, top, left, CUSTOM_BOOTSCREEN_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (right < LCD_PIXEL_WIDTH) u8g.drawBox(right, top, LCD_PIXEL_WIDTH - right, CUSTOM_BOOTSCREEN_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (bottom < LCD_PIXEL_HEIGHT) u8g.drawBox(0, bottom, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT - bottom);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
UNUSED(erase);
|
|
|
|
custom_start_bmp
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} while (u8g.nextPage());
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_custom_bootscreen() {
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
#if ENABLED(ANIMATED_BOOTSCREEN)
|
|
|
|
left, top,
|
|
|
|
LOOP_L_N(f, COUNT(custom_bootscreen_animation)) {
|
|
|
|
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp
|
|
|
|
if (f) safe_delay(CUSTOM_BOOTSCREEN_FRAME_TIME);
|
|
|
|
);
|
|
|
|
draw_custom_bootscreen((u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[f]), f == 0);
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
|
|
|
|
|
|
|
|
if (frame == 0) {
|
|
|
|
|
|
|
|
u8g.setColorIndex(1);
|
|
|
|
|
|
|
|
if (top) u8g.drawBox(0, 0, LCD_PIXEL_WIDTH, top);
|
|
|
|
|
|
|
|
if (left) u8g.drawBox(0, top, left, CUSTOM_BOOTSCREEN_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (right < LCD_PIXEL_WIDTH) u8g.drawBox(right, top, LCD_PIXEL_WIDTH - right, CUSTOM_BOOTSCREEN_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (bottom < LCD_PIXEL_HEIGHT) u8g.drawBox(0, bottom, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT - bottom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Shows the custom bootscreen, with the u8g loop, animations and delays
|
|
|
|
|
|
|
|
void MarlinUI::show_custom_bootscreen() {
|
|
|
|
|
|
|
|
#if DISABLED(ANIMATED_BOOTSCREEN)
|
|
|
|
|
|
|
|
constexpr millis_t d = 0;
|
|
|
|
|
|
|
|
constexpr uint8_t f = 0;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
draw_custom_bootscreen(custom_start_bmp);
|
|
|
|
constexpr millis_t d = CUSTOM_BOOTSCREEN_FRAME_TIME;
|
|
|
|
|
|
|
|
LOOP_L_N(f, COUNT(custom_bootscreen_animation))
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
u8g.firstPage();
|
|
|
|
|
|
|
|
do { draw_custom_bootscreen(f); } while (u8g.nextPage());
|
|
|
|
|
|
|
|
if (d) safe_delay(d);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CUSTOM_BOOTSCREEN_TIMEOUT
|
|
|
|
#ifndef CUSTOM_BOOTSCREEN_TIMEOUT
|
|
|
|
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
|
|
|
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
|
|
|
|
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SHOW_CUSTOM_BOOTSCREEN
|
|
|
|
#endif // SHOW_CUSTOM_BOOTSCREEN
|
|
|
|
|
|
|
|
|
|
|
|
void MarlinUI::show_bootscreen() {
|
|
|
|
// Draws a slice of the Marlin bootscreen, without the u8g loop
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
void MarlinUI::draw_marlin_bootscreen() {
|
|
|
|
lcd_custom_bootscreen();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Screen dimensions.
|
|
|
|
// Screen dimensions.
|
|
|
|
//const uint8_t width = u8g.getWidth(), height = u8g.getHeight();
|
|
|
|
//const uint8_t width = u8g.getWidth(), height = u8g.getHeight();
|
|
|
|
constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
|
|
|
|
constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
|
|
|
@ -193,23 +200,33 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
|
|
|
|
NOLESS(offx, 0);
|
|
|
|
NOLESS(offx, 0);
|
|
|
|
NOLESS(offy, 0);
|
|
|
|
NOLESS(offy, 0);
|
|
|
|
|
|
|
|
|
|
|
|
u8g.firstPage();
|
|
|
|
u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp);
|
|
|
|
do {
|
|
|
|
set_font(FONT_MENU);
|
|
|
|
u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp);
|
|
|
|
#ifndef STRING_SPLASH_LINE2
|
|
|
|
set_font(FONT_MENU);
|
|
|
|
u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1);
|
|
|
|
#ifndef STRING_SPLASH_LINE2
|
|
|
|
#else
|
|
|
|
u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1);
|
|
|
|
u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1);
|
|
|
|
#else
|
|
|
|
u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2);
|
|
|
|
u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1);
|
|
|
|
#endif
|
|
|
|
u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} while (u8g.nextPage());
|
|
|
|
// Shows the Marlin bootscreen, with the u8g loop and delays
|
|
|
|
|
|
|
|
void MarlinUI::show_marlin_bootscreen() {
|
|
|
|
#ifndef BOOTSCREEN_TIMEOUT
|
|
|
|
#ifndef BOOTSCREEN_TIMEOUT
|
|
|
|
#define BOOTSCREEN_TIMEOUT 2500
|
|
|
|
#define BOOTSCREEN_TIMEOUT 2500
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
u8g.firstPage();
|
|
|
|
|
|
|
|
do { draw_marlin_bootscreen(); } while (u8g.nextPage());
|
|
|
|
safe_delay(BOOTSCREEN_TIMEOUT);
|
|
|
|
safe_delay(BOOTSCREEN_TIMEOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MarlinUI::show_bootscreen() {
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
|
|
|
|
|
|
|
|
show_custom_bootscreen();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
show_marlin_bootscreen();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SHOW_BOOTSCREEN
|
|
|
|
#endif // SHOW_BOOTSCREEN
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LIGHTWEIGHT_UI)
|
|
|
|
#if ENABLED(LIGHTWEIGHT_UI)
|
|
|
|