From 09571b7753020c985018745651c32f9bb405e58b Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 31 Jul 2015 16:24:20 +0200 Subject: [PATCH 1/5] Boot-screen for the character displays Uses about 488 byte of progmem and 32 byte of RAM. For that configurable. --- Marlin/Configuration.h | 1 + .../ultralcd_implementation_hitachi_HD44780.h | 85 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ce691276d..71679be04 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index f9c85a2a4..f7e1f8320 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -193,6 +193,11 @@ #include "utf_mapper.h" +#if ENABLED(SHOW_BOOTSCREEN) + static void bootscreen(); + static bool show_bootscreen = true; +#endif + #if ENABLED(LCD_PROGRESS_BAR) static millis_t progress_bar_ms = 0; #if PROGRESS_MSG_EXPIRE > 0 @@ -377,6 +382,10 @@ static void lcd_implementation_init( lcd.begin(LCD_WIDTH, LCD_HEIGHT); #endif + #if ENABLED(SHOW_BOOTSCREEN) + if (show_bootscreen) bootscreen(); + #endif + lcd_set_custom_characters( #if ENABLED(LCD_PROGRESS_BAR) progress_bar_set @@ -404,6 +413,82 @@ char lcd_print(char* str) { unsigned lcd_print(char c) { return charset_mapper(c); } +#if ENABLED(SHOW_BOOTSCREEN) + static void bootscreen() { + show_bootscreen = false; + byte top_left[8] = { + B00000, + B00000, + B00000, + B00000, + B00001, + B00010, + B00100, + B00100 + }; + byte top_right[8] = { + B00000, + B00000, + B00000, + B11100, + B11100, + B01100, + B00100, + B00100 + }; + byte botom_left[8] = { + B00100, + B00010, + B00001, + B00000, + B00000, + B00000, + B00000, + B00000 + }; + byte botom_right[8] = { + B00100, + B01000, + B10000, + B00000, + B00000, + B00000, + B00000, + B00000 + }; + lcd.createChar(0, top_left); + lcd.createChar(1, top_right); + lcd.createChar(2, botom_left); + lcd.createChar(3, botom_right); + + lcd.clear(); + // 12345678901234567890 + lcd.setCursor(0, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------")); lcd.print('\x01'); + lcd.setCursor(0, 1); lcd_printPGM(PSTR("|Marlin| ")); + #if (LCD_WIDTH > 16) && defined(STRING_SPLASH_LINE1) + lcd_printPGM(PSTR(STRING_SPLASH_LINE1)); + #endif + lcd.setCursor(0, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------")); lcd.print('\x03'); + lcd.setCursor(0, 3); lcd_printPGM(PSTR("marlinfirmware.org")); + delay(2000); + + #if (LCD_WIDTH <= 16) && defined(STRING_SPLASH_LINE1) + lcd.setCursor(0, 3); + lcd_printPGM(PSTR(" ")); + lcd.setCursor(0, 3); + lcd_printPGM(PSTR(STRING_SPLASH_LINE1)); + delay(1000); + #endif + + #ifdef STRING_SPLASH_LINE2 + lcd.setCursor(0, 3); + lcd_printPGM(PSTR(" ")); + lcd.setCursor(0, 3); + lcd_printPGM(PSTR(STRING_SPLASH_LINE2)); + delay(1000); + #endif + } +#endif // SHOW_BOOTSCREEN /* Possible status screens: 16x2 |000/000 B000/000| From 4f46df5dab6ac7e496c08349b2b46c70794fc1ca Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 31 Jul 2015 19:32:23 +0200 Subject: [PATCH 2/5] Make bootscreen configurable for the graphic displays Saves about 473 byte of progmem and 28 bytes of RAM. --- Marlin/Marlin_main.cpp | 1 - Marlin/dogm_bitmaps.h | 142 ++++++++++++++++--------------- Marlin/dogm_lcd_implementation.h | 65 +++++++------- 3 files changed, 108 insertions(+), 100 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6f01871ba..0fdbf6eaf 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -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; diff --git a/Marlin/dogm_bitmaps.h b/Marlin/dogm_bitmaps.h index 2f5985bae..e36ae4b7a 100644 --- a/Marlin/dogm_bitmaps.h +++ b/Marlin/dogm_bitmaps.h @@ -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 + ,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 + + 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 diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index cf12a1169..daf2c0d68 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -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 From 2684d061ed559889d3f6cb17332d4e401a94c32d Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 31 Jul 2015 23:29:52 +0200 Subject: [PATCH 3/5] Scroll too long strings on bootscreen --- .../ultralcd_implementation_hitachi_HD44780.h | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index f7e1f8320..0c17f2305 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -414,6 +414,26 @@ char lcd_print(char* str) { unsigned lcd_print(char c) { return charset_mapper(c); } #if ENABLED(SHOW_BOOTSCREEN) + void lcd_erase_line(int line) { + lcd.setCursor(0, 3); + for (int i=0; i < LCD_WIDTH; i++) + lcd_print(' '); + } + + // scrol the PSTR'text' in a 'len' wide field for 'time' milliseconds at position col,line + void lcd_scroll(int col, int line, const char * text, int len, int time) { + int l = lcd_strlen_P(text); + char tmp[LCD_WIDTH+1] = {0}; + int n = l - len; + int t = time / ((n>1) ? n: 1); + for (int i = 0; i <= (((n-1)>0) ? n-1 : 0); i++) { + strncpy_P(tmp, text+i, min(len, LCD_WIDTH)); + lcd.setCursor(col, line); + lcd_print(tmp); + delay(t); + } + } + static void bootscreen() { show_bootscreen = false; byte top_left[8] = { @@ -469,23 +489,16 @@ unsigned lcd_print(char c) { return charset_mapper(c); } lcd_printPGM(PSTR(STRING_SPLASH_LINE1)); #endif lcd.setCursor(0, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------")); lcd.print('\x03'); - lcd.setCursor(0, 3); lcd_printPGM(PSTR("marlinfirmware.org")); - delay(2000); + + lcd_scroll(0, 3, PSTR("www.marlinfirmware.org" " "), LCD_WIDTH, 2000); #if (LCD_WIDTH <= 16) && defined(STRING_SPLASH_LINE1) - lcd.setCursor(0, 3); - lcd_printPGM(PSTR(" ")); - lcd.setCursor(0, 3); - lcd_printPGM(PSTR(STRING_SPLASH_LINE1)); - delay(1000); + lcd_erase_line(3); + lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1 " "), LCD_WIDTH, 1000); #endif - #ifdef STRING_SPLASH_LINE2 - lcd.setCursor(0, 3); - lcd_printPGM(PSTR(" ")); - lcd.setCursor(0, 3); - lcd_printPGM(PSTR(STRING_SPLASH_LINE2)); - delay(1000); + lcd_erase_line(3); + lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2 " "), LCD_WIDTH, 1000); #endif } #endif // SHOW_BOOTSCREEN From 80f2a208428e79765c9354009beed2bbb8ead2e0 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 31 Jul 2015 23:43:01 +0200 Subject: [PATCH 4/5] Enable bootscreen in all Configurations --- Marlin/configurator/config/Configuration.h | 1 + Marlin/example_configurations/Felix/Configuration.h | 1 + Marlin/example_configurations/Felix/Configuration_DUAL.h | 1 + Marlin/example_configurations/Hephestos/Configuration.h | 1 + Marlin/example_configurations/K8200/Configuration.h | 1 + .../RepRapWorld/Megatronics/Configuration.h | 1 + Marlin/example_configurations/RigidBot/Configuration.h | 1 + Marlin/example_configurations/SCARA/Configuration.h | 1 + Marlin/example_configurations/WITBOX/Configuration.h | 1 + Marlin/example_configurations/adafruit/ST7565/Configuration.h | 1 + Marlin/example_configurations/delta/biv2.5/Configuration.h | 1 + Marlin/example_configurations/delta/generic/Configuration.h | 1 + Marlin/example_configurations/delta/kossel_mini/Configuration.h | 1 + Marlin/example_configurations/delta/kossel_pro/Configuration.h | 1 + Marlin/example_configurations/makibox/Configuration.h | 1 + Marlin/example_configurations/tvrrug/Round2/Configuration.h | 1 + 16 files changed, 16 insertions(+) diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index ce691276d..71679be04 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 7d9a347f7..d54687c97 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 49e37d9be..1b57f2821 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index adba4418f..7d1487bdc 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 7e2b2c3f9..123620ca2 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -53,6 +53,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(K8200, CONSULitAS)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index f82f63d1d..adb460ff3 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "RepRapWorld.com" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index a169e4e77..f48ade2ba 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index af8c44b27..957405b46 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -73,6 +73,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 484993207..4523ef950 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(bq Witbox)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 33ea5becb..179b9f2de 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index 7821a181d..cca54a993 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 434eda08c..521cfcae1 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 2874b9788..07bedbbb1 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index ea274310e..3f88166ca 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -52,6 +52,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 15cee371e..7ac1105f9 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 403ba9f48..8aba46843 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated: // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 BUILD_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_DISTRIBUTION_DATE // will be shown during bootup in line 2 From 244ea2014a1d71c4071c076f2cad55416f2241bc Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 3 Aug 2015 11:23:42 +0200 Subject: [PATCH 5/5] Boot-screen for text-displays improvements Centred the logo for 16x4 and 20 x4. Moved version to the bottom line Code shrink to 704 bytes. --- .../ultralcd_implementation_hitachi_HD44780.h | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 0c17f2305..eab93b4ce 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -422,15 +422,13 @@ unsigned lcd_print(char c) { return charset_mapper(c); } // scrol the PSTR'text' in a 'len' wide field for 'time' milliseconds at position col,line void lcd_scroll(int col, int line, const char * text, int len, int time) { - int l = lcd_strlen_P(text); char tmp[LCD_WIDTH+1] = {0}; - int n = l - len; - int t = time / ((n>1) ? n: 1); - for (int i = 0; i <= (((n-1)>0) ? n-1 : 0); i++) { + int n = max(lcd_strlen_P(text) - len, 0); + for (int i = 0; i <= n; i++) { strncpy_P(tmp, text+i, min(len, LCD_WIDTH)); lcd.setCursor(col, line); lcd_print(tmp); - delay(t); + delay(time / max(n, 1)); } } @@ -482,23 +480,21 @@ unsigned lcd_print(char c) { return charset_mapper(c); } lcd.createChar(3, botom_right); lcd.clear(); - // 12345678901234567890 - lcd.setCursor(0, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------")); lcd.print('\x01'); - lcd.setCursor(0, 1); lcd_printPGM(PSTR("|Marlin| ")); - #if (LCD_WIDTH > 16) && defined(STRING_SPLASH_LINE1) - lcd_printPGM(PSTR(STRING_SPLASH_LINE1)); - #endif - lcd.setCursor(0, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------")); lcd.print('\x03'); - lcd_scroll(0, 3, PSTR("www.marlinfirmware.org" " "), LCD_WIDTH, 2000); + #define TEXT_SCREEN_LOGO_SHIFT ((LCD_WIDTH/2) - 4) + lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.print('\x01'); + lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 1); lcd_printPGM(PSTR("|Marlin|")); + lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------" )); lcd.print('\x03'); - #if (LCD_WIDTH <= 16) && defined(STRING_SPLASH_LINE1) + lcd_scroll(0, 3, PSTR("www.marlinfirmware.org"), LCD_WIDTH, 3000); + + #ifdef STRING_SPLASH_LINE1 lcd_erase_line(3); - lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1 " "), LCD_WIDTH, 1000); + lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 1000); #endif #ifdef STRING_SPLASH_LINE2 lcd_erase_line(3); - lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2 " "), LCD_WIDTH, 1000); + lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 1000); #endif } #endif // SHOW_BOOTSCREEN