From 9865318f1c8f7b2c45a6a73e923c20a8b31b3d6e Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sun, 5 Apr 2015 12:24:01 +0200 Subject: [PATCH 1/4] Disable splash-screen when done once Splash screen was shown with every display init. That means every time the menus where entered. Note the 2 in the initialisation. The buffer is already written in two steps a 512 byte. Without the 2 only the upper half is shown. --- Marlin/dogm_lcd_implementation.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c057e56425..e6cfb80784 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -186,6 +186,8 @@ char lcd_printPGM(const char* str) { return n; } +static int8_t show_splashscreed = 2; + static void lcd_implementation_init() { #ifdef LCD_PIN_BL // Enable LCD backlight @@ -219,15 +221,18 @@ static void lcd_implementation_init() 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 - 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 + if (show_splashscreed) { + 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 + show_splashscreed--; + } } while (u8g.nextPage()); } From bf04a92cc0046d4af04e422d9e84e027e59fb2ba Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sun, 5 Apr 2015 12:53:20 +0200 Subject: [PATCH 2/4] Draw content in display loop only when needed Example for splash screen. --- Marlin/dogm_lcd_implementation.h | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index e6cfb80784..bf9726ceea 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -186,7 +186,7 @@ char lcd_printPGM(const char* str) { return n; } -static int8_t show_splashscreed = 2; +int8_t show_splashscreen = 2; static void lcd_implementation_init() { @@ -221,18 +221,25 @@ static void lcd_implementation_init() u8g.firstPage(); do { - if (show_splashscreed) { - 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 - show_splashscreed--; - } + switch (show_splashscreen) { + case 2 : { + u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); + break; + } + case 1 : { + 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 + break; + } + break; + } + if (show_splashscreen) show_splashscreen--; } while (u8g.nextPage()); } From d5216936410099636a68f93ae598d4db37f43977 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 6 Apr 2015 12:31:31 +0200 Subject: [PATCH 3/4] Revert "Draw content in display loop only when needed" This reverts commit bf04a92cc0046d4af04e422d9e84e027e59fb2ba. --- Marlin/dogm_lcd_implementation.h | 33 +++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index bf9726ceea..e6cfb80784 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -186,7 +186,7 @@ char lcd_printPGM(const char* str) { return n; } -int8_t show_splashscreen = 2; +static int8_t show_splashscreed = 2; static void lcd_implementation_init() { @@ -221,25 +221,18 @@ static void lcd_implementation_init() u8g.firstPage(); do { - switch (show_splashscreen) { - case 2 : { - u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); - break; - } - case 1 : { - 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 - break; - } - break; - } - if (show_splashscreen) show_splashscreen--; + if (show_splashscreed) { + 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 + show_splashscreed--; + } } while (u8g.nextPage()); } From 6ae714894e86edf48233794448559f655a5d702d Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 6 Apr 2015 12:43:38 +0200 Subject: [PATCH 4/4] Now the simplycistic solution. Just and only display splashscreen only once. --- Marlin/dogm_lcd_implementation.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index e6cfb80784..f940a89755 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -186,7 +186,7 @@ char lcd_printPGM(const char* str) { return n; } -static int8_t show_splashscreed = 2; +static bool show_splashscreen = true; static void lcd_implementation_init() { @@ -221,7 +221,7 @@ static void lcd_implementation_init() u8g.firstPage(); do { - if (show_splashscreed) { + if (show_splashscreen) { u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); lcd_setFont(FONT_MENU); #ifndef STRING_SPLASH_LINE2 @@ -231,9 +231,9 @@ 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 - show_splashscreed--; } } while (u8g.nextPage()); + show_splashscreen = false; } static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop