Improves the custom bootscreen logo feature

This commit is contained in:
João Brázio
2016-07-15 00:07:34 +01:00
parent 1f3283e3a5
commit fa4274cf4c
4 changed files with 36 additions and 99 deletions

View File

@@ -53,8 +53,6 @@
#include <U8glib.h>
#include "dogm_bitmaps.h"
#include "dogm_custom_bitmaps.h"
#include "ultralcd.h"
#include "ultralcd_st7920_u8glib_rrd.h"
@@ -220,10 +218,6 @@ char lcd_printPGM(const char* str) {
return n;
}
#if ENABLED(SHOW_BOOTSCREEN)
static bool show_bootscreen = true;
#endif
/* Warning: This function is called from interrupt context */
static void lcd_implementation_init() {
@@ -241,11 +235,6 @@ static void lcd_implementation_init() {
u8g.setContrast(lcd_contrast);
#endif
// FIXME: remove this workaround
// Uncomment this if you have the first generation (V1.10) of STBs board
// pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH);
#if ENABLED(LCD_SCREEN_ROT_90)
u8g.setRot90(); // Rotate screen by 90°
#elif ENABLED(LCD_SCREEN_ROT_180)
@@ -255,16 +244,23 @@ static void lcd_implementation_init() {
#endif
#if ENABLED(SHOW_BOOTSCREEN)
#if ENABLED(CUSTOM_START_BMP)
static bool show_bootscreen = true;
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
if (show_bootscreen) {
u8g.firstPage();
do {
u8g.drawBitmapP((128-(CUSTOM_START_BMPWIDTH))/2, (64 - (CUSTOM_START_BMPHEIGHT))/2, CUSTOM_START_BMPBYTEWIDTH, CUSTOM_START_BMPHEIGHT, custom_start_bmp);
u8g.drawBitmapP(
(128 - (CUSTOM_BOOTSCREEN_BMPWIDTH)) /2,
( 64 - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) /2,
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp);
} while (u8g.nextPage());
delay(CUSTOM_START_BMP_DELAY);
safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT);
}
#endif
#endif // SHOW_CUSTOM_BOOTSCREEN
int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
#if ENABLED(START_BMPHIGH)
int offy = 0;
#else
@@ -273,9 +269,9 @@ static void lcd_implementation_init() {
int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
u8g.firstPage();
do {
if (show_bootscreen) {
if (show_bootscreen) {
u8g.firstPage();
do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
@@ -285,12 +281,12 @@ static void lcd_implementation_init() {
u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
#endif
}
} while (u8g.nextPage());
} while (u8g.nextPage());
}
show_bootscreen = false;
#endif
#endif // SHOW_BOOTSCREEN
}
void lcd_kill_screen() {