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 10 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,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
@@ -120,7 +131,7 @@ static void lcd_implementation_init()
120 131
 	u8g.firstPage();
121 132
 	do {
122 133
     u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
123
-    u8g.setFont(u8g_font_6x10_marlin);
134
+    u8g.setFont(FONT_MENU);
124 135
     #ifndef STRING_SPLASH_LINE2
125 136
       u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
126 137
     #else
@@ -245,7 +256,7 @@ static void lcd_implementation_status_screen() {
245 256
   u8g.setColorIndex(1); // black on white
246 257
  
247 258
   // Feedrate
248
-  u8g.setFont(u8g_font_6x10_marlin);
259
+  u8g.setFont(FONT_MENU);
249 260
   u8g.setPrintPos(3,49);
250 261
   u8g.print(LCD_STR_FEEDRATE[0]);
251 262
   u8g.setFont(FONT_STATUSMENU);
@@ -364,11 +375,11 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p
364 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 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 380
   lcd_printPGM(pstr);
370 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 383
   u8g.print(value);
373 384
 }
374 385
 

+ 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