Make bootscreen configurable for the graphic displays
Saves about 473 byte of progmem and 28 bytes of RAM.
This commit is contained in:
parent
09571b7753
commit
4f46df5dab
@ -666,7 +666,6 @@ void setup() {
|
||||
Config_RetrieveSettings();
|
||||
|
||||
lcd_init();
|
||||
_delay_ms(1000); // wait 1sec to display the splash screen
|
||||
|
||||
tp_init(); // Initialize temperature loop
|
||||
plan_init(); // Initialize planner;
|
||||
|
@ -3,77 +3,79 @@
|
||||
// Please note that using the high-res version takes 402Bytes of PROGMEM.
|
||||
//#define START_BMPHIGH
|
||||
|
||||
#if ENABLED(START_BMPHIGH)
|
||||
#define START_BMPWIDTH 112
|
||||
#define START_BMPHEIGHT 38
|
||||
#define START_BMPBYTEWIDTH 14
|
||||
#define START_BMPBYTES 532 // START_BMPWIDTH * START_BMPHEIGHT / 8
|
||||
|
||||
const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
|
||||
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff
|
||||
,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff
|
||||
,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff
|
||||
,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x3f,0xff
|
||||
,0xc0,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x00,0x00,0x78,0x18,0x00,0x1f,0xff
|
||||
,0xc0,0x3f,0xe1,0xff,0x00,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x0f,0xff
|
||||
,0xc0,0x7f,0xf3,0xff,0x80,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x07,0xff
|
||||
,0xc0,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x03,0xff
|
||||
,0xc1,0xf8,0x7f,0x87,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xff
|
||||
,0xc1,0xf0,0x3f,0x03,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xff
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0x1f,0x00,0x03,0xe0,0x78,0x3c,0x03,0xf0,0x7f
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0xc0,0x0f,0xf8,0x78,0x3c,0x07,0xfc,0x3f
|
||||
,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0xe0,0x1f,0xfc,0x78,0x3c,0x0f,0xfe,0x1f
|
||||
,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0xf0,0x3f,0xfe,0x78,0x3c,0x1f,0xfe,0x0f
|
||||
,0xc1,0xe0,0x1e,0x01,0xe3,0xf3,0xf8,0x3f,0x3e,0x78,0x3c,0x3f,0x3f,0x07
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0xe0,0xfc,0x7c,0x1f,0x78,0x3c,0x3e,0x1f,0x07
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x7c,0x7c,0x0f,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x7c,0x78,0x0f,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0x80,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe7,0xc0,0x3c,0x78,0x00,0x78,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe3,0xe0,0x3c,0x78,0x00,0x7c,0x3c,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe3,0xff,0x3f,0xf8,0x00,0x7f,0xbc,0x3c,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe1,0xff,0x3f,0xf8,0x00,0x3f,0xbf,0xfc,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0xff,0x3f,0xf8,0x00,0x1f,0xbf,0xfc,0x0f,0x03
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0x3f,0xf8,0x00,0x0f,0xbf,0xfc,0x0f,0x03
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06
|
||||
,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e
|
||||
,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c
|
||||
,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78
|
||||
,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
|
||||
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80 };
|
||||
#else
|
||||
#define START_BMPWIDTH 56
|
||||
#define START_BMPHEIGHT 19
|
||||
#define START_BMPBYTEWIDTH 7
|
||||
#define START_BMPBYTES 133 // START_BMPWIDTH * START_BMPHEIGHT / 8
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
#if ENABLED(START_BMPHIGH)
|
||||
#define START_BMPWIDTH 112
|
||||
#define START_BMPHEIGHT 38
|
||||
#define START_BMPBYTEWIDTH 14
|
||||
#define START_BMPBYTES 532 // START_BMPWIDTH * START_BMPHEIGHT / 8
|
||||
|
||||
const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
|
||||
0x1f,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x01,0xff
|
||||
,0x40,0x00,0x00,0x00,0x00,0x00,0xff
|
||||
,0x80,0x00,0x00,0x00,0x00,0x00,0x7f
|
||||
,0x83,0xcf,0x00,0x00,0x0c,0x30,0x3f
|
||||
,0x87,0xff,0x80,0x00,0x0c,0x30,0x1f
|
||||
,0x86,0x79,0x80,0x00,0x0c,0x00,0x0f
|
||||
,0x8c,0x30,0xc7,0x83,0x8c,0x30,0xe7
|
||||
,0x8c,0x30,0xcf,0xc7,0xcc,0x31,0xf3
|
||||
,0x8c,0x30,0xdc,0xec,0xec,0x33,0xb9
|
||||
,0x8c,0x30,0xd8,0x6c,0x6c,0x33,0x19
|
||||
,0x8c,0x30,0xd0,0x6c,0x0c,0x33,0x19
|
||||
,0x8c,0x30,0xd8,0x6c,0x0c,0x33,0x19
|
||||
,0x8c,0x30,0xdc,0x6c,0x0e,0x3b,0x19
|
||||
,0x8c,0x30,0xcf,0x7c,0x07,0x9f,0x19
|
||||
,0x8c,0x30,0xc7,0x7c,0x03,0x8f,0x19
|
||||
,0x40,0x00,0x00,0x00,0x00,0x00,0x02
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x06
|
||||
,0x1f,0xff,0xff,0xff,0xff,0xff,0xf8 };
|
||||
const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
|
||||
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff
|
||||
,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff
|
||||
,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff
|
||||
,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x3f,0xff
|
||||
,0xc0,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x00,0x00,0x78,0x18,0x00,0x1f,0xff
|
||||
,0xc0,0x3f,0xe1,0xff,0x00,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x0f,0xff
|
||||
,0xc0,0x7f,0xf3,0xff,0x80,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x07,0xff
|
||||
,0xc0,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x78,0x3c,0x00,0x03,0xff
|
||||
,0xc1,0xf8,0x7f,0x87,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x01,0xff
|
||||
,0xc1,0xf0,0x3f,0x03,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xff
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0x1f,0x00,0x03,0xe0,0x78,0x3c,0x03,0xf0,0x7f
|
||||
,0xc1,0xe0,0x1e,0x01,0xe0,0x7f,0xc0,0x0f,0xf8,0x78,0x3c,0x07,0xfc,0x3f
|
||||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01,0xe0,0x7f,0x3f,0xf8,0x00,0x0f,0xbf,0xfc,0x0f,0x03
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06
|
||||
,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e
|
||||
,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c
|
||||
,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78
|
||||
,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
|
||||
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80 };
|
||||
#else
|
||||
#define START_BMPWIDTH 56
|
||||
#define START_BMPHEIGHT 19
|
||||
#define START_BMPBYTEWIDTH 7
|
||||
#define START_BMPBYTES 133 // START_BMPWIDTH * START_BMPHEIGHT / 8
|
||||
|
||||
const unsigned char start_bmp[START_BMPBYTES] PROGMEM = {
|
||||
0x1f,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
,0x60,0x00,0x00,0x00,0x00,0x01,0xff
|
||||
,0x40,0x00,0x00,0x00,0x00,0x00,0xff
|
||||
,0x80,0x00,0x00,0x00,0x00,0x00,0x7f
|
||||
,0x83,0xcf,0x00,0x00,0x0c,0x30,0x3f
|
||||
,0x87,0xff,0x80,0x00,0x0c,0x30,0x1f
|
||||
,0x86,0x79,0x80,0x00,0x0c,0x00,0x0f
|
||||
,0x8c,0x30,0xc7,0x83,0x8c,0x30,0xe7
|
||||
,0x8c,0x30,0xcf,0xc7,0xcc,0x31,0xf3
|
||||
,0x8c,0x30,0xdc,0xec,0xec,0x33,0xb9
|
||||
,0x8c,0x30,0xd8,0x6c,0x6c,0x33,0x19
|
||||
,0x8c,0x30,0xd0,0x6c,0x0c,0x33,0x19
|
||||
,0x8c,0x30,0xd8,0x6c,0x0c,0x33,0x19
|
||||
,0x8c,0x30,0xdc,0x6c,0x0e,0x3b,0x19
|
||||
,0x8c,0x30,0xcf,0x7c,0x07,0x9f,0x19
|
||||
,0x8c,0x30,0xc7,0x7c,0x03,0x8f,0x19
|
||||
,0x40,0x00,0x00,0x00,0x00,0x00,0x02
|
||||
,0x60,0x00,0x00,0x00,0x00,0x00,0x06
|
||||
,0x1f,0xff,0xff,0xff,0xff,0xff,0xf8 };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Here comes a compile-time operation to match the extruder symbols
|
||||
|
@ -190,14 +190,16 @@ char lcd_printPGM(const char* str) {
|
||||
return n;
|
||||
}
|
||||
|
||||
static bool show_splashscreen = true;
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
static bool show_bootscreen = true;
|
||||
#endif
|
||||
|
||||
/* Warning: This function is called from interrupt context */
|
||||
static void lcd_implementation_init() {
|
||||
|
||||
#if ENABLED(LCD_PIN_BL) // Enable LCD backlight
|
||||
pinMode(LCD_PIN_BL, OUTPUT);
|
||||
digitalWrite(LCD_PIN_BL, HIGH);
|
||||
digitalWrite(LCD_PIN_BL, HIGH);
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_PIN_RESET)
|
||||
@ -207,44 +209,49 @@ static void lcd_implementation_init() {
|
||||
#ifndef MINIPANEL//setContrast not working for Mini Panel
|
||||
u8g.setContrast(lcd_contrast);
|
||||
#endif
|
||||
// FIXME: remove this workaround
|
||||
// FIXME: remove this workaround
|
||||
// Uncomment this if you have the first generation (V1.10) of STBs board
|
||||
// pinMode(17, OUTPUT); // Enable LCD backlight
|
||||
// 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)
|
||||
u8g.setRot180(); // Rotate screen by 180°
|
||||
u8g.setRot180(); // Rotate screen by 180°
|
||||
#elif ENABLED(LCD_SCREEN_ROT_270)
|
||||
u8g.setRot270(); // Rotate screen by 270°
|
||||
#endif
|
||||
|
||||
// Show splashscreen
|
||||
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
|
||||
#if ENABLED(START_BMPHIGH)
|
||||
int offy = 0;
|
||||
#else
|
||||
int offy = DOG_CHAR_HEIGHT;
|
||||
u8g.setRot270(); // Rotate screen by 270°
|
||||
#endif
|
||||
|
||||
int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
|
||||
#if ENABLED(START_BMPHIGH)
|
||||
int offy = 0;
|
||||
#else
|
||||
int offy = DOG_CHAR_HEIGHT;
|
||||
#endif
|
||||
|
||||
u8g.firstPage();
|
||||
do {
|
||||
if (show_splashscreen) {
|
||||
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
|
||||
lcd_setFont(FONT_MENU);
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
|
||||
#else
|
||||
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
|
||||
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
|
||||
int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
|
||||
|
||||
u8g.firstPage();
|
||||
do {
|
||||
if (show_bootscreen) {
|
||||
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
|
||||
lcd_setFont(FONT_MENU);
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
|
||||
#else
|
||||
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
|
||||
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());
|
||||
|
||||
if (show_bootscreen) {
|
||||
delay(1000);
|
||||
show_bootscreen = false;
|
||||
}
|
||||
} while (u8g.nextPage());
|
||||
show_splashscreen = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
||||
|
Loading…
Reference in New Issue
Block a user