Browse Source

Merge pull request #1457 from AnHardt/bootsplash

Reworked bootsplash for DOGM displays another time - saved 1786 bytes
Scott Lahteine 9 years ago
parent
commit
04ce708031

+ 2
- 1
Marlin/Configuration.h View File

@@ -42,7 +42,8 @@ Here are some standard links for getting your machine calibrated:
42 42
 #define STRING_URL "reprap.org"
43 43
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
44 44
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
45
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
45
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
46
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
46 47
 
47 48
 // SERIAL_PORT selects which serial port should be used for communication with the host.
48 49
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 3
- 1
Marlin/DOGMbitmaps.h View File

@@ -1,6 +1,8 @@
1 1
 // BitMap for splashscreen
2 2
 // Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php
3
-// Please note that using the high-res version takes about 0.5KB of 
3
+// Please note that using the high-res version takes 402Bytes of PROGMEM. 
4
+//#define START_BMPHIGH
5
+
4 6
 #ifdef START_BMPHIGH
5 7
   #define START_BMPWIDTH      112
6 8
   #define START_BMPHEIGHT      38

+ 36
- 24
Marlin/dogm_lcd_implementation.h View File

@@ -51,11 +51,24 @@
51 51
 #endif
52 52
 */
53 53
 
54
+#define USE_BIG_EDIT_FONT
55
+#define FONT_STATUSMENU u8g_font_6x9
56
+#define FONT_MENU u8g_font_6x10_marlin
57
+
54 58
 // DOGM parameters (size in pixels)
55 59
 #define DOG_CHAR_WIDTH         6
56 60
 #define DOG_CHAR_HEIGHT        12
57
-#define DOG_CHAR_WIDTH_LARGE   9
58
-#define DOG_CHAR_HEIGHT_LARGE  18
61
+#ifdef USE_BIG_EDIT_FONT
62
+  #define FONT_MENU_EDIT u8g_font_9x18
63
+  #define DOG_CHAR_WIDTH_EDIT  9
64
+  #define DOG_CHAR_HEIGHT_EDIT 18
65
+  #define LCD_WIDTH_EDIT       14
66
+#else
67
+  #define FONT_MENU_EDIT u8g_font_6x10_marlin
68
+  #define DOG_CHAR_WIDTH_EDIT 6
69
+  #define DOG_CHAR_HEIGHT_EDIT 12
70
+  #define LCD_WIDTH_EDIT 22
71
+#endif
59 72
 
60 73
 #define START_ROW              0
61 74
 
@@ -70,8 +83,6 @@
70 83
 #define LCD_STR_BEDTEMP     "\xFE"
71 84
 #define LCD_STR_THERMOMETER "\xFF"
72 85
 
73
-#define FONT_STATUSMENU u8g_font_6x9
74
-
75 86
 int lcd_contrast;
76 87
 
77 88
 // LCD selection
@@ -107,26 +118,27 @@ static void lcd_implementation_init()
107 118
 	u8g.setRot270();	// Rotate screen by 270°
108 119
 #endif
109 120
 	
110
-  // FIXME: whats the purpose of the box? Maybe clear screen?
111
-	u8g.firstPage();
112
-  do {
113
-		u8g.setFont(u8g_font_6x10_marlin);
114
-		u8g.setColorIndex(1);
115
-		u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
116
-		u8g.setColorIndex(1);
117
-	} while(u8g.nextPage());
118
-
119 121
   // Show splashscreen
120 122
   int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
121
-  int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2;
122
-  int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*5) / 2; // 5 is fontwidth in pixel
123
-  int txtY = u8g.getHeight() - 10;
123
+  #ifdef START_BMPHIGH
124
+    int offy = 0;
125
+  #else
126
+    int offy = DOG_CHAR_HEIGHT;
127
+  #endif
128
+
129
+  int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
130
+
124 131
 	u8g.firstPage();
125 132
 	do {
126
-	  u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
127
-			
128
-    u8g.setFont(u8g_font_5x8);
129
-		u8g.drawStr(txtX, txtY, STRING_SPLASH);
133
+    u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
134
+    u8g.setFont(FONT_MENU);
135
+    #ifndef STRING_SPLASH_LINE2
136
+      u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
137
+    #else
138
+      int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
139
+      u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1);
140
+      u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
141
+    #endif
130 142
 	} while(u8g.nextPage());
131 143
 }
132 144
 
@@ -244,7 +256,7 @@ static void lcd_implementation_status_screen() {
244 256
   u8g.setColorIndex(1); // black on white
245 257
  
246 258
   // Feedrate
247
-  u8g.setFont(u8g_font_6x10_marlin);
259
+  u8g.setFont(FONT_MENU);
248 260
   u8g.setPrintPos(3,49);
249 261
   u8g.print(LCD_STR_FEEDRATE[0]);
250 262
   u8g.setFont(FONT_STATUSMENU);
@@ -363,11 +375,11 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p
363 375
 #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))
364 376
 
365 377
 void lcd_implementation_drawedit(const char* pstr, char* value) {
366
-  u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
367
-  u8g.setFont(u8g_font_9x18);
378
+  u8g.setPrintPos(0 * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW );
379
+  u8g.setFont(FONT_MENU_EDIT);
368 380
   lcd_printPGM(pstr);
369 381
   u8g.print(':');
370
-  u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
382
+  u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_EDIT, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_EDIT) - (1 * DOG_CHAR_HEIGHT_EDIT) - START_ROW );
371 383
   u8g.print(value);
372 384
 }
373 385
 

+ 2
- 1
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -42,7 +42,8 @@ Here are some standard links for getting your machine calibrated:
42 42
 #define STRING_URL "reprap.org"
43 43
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
44 44
 #define STRING_CONFIG_H_AUTHOR "(bq Hephestos)" // Who made the changes.
45
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
45
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
46
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
46 47
 
47 48
 // SERIAL_PORT selects which serial port should be used for communication with the host.
48 49
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/K8200/Configuration.h View File

@@ -43,7 +43,8 @@ Here are some standard links for getting your machine calibrated:
43 43
 #define STRING_URL "reprap.org"
44 44
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
45 45
 #define STRING_CONFIG_H_AUTHOR "(K8200, CONSULitAS)" // Who made the changes.
46
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
46
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
47
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
47 48
 
48 49
 // SERIAL_PORT selects which serial port should be used for communication with the host.
49 50
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -62,7 +62,8 @@ Here are some standard links for getting your machine calibrated:
62 62
 #define STRING_URL "reprap.org"
63 63
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
64 64
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
65
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
65
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
66
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
66 67
 
67 68
 // SERIAL_PORT selects which serial port should be used for communication with the host.
68 69
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -44,7 +44,8 @@ Here are some standard links for getting your machine calibrated:
44 44
 #define STRING_URL "reprap.org"
45 45
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
46 46
 #define STRING_CONFIG_H_AUTHOR "(bq Witbox)" // Who made the changes.
47
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
47
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
48
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
48 49
 
49 50
 // SERIAL_PORT selects which serial port should be used for communication with the host.
50 51
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/delta/Configuration.h View File

@@ -37,7 +37,8 @@ Here are some standard links for getting your machine calibrated:
37 37
 #define STRING_URL "reprap.org"
38 38
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
39 39
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
40
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
40
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
41
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
41 42
 
42 43
 // SERIAL_PORT selects which serial port should be used for communication with the host.
43 44
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/makibox/Configuration.h View File

@@ -46,7 +46,8 @@ Here are some standard links for getting your machine calibrated:
46 46
 #define STRING_URL "reprap.org"
47 47
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
48 48
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
49
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
49
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
50
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
50 51
 
51 52
 // SERIAL_PORT selects which serial port should be used for communication with the host.
52 53
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 2
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -45,7 +45,8 @@ Here are some standard links for getting your machine calibrated:
45 45
 #define STRING_URL "reprap.org"
46 46
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
47 47
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
48
-#define STRING_SPLASH "v" STRING_VERSION " - " STRING_URL // will be shown during bootup
48
+#define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1
49
+//#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2
49 50
 
50 51
 // SERIAL_PORT selects which serial port should be used for communication with the host.
51 52
 // This allows the connection of wireless adapters (for instance) to non-default port pins.

+ 1
- 1
Marlin/ultralcd.cpp View File

@@ -1323,7 +1323,7 @@ void lcd_update()
1323 1323
         u8g.firstPage();
1324 1324
         do
1325 1325
         {
1326
-            u8g.setFont(u8g_font_6x10_marlin);
1326
+            u8g.setFont(FONT_MENU);
1327 1327
             u8g.setPrintPos(125,0);
1328 1328
             if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
1329 1329
             u8g.drawPixel(127,63); // draw alive dot

Loading…
Cancel
Save