From 859248433f5e6d6466ef92f6eff23fbd6b994eec Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 2 Jul 2017 00:35:52 -0500 Subject: [PATCH 1/2] Patch for gcode debug --- Marlin/gcode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/gcode.h b/Marlin/gcode.h index 3884bd60d..7b5857640 100644 --- a/Marlin/gcode.h +++ b/Marlin/gcode.h @@ -124,7 +124,7 @@ public: if (debug) { SERIAL_ECHOPAIR("Set bit ", (int)PARAM_BIT(ind)); SERIAL_ECHOPAIR(" of index ", (int)PARAM_IND(ind)); - SERIAL_ECHOLNPAIR(" | param = ", hex_address((void*)param[ind])); + SERIAL_ECHOLNPAIR(" | param = ", (int)param[ind]); } #endif } From ae5923a3d019131b42c27ea243524495c59e4021 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 2 Jul 2017 00:35:41 -0500 Subject: [PATCH 2/2] Make lcd_bootscreen common to both --- Marlin/Marlin_main.cpp | 11 ++-- Marlin/ultralcd.h | 6 ++- Marlin/ultralcd_impl_DOGM.h | 92 +++++++++++++++++++--------------- Marlin/ultralcd_impl_HD44780.h | 2 +- 4 files changed, 65 insertions(+), 46 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f19a89818..c280c1002 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -13034,11 +13034,16 @@ void setup() { #endif lcd_init(); + #if ENABLED(SHOW_BOOTSCREEN) - #if ENABLED(DOGLCD) - safe_delay(BOOTSCREEN_TIMEOUT); + #if ENABLED(DOGLCD) // On DOGM the first bootscreen is already drawn + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); // Custom boot screen pause + lcd_bootscreen(); // Show Marlin boot screen + #endif + safe_delay(BOOTSCREEN_TIMEOUT); // Pause #elif ENABLED(ULTRA_LCD) - bootscreen(); + lcd_bootscreen(); #if DISABLED(SDSUPPORT) lcd_init(); #endif diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 909c13d40..f1087616f 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -64,8 +64,10 @@ #if ENABLED(DOGLCD) extern uint16_t lcd_contrast; void set_lcd_contrast(const uint16_t value); - #elif ENABLED(SHOW_BOOTSCREEN) - void bootscreen(); + #endif + + #if ENABLED(SHOW_BOOTSCREEN) + void lcd_bootscreen(); #endif #define LCD_UPDATE_INTERVAL 100 diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index c9cbf452e..392e812c9 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -256,6 +256,55 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { while (n && (c = pgm_read_byte(str))) n -= charset_mapper(c), ++str; } +#if ENABLED(SHOW_BOOTSCREEN) + + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + void lcd_custom_bootscreen() { + u8g.firstPage(); + do { + 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()); + } + + #endif // SHOW_CUSTOM_BOOTSCREEN + + void lcd_bootscreen() { + + static bool show_bootscreen = true; + + if (show_bootscreen) { + show_bootscreen = false; + + #if ENABLED(START_BMPHIGH) + constexpr uint8_t offy = 0; + #else + constexpr uint8_t offy = DOG_CHAR_HEIGHT; + #endif + + const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2, + txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2; + + u8g.firstPage(); + do { + 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 + const uint8_t 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()); + } + } + +#endif // SHOW_BOOTSCREEN + // Initialize or re-initialize the LCD static void lcd_implementation_init() { @@ -284,49 +333,12 @@ static void lcd_implementation_init() { #endif #if ENABLED(SHOW_BOOTSCREEN) - static bool show_bootscreen = true; - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - if (show_bootscreen) { - u8g.firstPage(); - do { - 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()); - safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); - } - #endif // SHOW_CUSTOM_BOOTSCREEN - - const uint8_t offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2; - - #if ENABLED(START_BMPHIGH) - constexpr uint8_t offy = 0; + lcd_custom_bootscreen(); #else - constexpr uint8_t offy = DOG_CHAR_HEIGHT; + lcd_bootscreen(); #endif - - const uint8_t txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2; - - if (show_bootscreen) { - u8g.firstPage(); - do { - 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 - const uint8_t 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()); - } - - show_bootscreen = false; - - #endif // SHOW_BOOTSCREEN + #endif } // The kill screen is displayed for unrecoverable conditions diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index 554c54c36..c2642b4d7 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -443,7 +443,7 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { lcd.setCursor(indent, 2); lcd.write('\x02'); lcd_printPGM(PSTR( "------" )); lcd.write('\x03'); } - void bootscreen() { + void lcd_bootscreen() { const static PROGMEM byte corner[4][8] = { { B00000, B00000,