Browse Source

Clean up some u8g code (#12476)

Scott Lahteine 6 years ago
parent
commit
88c57eaf55
No account linked to committer's email address
2 changed files with 18 additions and 21 deletions
  1. 18
    20
      Marlin/src/lcd/dogm/lcdprint_u8g.cpp
  2. 0
    1
      Marlin/src/lcd/dogm/ultralcd_DOGM.cpp

+ 18
- 20
Marlin/src/lcd/dogm/lcdprint_u8g.cpp View File

@@ -12,9 +12,7 @@
12 12
 #if HAS_GRAPHICAL_LCD
13 13
 
14 14
 #include <U8glib.h>
15
-extern U8GLIB *pu8g;
16
-#define _lcd_write(a) pu8g->print(a)
17
-#define _lcd_setcursor(col, row) pu8g->setPrintPos((col), (row));
15
+extern U8GLIB u8g;
18 16
 
19 17
 #include "../ultralcd.h"
20 18
 #include "../../Marlin.h"
@@ -23,40 +21,40 @@ extern U8GLIB *pu8g;
23 21
 #include "u8g_fontutf8.h"
24 22
 #include "../lcdprint.h"
25 23
 
26
-int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(pu8g->getU8g()); }
24
+int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(u8g.getU8g()); }
27 25
 
28
-void lcd_moveto(const uint8_t col, const uint8_t row) { _lcd_setcursor(col, row); }
26
+void lcd_moveto(const uint8_t col, const uint8_t row) { u8g.setPrintPos(col, row); }
29 27
 
30
-void lcd_put_int(const int i) { pu8g->print(i); }
28
+void lcd_put_int(const int i) { u8g.print(i); }
31 29
 
32 30
 // return < 0 on error
33 31
 // return the advanced pixels
34 32
 int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
35 33
   if (c < 256) {
36
-    _lcd_write((char)c);
37
-    return u8g_GetFontBBXWidth(pu8g->getU8g());
34
+    u8g.print((char)c);
35
+    return u8g_GetFontBBXWidth(u8g.getU8g());
38 36
   }
39
-  unsigned int x = pu8g->getPrintCol(),
40
-               y = pu8g->getPrintRow(),
41
-               ret = uxg_DrawWchar(pu8g->getU8g(), x, y, c, max_length);
42
-  pu8g->setPrintPos(x + ret, y);
37
+  unsigned int x = u8g.getPrintCol(),
38
+               y = u8g.getPrintRow(),
39
+               ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length);
40
+  u8g.setPrintPos(x + ret, y);
43 41
 
44 42
   return ret;
45 43
 }
46 44
 
47 45
 int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
48
-  unsigned int x = pu8g->getPrintCol(),
49
-               y = pu8g->getPrintRow(),
50
-               ret = uxg_DrawUtf8Str(pu8g->getU8g(), x, y, utf8_str, max_length);
51
-  pu8g->setPrintPos(x + ret, y);
46
+  unsigned int x = u8g.getPrintCol(),
47
+               y = u8g.getPrintRow(),
48
+               ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
49
+  u8g.setPrintPos(x + ret, y);
52 50
   return ret;
53 51
 }
54 52
 
55 53
 int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
56
-  unsigned int x = pu8g->getPrintCol(),
57
-               y = pu8g->getPrintRow(),
58
-               ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length);
59
-  pu8g->setPrintPos(x + ret, y);
54
+  unsigned int x = u8g.getPrintCol(),
55
+               y = u8g.getPrintRow(),
56
+               ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
57
+  u8g.setPrintPos(x + ret, y);
60 58
   return ret;
61 59
 }
62 60
 

+ 0
- 1
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp View File

@@ -68,7 +68,6 @@
68 68
 #endif
69 69
 
70 70
 U8G_CLASS u8g(U8G_PARAM);
71
-U8GLIB *pu8g = &u8g;
72 71
 
73 72
 #include LANGUAGE_DATA_INCL(LCD_LANGUAGE)
74 73
 

Loading…
Cancel
Save