From f5fd94d62a4bc725d4b658869a7cab48c068860d Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 08:56:00 +0100 Subject: [PATCH 1/7] Kick suspicious loop an win 72 bytes. No visible impact. --- Marlin/dogm_lcd_implementation.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index ffc323c5a5..ee8c44d633 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -107,15 +107,6 @@ static void lcd_implementation_init() u8g.setRot270(); // Rotate screen by 270° #endif - // FIXME: whats the purpose of the box? Maybe clear screen? - u8g.firstPage(); - do { - u8g.setFont(u8g_font_6x10_marlin); - u8g.setColorIndex(1); - u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight()); - u8g.setColorIndex(1); - } while(u8g.nextPage()); - // Show splashscreen int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2; From 3602474c25dbd81e1e5e991966c2d99d8d49f0da Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 09:07:57 +0100 Subject: [PATCH 2/7] Replace solitaire use of u8g_font_5x8 font and replace with u8g_font_6x10_marlin and win another 1694 bytes. --- Marlin/dogm_lcd_implementation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index ee8c44d633..e901a7da22 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -110,13 +110,13 @@ static void lcd_implementation_init() // Show splashscreen int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2; - int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*5) / 2; // 5 is fontwidth in pixel + int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*6) / 2; // 6 is fontwidth in pixel int txtY = u8g.getHeight() - 10; u8g.firstPage(); do { u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); - u8g.setFont(u8g_font_5x8); + u8g.setFont(u8g_font_6x10_marlin); u8g.drawStr(txtX, txtY, STRING_SPLASH); } while(u8g.nextPage()); } From c20606b8d75b08cf3da7af2e10cbe1b15beb2893 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 09:52:29 +0100 Subject: [PATCH 3/7] Replaced some literal constants with defines Replaced calculation to centre bitmap with fixed values. Saved 20 bytes. --- Marlin/DOGMbitmaps.h | 4 +++- Marlin/dogm_lcd_implementation.h | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/DOGMbitmaps.h b/Marlin/DOGMbitmaps.h index b735477e3f..8c8356785a 100644 --- a/Marlin/DOGMbitmaps.h +++ b/Marlin/DOGMbitmaps.h @@ -1,6 +1,8 @@ // BitMap for splashscreen // Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php -// Please note that using the high-res version takes about 0.5KB of +// Please note that using the high-res version takes 402Bytes of PROGMEM. +//#define START_BMPHIGH + #ifdef START_BMPHIGH #define START_BMPWIDTH 112 #define START_BMPHEIGHT 38 diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index e901a7da22..7b7c319944 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -109,9 +109,13 @@ static void lcd_implementation_init() // Show splashscreen int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; - int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2; - int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*6) / 2; // 6 is fontwidth in pixel - int txtY = u8g.getHeight() - 10; + #ifdef START_BMPHIGH + int offy = 0; + #else + int offy = DOG_CHAR_HEIGHT; + #endif + int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*DOG_CHAR_WIDTH) / 2; + int txtY = u8g.getHeight() - DOG_CHAR_HEIGHT; u8g.firstPage(); do { u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); From f9cc1df00b63e1ad524f5f4c14bb5c6321974b1c Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 11:14:27 +0100 Subject: [PATCH 4/7] Droped URL from bootsplash. --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ceaa72adad..10988be83b 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -42,7 +42,7 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH "v" STRING_VERSION // will be shown during bootup // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. From 65642592eef1a3a20424c56561c84476befaabc4 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 12:25:36 +0100 Subject: [PATCH 5/7] Added dualline version. --- Marlin/Configuration.h | 3 ++- Marlin/dogm_lcd_implementation.h | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 10988be83b..613a79d29d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -42,7 +42,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 7b7c319944..c5d10e17b3 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -114,14 +114,20 @@ static void lcd_implementation_init() #else int offy = DOG_CHAR_HEIGHT; #endif - int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*DOG_CHAR_WIDTH) / 2; - int txtY = u8g.getHeight() - DOG_CHAR_HEIGHT; + + int 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); - + u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.setFont(u8g_font_6x10_marlin); - u8g.drawStr(txtX, txtY, STRING_SPLASH); + #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()); } From b1dbd765c6a38b52cbefd32098ec4cf971076237 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 13:10:09 +0100 Subject: [PATCH 6/7] Centralise definition of fonts for DOGM displays Prework for issue #1448 and #1447 Will merge in when pull request #1457 is in. --- Marlin/dogm_lcd_implementation.h | 29 ++++++++++++++++++++--------- Marlin/ultralcd.cpp | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c5d10e17b3..6350684fca 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -51,11 +51,24 @@ #endif */ +#define USE_BIG_EDIT_FONT +#define FONT_STATUSMENU u8g_font_6x9 +#define FONT_MENU u8g_font_6x10_marlin + // DOGM parameters (size in pixels) #define DOG_CHAR_WIDTH 6 #define DOG_CHAR_HEIGHT 12 -#define DOG_CHAR_WIDTH_LARGE 9 -#define DOG_CHAR_HEIGHT_LARGE 18 +#ifdef USE_BIG_EDIT_FONT + #define FONT_MENU_EDIT u8g_font_9x18 + #define DOG_CHAR_WIDTH_EDIT 9 + #define DOG_CHAR_HEIGHT_EDIT 18 + #define LCD_WIDTH_EDIT 14 +#else + #define FONT_MENU_EDIT u8g_font_6x10_marlin + #define DOG_CHAR_WIDTH_EDIT 6 + #define DOG_CHAR_HEIGHT_EDIT 12 + #define LCD_WIDTH_EDIT 22 +#endif #define START_ROW 0 @@ -70,8 +83,6 @@ #define LCD_STR_BEDTEMP "\xFE" #define LCD_STR_THERMOMETER "\xFF" -#define FONT_STATUSMENU u8g_font_6x9 - int lcd_contrast; // LCD selection @@ -120,7 +131,7 @@ static void lcd_implementation_init() u8g.firstPage(); do { u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); - u8g.setFont(u8g_font_6x10_marlin); + u8g.setFont(FONT_MENU); #ifndef STRING_SPLASH_LINE2 u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); #else @@ -245,7 +256,7 @@ static void lcd_implementation_status_screen() { u8g.setColorIndex(1); // black on white // Feedrate - u8g.setFont(u8g_font_6x10_marlin); + u8g.setFont(FONT_MENU); u8g.setPrintPos(3,49); u8g.print(LCD_STR_FEEDRATE[0]); u8g.setFont(FONT_STATUSMENU); @@ -364,11 +375,11 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p #define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) void lcd_implementation_drawedit(const char* pstr, char* value) { - u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW ); - u8g.setFont(u8g_font_9x18); + u8g.setPrintPos(0 * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW ); + u8g.setFont(FONT_MENU_EDIT); lcd_printPGM(pstr); u8g.print(':'); - u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW ); + u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW ); u8g.print(value); } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 3335b9aa99..cd7380886b 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1323,7 +1323,7 @@ void lcd_update() u8g.firstPage(); do { - u8g.setFont(u8g_font_6x10_marlin); + u8g.setFont(FONT_MENU); u8g.setPrintPos(125,0); if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot u8g.drawPixel(127,63); // draw alive dot From 2abf1ad940f9b8ed359276afe975751c771de210 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 3 Feb 2015 17:59:04 +0100 Subject: [PATCH 7/7] Distribute recent changes in Configuration.h to the examples. --- Marlin/example_configurations/Hephestos/Configuration.h | 3 ++- Marlin/example_configurations/K8200/Configuration.h | 3 ++- Marlin/example_configurations/SCARA/Configuration.h | 3 ++- Marlin/example_configurations/WITBOX/Configuration.h | 3 ++- Marlin/example_configurations/delta/Configuration.h | 3 ++- Marlin/example_configurations/makibox/Configuration.h | 3 ++- Marlin/example_configurations/tvrrug/Round2/Configuration.h | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 2bf435fb0d..2823f2d95c 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -42,7 +42,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(bq Hephestos)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index d6cc80c815..7c61944a7c 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -43,7 +43,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(K8200, CONSULitAS)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 4ee789e93f..8bc4eb70e9 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -62,7 +62,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index d5d20fd44c..4a12bda515 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -44,7 +44,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(bq Witbox)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/delta/Configuration.h b/Marlin/example_configurations/delta/Configuration.h index 267ea304a8..3eb268041a 100644 --- a/Marlin/example_configurations/delta/Configuration.h +++ b/Marlin/example_configurations/delta/Configuration.h @@ -37,7 +37,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index cd22cc9c02..99feceba8c 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -46,7 +46,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index d6098b515f..4ca415d8ff 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -45,7 +45,8 @@ Here are some standard links for getting your machine calibrated: #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. -#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup +#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 +//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins.