Browse Source

Centralise definition of fonts for DOGM displays

Prework for issue #1448 and #1447

Will merge in when pull request #1457 is in.
AnHardt 9 years ago
parent
commit
b1dbd765c6
2 changed files with 21 additions and 10 deletions
  1. 20
    9
      Marlin/dogm_lcd_implementation.h
  2. 1
    1
      Marlin/ultralcd.cpp

+ 20
- 9
Marlin/dogm_lcd_implementation.h View File

51
 #endif
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
 // DOGM parameters (size in pixels)
58
 // DOGM parameters (size in pixels)
55
 #define DOG_CHAR_WIDTH         6
59
 #define DOG_CHAR_WIDTH         6
56
 #define DOG_CHAR_HEIGHT        12
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
 #define START_ROW              0
73
 #define START_ROW              0
61
 
74
 
70
 #define LCD_STR_BEDTEMP     "\xFE"
83
 #define LCD_STR_BEDTEMP     "\xFE"
71
 #define LCD_STR_THERMOMETER "\xFF"
84
 #define LCD_STR_THERMOMETER "\xFF"
72
 
85
 
73
-#define FONT_STATUSMENU u8g_font_6x9
74
-
75
 int lcd_contrast;
86
 int lcd_contrast;
76
 
87
 
77
 // LCD selection
88
 // LCD selection
120
 	u8g.firstPage();
131
 	u8g.firstPage();
121
 	do {
132
 	do {
122
     u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
133
     u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
123
-    u8g.setFont(u8g_font_6x10_marlin);
134
+    u8g.setFont(FONT_MENU);
124
     #ifndef STRING_SPLASH_LINE2
135
     #ifndef STRING_SPLASH_LINE2
125
       u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
136
       u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
126
     #else
137
     #else
245
   u8g.setColorIndex(1); // black on white
256
   u8g.setColorIndex(1); // black on white
246
  
257
  
247
   // Feedrate
258
   // Feedrate
248
-  u8g.setFont(u8g_font_6x10_marlin);
259
+  u8g.setFont(FONT_MENU);
249
   u8g.setPrintPos(3,49);
260
   u8g.setPrintPos(3,49);
250
   u8g.print(LCD_STR_FEEDRATE[0]);
261
   u8g.print(LCD_STR_FEEDRATE[0]);
251
   u8g.setFont(FONT_STATUSMENU);
262
   u8g.setFont(FONT_STATUSMENU);
364
 #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))
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))
365
 
376
 
366
 void lcd_implementation_drawedit(const char* pstr, char* value) {
377
 void lcd_implementation_drawedit(const char* pstr, char* value) {
367
-  u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
368
-  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);
369
   lcd_printPGM(pstr);
380
   lcd_printPGM(pstr);
370
   u8g.print(':');
381
   u8g.print(':');
371
-  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 );
372
   u8g.print(value);
383
   u8g.print(value);
373
 }
384
 }
374
 
385
 

+ 1
- 1
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save