Browse Source

Convert DOGM / HD44780 impl to CPP files

Scott Lahteine 6 years ago
parent
commit
c825c419d4

Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.h → Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp View File

@@ -20,15 +20,25 @@
20 20
  *
21 21
  */
22 22
 
23
-#ifndef ULTRALCD_IMPL_HD44780_H
24
-#define ULTRALCD_IMPL_HD44780_H
23
+#include "../../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)
25 26
 
26 27
 /**
28
+ * ultralcd_impl_HD44780.cpp
29
+ *
27 30
  * Implementation of the LCD display routines for a Hitachi HD44780 display.
28 31
  * These are the most common LCD character displays.
29 32
  */
30 33
 
31 34
 #include "ultralcd_common_HD44780.h"
35
+#include "../ultralcd.h"
36
+
37
+#include "../../sd/cardreader.h"
38
+#include "../../module/temperature.h"
39
+#include "../../module/printcounter.h"
40
+#include "../../module/planner.h"
41
+#include "../../module/motion.h"
32 42
 
33 43
 ////////////////////////////////////
34 44
 // Create LCD class instance and chipset-specific information
@@ -1043,6 +1053,7 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
1043 1053
       const char *outstr = theCard.longest_filename();
1044 1054
       if (theCard.longFilename[0]) {
1045 1055
         #if ENABLED(SCROLL_LONG_FILENAMES)
1056
+          static uint8_t filename_scroll_hash;
1046 1057
           if (sel) {
1047 1058
             uint8_t name_hash = row;
1048 1059
             for (uint8_t l = FILENAME_LENGTH; l--;)
@@ -1080,6 +1091,8 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
1080 1091
 
1081 1092
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1082 1093
 
1094
+    extern millis_t next_button_update_ms;
1095
+
1083 1096
     static uint8_t lcd_implementation_read_slow_buttons() {
1084 1097
       #if ENABLED(LCD_I2C_TYPE_MCP23017)
1085 1098
         // Reading these buttons this is likely to be too slow to call inside interrupt context
@@ -1570,4 +1583,4 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
1570 1583
 
1571 1584
 #endif // ULTIPANEL
1572 1585
 
1573
-#endif // ULTRALCD_IMPL_HD44780_H
1586
+#endif // ULTRA_LCD && !DOGLCD

+ 2
- 0
Marlin/src/lcd/dogm/status_screen_DOGM.h View File

@@ -29,6 +29,8 @@
29 29
 #ifndef _STATUS_SCREEN_DOGM_H_
30 30
 #define _STATUS_SCREEN_DOGM_H_
31 31
 
32
+#include "../../module/motion.h"
33
+
32 34
 FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) {
33 35
   const char * const str = itostr3(temp);
34 36
   lcd_moveto(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y);

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h View File

@@ -963,7 +963,7 @@ void lcd_impl_status_screen_0() {
963 963
  * entered the Status Screen and calls the on_entry()
964 964
  * and on_exit() methods for cleanup.
965 965
  */
966
-static void lcd_in_status(const bool inStatus) {
966
+void lcd_in_status(const bool inStatus) {
967 967
   static bool lastInStatus = false;
968 968
   if (lastInStatus == inStatus) return;
969 969
   if ((lastInStatus = inStatus))

Marlin/src/lcd/dogm/ultralcd_impl_DOGM.h → Marlin/src/lcd/dogm/ultralcd_impl_DOGM.cpp View File

@@ -21,9 +21,11 @@
21 21
  */
22 22
 
23 23
 /**
24
- * ultralcd_impl_DOGM.h
24
+ * ultralcd_impl_DOGM.cpp
25
+ *
26
+ * Implementation of the LCD display routines for a DOGM128 graphic display.
27
+ * by STB for ErikZalm/Marlin. Common LCD 128x64 pixel graphic displays.
25 28
  *
26
- * Graphics LCD implementation for 128x64 pixel LCDs by STB for ErikZalm/Marlin
27 29
  * Demonstrator: http://www.reprap.org/wiki/STB_Electronics
28 30
  * License: http://opensource.org/licenses/BSD-3-Clause
29 31
  *
@@ -33,34 +35,34 @@
33 35
  * License: http://opensource.org/licenses/BSD-3-Clause
34 36
  */
35 37
 
36
-#ifndef ULTRALCD_IMPL_DOGM_H
37
-#define ULTRALCD_IMPL_DOGM_H
38
+#include "../../inc/MarlinConfigPre.h"
38 39
 
39
-#include "../../inc/MarlinConfig.h"
40
+#if ENABLED(DOGLCD)
40 41
 
41
-/**
42
- * Implementation of the LCD display routines for a DOGM128 graphic display.
43
- * These are common LCD 128x64 pixel graphic displays.
44
- */
45 42
 #include "../ultralcd.h"
46 43
 
47
-#include "dogm_bitmaps.h"
48
-
49
-#if ENABLED(SDSUPPORT)
50
-  #include "../../libs/duration_t.h"
51
-#endif
52
-
53 44
 #include <U8glib.h>
45
+#include "HAL_LCD_class_defines.h"
54 46
 
55 47
 #include "../fontutils.h"
56 48
 #include "u8g_fontutf8.h"
49
+#include "dogm_bitmaps.h"
57 50
 
58
-#include "HAL_LCD_class_defines.h"
51
+#include "../../sd/cardreader.h"
52
+#include "../../module/temperature.h"
53
+#include "../../module/printcounter.h"
54
+
55
+#if ENABLED(SDSUPPORT)
56
+  #include "../../libs/duration_t.h"
57
+#endif
59 58
 
60 59
 #if ENABLED(AUTO_BED_LEVELING_UBL)
61 60
   #include "../../feature/bedlevel/ubl/ubl.h"
62 61
 #endif
63 62
 
63
+// The Marlin special symbols is now in the dogm_font_data_ISO10646_1.h
64
+#define FONT_SPECIAL_NAME ISO10646_1_5x7
65
+
64 66
 // Only Western languages support big / small fonts
65 67
 #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
66 68
   #undef USE_BIG_EDIT_FONT
@@ -76,21 +78,11 @@
76 78
   #define INFO_FONT_HEIGHT 8
77 79
 #endif
78 80
 
79
-// The Marlin special symbols is now in the dogm_font_data_ISO10646_1.h
80
-#define FONT_SPECIAL_NAME ISO10646_1_5x7
81
-
82 81
 #include LANGUAGE_DATA_INCL(LCD_LANGUAGE)
83 82
 
84 83
 #include "dogm_font_data_ISO10646_1.h"
85 84
 #define FONT_MENU_NAME ISO10646_1_5x7
86 85
 
87
-//#define FONT_STATUSMENU_NAME FONT_MENU_NAME
88
-
89
-#define FONT_STATUSMENU 1
90
-#define FONT_SPECIAL 2
91
-#define FONT_MENU_EDIT 3
92
-#define FONT_MENU 4
93
-
94 86
 // DOGM parameters (size in pixels)
95 87
 #define DOG_CHAR_WIDTH         6
96 88
 #define DOG_CHAR_HEIGHT        12
@@ -110,78 +102,7 @@
110 102
 
111 103
 #define START_COL              0
112 104
 
113
-// LCD selection
114
-#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
115
-  #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
116
-    U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card)
117
-  #else
118
-    U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI
119
-  #endif
120
-
121
-#elif ENABLED(U8GLIB_ST7920)
122
-  // RepRap Discount Full Graphics Smart Controller
123
-  #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
124
-    U8GLIB_ST7920_128X64_4X_HAL u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
125
-  #else
126
-    //U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI
127
-    U8GLIB_ST7920_128X64_RRD u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
128
-                                                                           // AVR version ignores these pin settings
129
-                                                                           // HAL version uses these pin settings
130
-  #endif
131
-
132
-#elif ENABLED(CARTESIO_UI)
133
-  // The CartesioUI display
134
-    //U8GLIB_DOGM128_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
135
-    U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
136
-
137
-#elif ENABLED(U8GLIB_LM6059_AF)
138
-  // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
139
-    //U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);  // 8 stripes
140
-    U8GLIB_LM6059_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
141
-
142
-#elif ENABLED(U8GLIB_ST7565_64128N)
143
-  // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
144
-  #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
145
-  #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
146
-    U8GLIB_64128N_2X_HAL u8g(DOGLCD_CS, DOGLCD_A0);  // using HW-SPI
147
-  #else
148
-    U8GLIB_64128N_2X_HAL u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0);  // using SW-SPI
149
-  #endif
150
-
151
-#elif ENABLED(MKS_12864OLED_SSD1306)
152
-  // MKS 128x64 (SSD1306) OLED I2C LCD
153
-    U8GLIB_SSD1306_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0);      // 8 stripes
154
-    //U8GLIB_SSD1306_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
155
-
156
-#elif ENABLED(U8GLIB_SSD1306)
157
-  // Generic support for SSD1306 OLED I2C LCDs
158
-    //U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE  u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
159
-    U8GLIB_SSD1306_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
160
-
161
-#elif ENABLED(MKS_12864OLED)
162
-  // MKS 128x64 (SH1106) OLED I2C LCD
163
-    U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0);      // 8 stripes
164
-    //U8GLIB_SH1106_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
165
-#elif ENABLED(U8GLIB_SH1106)
166
-  // Generic support for SH1106 OLED I2C LCDs
167
-    //U8GLIB_SH1106_128X64_2X_I2C_2_WIRE  u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
168
-    U8GLIB_SH1106_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
169
-#elif ENABLED(U8GLIB_SSD1309)
170
-  // Generic support for SSD1309 OLED I2C LCDs
171
-  U8GLIB_SSD1309_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST);
172
-#elif ENABLED(MINIPANEL)
173
-  // The MINIPanel display
174
-    //U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0);  // 8 stripes
175
-    U8GLIB_MINI12864_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
176
-#elif ENABLED(U8GLIB_SH1106_EINSTART)
177
-  // Connected via motherboard header
178
-  U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS);
179
-#else
180
-  // for regular DOGM128 display with HW-SPI
181
-    //U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0  // 8 stripes
182
-    U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0 // 4 stripes
183
-#endif
184
-
105
+U8G_CLASS u8g(U8G_PARAM);
185 106
 U8GLIB *pu8g = &u8g;
186 107
 
187 108
 #ifndef LCD_PIXEL_WIDTH
@@ -193,8 +114,16 @@ U8GLIB *pu8g = &u8g;
193 114
 
194 115
 #include "../lcdprint.h"
195 116
 
196
-int16_t lcd_contrast; // Initialized by settings.load()
197
-static char currentfont = 0;
117
+#if HAS_LCD_CONTRAST
118
+
119
+  int16_t lcd_contrast; // Initialized by settings.load()
120
+
121
+  void set_lcd_contrast(const int16_t value) {
122
+    lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
123
+    u8g.setContrast(lcd_contrast);
124
+  }
125
+
126
+#endif
198 127
 
199 128
 // The current graphical page being rendered
200 129
 u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p;
@@ -203,13 +132,16 @@ u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p;
203 132
 #define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
204 133
 #define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
205 134
 
206
-static void lcd_setFont(const char font_nr) {
207
-  switch (font_nr) {
208
-    case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break;
209
-    default:
210
-    case FONT_MENU       : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break;
211
-    case FONT_SPECIAL    : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break;
212
-    case FONT_MENU_EDIT  : {u8g.setFont(FONT_MENU_EDIT_NAME); currentfont = FONT_MENU_EDIT;}; break;
135
+void lcd_setFont(const MarlinFont font_nr) {
136
+  static char currentfont = 0;
137
+  if (font_nr != currentfont) {
138
+    switch ((currentfont = font_nr)) {
139
+      case FONT_STATUSMENU : u8g.setFont(FONT_STATUSMENU_NAME); break;
140
+      default:
141
+      case FONT_MENU       : u8g.setFont(FONT_MENU_NAME);       break;
142
+      case FONT_SPECIAL    : u8g.setFont(FONT_SPECIAL_NAME);    break;
143
+      case FONT_MENU_EDIT  : u8g.setFont(FONT_MENU_EDIT_NAME);  break;
144
+    }
213 145
   }
214 146
 }
215 147
 
@@ -324,8 +256,8 @@ void lcd_implementation_init() {
324 256
     u8g.begin();
325 257
   #endif
326 258
 
327
-  #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
328
-    u8g.setContrast(lcd_contrast);
259
+  #if HAS_LCD_CONTRAST
260
+    set_lcd_contrast(lcd_contrast);
329 261
   #endif
330 262
 
331 263
   #if ENABLED(LCD_SCREEN_ROT_90)
@@ -336,7 +268,7 @@ void lcd_implementation_init() {
336 268
     u8g.setRot270();  // Rotate screen by 270°
337 269
   #endif
338 270
 
339
-  uxg_SetUtf8Fonts (g_fontinfo, NUM_ARRAY(g_fontinfo));
271
+  uxg_SetUtf8Fonts(g_fontinfo, NUM_ARRAY(g_fontinfo));
340 272
 }
341 273
 
342 274
 // The kill screen is displayed for unrecoverable conditions
@@ -526,6 +458,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
526 458
       const char *outstr = theCard.longest_filename();
527 459
       if (theCard.longFilename[0]) {
528 460
         #if ENABLED(SCROLL_LONG_FILENAMES)
461
+          static uint8_t filename_scroll_hash;
529 462
           if (isSelected) {
530 463
             uint8_t name_hash = row;
531 464
             for (uint8_t l = FILENAME_LENGTH; l--;)
@@ -682,4 +615,4 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
682 615
 
683 616
 #endif // ULTIPANEL
684 617
 
685
-#endif // __ULTRALCD_IMPL_DOGM_H
618
+#endif // DOGLCD

+ 1
- 4
Marlin/src/lcd/lcdprint.h View File

@@ -6,8 +6,7 @@
6 6
  * @date    2016-08-19
7 7
  * @copyright GPL/BSD
8 8
  */
9
-#ifndef _LCDPRINT_H
10
-#define _LCDPRINT_H
9
+#pragma once
11 10
 
12 11
 #include "fontutils.h"
13 12
 
@@ -56,5 +55,3 @@ inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LE
56 55
 inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
57 56
 
58 57
 inline int lcd_put_wchar(wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
59
-
60
-#endif // _LCDPRINT_H

+ 0
- 13
Marlin/src/lcd/menu/menu.cpp View File

@@ -54,10 +54,6 @@
54 54
   #include "../../libs/duration_t.h"
55 55
 #endif
56 56
 
57
-#if ENABLED(FILAMENT_LCD_DISPLAY)
58
-  #include "../../feature/filwidth.h"
59
-#endif
60
-
61 57
 #if ENABLED(BLTOUCH)
62 58
   #include "../../module/endstops.h"
63 59
 #endif
@@ -75,15 +71,6 @@
75 71
 #endif
76 72
 
77 73
 ////////////////////////////////////////////
78
-///////////////// Externs //////////////////
79
-////////////////////////////////////////////
80
-
81
-// LCD Updates
82
-#if HAS_GRAPHICAL_LCD
83
-  extern bool drawing_screen;
84
-#endif
85
-
86
-////////////////////////////////////////////
87 74
 ///////////// Global Variables /////////////
88 75
 ////////////////////////////////////////////
89 76
 

+ 0
- 10
Marlin/src/lcd/ultralcd.cpp View File

@@ -108,9 +108,6 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed
108 108
 millis_t next_button_update_ms;
109 109
 
110 110
 #if HAS_GRAPHICAL_LCD
111
-  #include <U8glib.h>
112
-  #include "dogm/HAL_LCD_class_defines.h"
113
-  extern U8G_CLASS u8g;
114 111
   bool drawing_screen, first_page; // = false
115 112
 #endif
116 113
 
@@ -124,13 +121,6 @@ millis_t next_button_update_ms;
124 121
 
125 122
 void lcd_status_screen();
126 123
 
127
-#if HAS_LCD_CONTRAST
128
-  void set_lcd_contrast(const int16_t value) {
129
-    lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
130
-    u8g.setContrast(lcd_contrast);
131
-  }
132
-#endif
133
-
134 124
 #if HAS_LCD_MENU
135 125
   #include "menu/menu.h"
136 126
 

+ 150
- 67
Marlin/src/lcd/ultralcd.h View File

@@ -23,18 +23,124 @@
23 23
 
24 24
 #include "../inc/MarlinConfig.h"
25 25
 
26
-#if ENABLED(DOGLCD)
27
-  extern bool first_page;
28
-#else
29
-  constexpr bool first_page = true;
30
-  enum HD44780CharSet : uint8_t {
31
-    CHARSET_MENU,
32
-    CHARSET_INFO,
33
-    CHARSET_BOOT
26
+#if HAS_GRAPHICAL_LCD
27
+
28
+  // LCD selection
29
+  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
30
+    #define U8G_CLASS U8GLIB_ST7920_128X64_4X
31
+    #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
32
+      #define U8G_PARAM LCD_PINS_RS
33
+    #else
34
+      #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
35
+    #endif
36
+
37
+  #elif ENABLED(U8GLIB_ST7920)
38
+    // RepRap Discount Full Graphics Smart Controller
39
+    #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
40
+      #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
41
+      #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
42
+    #else
43
+      //#define U8G_CLASS U8GLIB_ST7920_128X64_4X
44
+      //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS     // Original u8glib device. 2 stripes, SW SPI
45
+      #define U8G_CLASS U8GLIB_ST7920_128X64_RRD
46
+      #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS       // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
47
+                                                                        // AVR version ignores these pin settings
48
+                                                                        // HAL version uses these pin settings
49
+    #endif
50
+
51
+  #elif ENABLED(CARTESIO_UI)
52
+    // The CartesioUI display
53
+    //#define U8G_CLASS U8GLIB_DOGM128_2X
54
+    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
55
+    #define U8G_CLASS U8GLIB_DOGM128_2X
56
+    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
57
+
58
+  #elif ENABLED(U8GLIB_LM6059_AF)
59
+    // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
60
+    //#define U8G_CLASS U8GLIB_LM6059
61
+    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
62
+    #define U8G_CLASS U8GLIB_LM6059_2X
63
+    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
64
+
65
+  #elif ENABLED(U8GLIB_ST7565_64128N)
66
+    // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
67
+    #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
68
+    #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
69
+      #define U8G_CLASS U8GLIB_64128N_2X_HAL
70
+      #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // using HW-SPI
71
+    #else
72
+      #define U8G_CLASS U8GLIB_64128N_2X_HAL
73
+      #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // using SW-SPI
74
+    #endif
75
+
76
+  #elif ENABLED(MKS_12864OLED_SSD1306)
77
+    // MKS 128x64 (SSD1306) OLED I2C LCD
78
+    #define U8G_CLASS U8GLIB_SSD1306_128X64
79
+    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
80
+    //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
81
+    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
82
+
83
+  #elif ENABLED(U8GLIB_SSD1306)
84
+    // Generic support for SSD1306 OLED I2C LCDs
85
+    //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE 
86
+    //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
87
+    #define U8G_CLASS U8GLIB_SSD1306_128X64_2X
88
+    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
89
+
90
+  #elif ENABLED(MKS_12864OLED)
91
+    // MKS 128x64 (SH1106) OLED I2C LCD
92
+    #define U8G_CLASS U8GLIB_SH1106_128X64
93
+    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
94
+    //#define U8G_CLASS U8GLIB_SH1106_128X64_2X
95
+    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
96
+  #elif ENABLED(U8GLIB_SH1106)
97
+    // Generic support for SH1106 OLED I2C LCDs
98
+    //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE 
99
+    //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
100
+    #define U8G_CLASS U8GLIB_SH1106_128X64_2X
101
+    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
102
+  #elif ENABLED(U8GLIB_SSD1309)
103
+    // Generic support for SSD1309 OLED I2C LCDs
104
+    #define U8G_CLASS U8GLIB_SSD1309_128X64
105
+    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
106
+  #elif ENABLED(MINIPANEL)
107
+    // The MINIPanel display
108
+    //#define U8G_CLASS U8GLIB_MINI12864
109
+    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
110
+    #define U8G_CLASS U8GLIB_MINI12864_2X
111
+    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
112
+  #elif ENABLED(U8GLIB_SH1106_EINSTART)
113
+    // Connected via motherboard header
114
+    #define U8G_CLASS U8GLIB_SH1106_128X64
115
+    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
116
+  #else
117
+    // for regular DOGM128 display with HW-SPI
118
+    //#define U8G_CLASS U8GLIB_DOGM128
119
+    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // HW-SPI Com: CS, A0  // 8 stripes
120
+    #define U8G_CLASS U8GLIB_DOGM128_2X
121
+    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // HW-SPI Com: CS, A0 // 4 stripes
122
+  #endif
123
+
124
+  #include <U8glib.h>
125
+  #include "dogm/HAL_LCD_class_defines.h"
126
+  extern U8G_CLASS u8g;
127
+
128
+  enum MarlinFont : uint8_t {
129
+    FONT_STATUSMENU = 1,
130
+    FONT_SPECIAL,
131
+    FONT_MENU_EDIT,
132
+    FONT_MENU,
34 133
   };
35
-#endif
36 134
 
37
-#if ENABLED(ULTRA_LCD) || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
135
+  void lcd_setFont(const MarlinFont font_nr);
136
+
137
+  #if ENABLED(LIGHTWEIGHT_UI)
138
+    void lcd_in_status(const bool inStatus);
139
+  #endif
140
+
141
+#endif // HAS_GRAPHICAL_LCD
142
+
143
+#if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
38 144
   void lcd_init();
39 145
   bool lcd_detected();
40 146
   void lcd_update();
@@ -47,7 +153,7 @@
47 153
   inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
48 154
 #endif
49 155
 
50
-#if ENABLED(ULTRA_LCD)
156
+#if HAS_SPI_LCD
51 157
 
52 158
   #include "../Marlin.h"
53 159
 
@@ -168,72 +274,29 @@
168 274
       float lcd_z_offset_edit();
169 275
     #endif
170 276
 
171
-  #endif
277
+    #if ENABLED(SCROLL_LONG_FILENAMES)
278
+      extern uint8_t filename_scroll_pos, filename_scroll_max;
279
+    #endif
280
+
281
+  #endif // ULTIPANEL
172 282
 
173 283
   #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
174 284
     extern millis_t previous_lcd_status_ms;
175 285
   #endif
176 286
 
177
-  bool lcd_blink();
178
-
179
-  #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
180
-
181
-    #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
182
-
183
-    #define BLEN_REPRAPWORLD_KEYPAD_F3     0
184
-    #define BLEN_REPRAPWORLD_KEYPAD_F2     1
185
-    #define BLEN_REPRAPWORLD_KEYPAD_F1     2
186
-    #define BLEN_REPRAPWORLD_KEYPAD_DOWN   3
187
-    #define BLEN_REPRAPWORLD_KEYPAD_RIGHT  4
188
-    #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
189
-    #define BLEN_REPRAPWORLD_KEYPAD_UP     6
190
-    #define BLEN_REPRAPWORLD_KEYPAD_LEFT   7
191
-
192
-    #define EN_REPRAPWORLD_KEYPAD_F3      (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
193
-    #define EN_REPRAPWORLD_KEYPAD_F2      (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
194
-    #define EN_REPRAPWORLD_KEYPAD_F1      (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
195
-    #define EN_REPRAPWORLD_KEYPAD_DOWN    (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
196
-    #define EN_REPRAPWORLD_KEYPAD_RIGHT   (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
197
-    #define EN_REPRAPWORLD_KEYPAD_MIDDLE  (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
198
-    #define EN_REPRAPWORLD_KEYPAD_UP      (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
199
-    #define EN_REPRAPWORLD_KEYPAD_LEFT    (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
200
-
201
-    #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN  (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
202
-    #define REPRAPWORLD_KEYPAD_MOVE_Z_UP    (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
203
-    #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN  (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)
204
-    #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT)
205
-    #define REPRAPWORLD_KEYPAD_MOVE_Y_UP    (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
206
-    #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT  (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
207
-
208
-    #if ENABLED(ADC_KEYPAD)
209
-      #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1
210
-      #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE
211
-    #else
212
-      #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_MIDDLE
213
-      #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_F1
214
-    #endif
215
-    #define REPRAPWORLD_KEYPAD_MOVE_HOME    (buttons_reprapworld_keypad & KEYPAD_HOME)
216
-    #define REPRAPWORLD_KEYPAD_MOVE_MENU    (buttons_reprapworld_keypad & KEYPAD_EN_C)
217
-
218
-    #define REPRAPWORLD_KEYPAD_PRESSED      (buttons_reprapworld_keypad & ( \
219
-                                              EN_REPRAPWORLD_KEYPAD_F3 | \
220
-                                              EN_REPRAPWORLD_KEYPAD_F2 | \
221
-                                              EN_REPRAPWORLD_KEYPAD_F1 | \
222
-                                              EN_REPRAPWORLD_KEYPAD_DOWN | \
223
-                                              EN_REPRAPWORLD_KEYPAD_RIGHT | \
224
-                                              EN_REPRAPWORLD_KEYPAD_MIDDLE | \
225
-                                              EN_REPRAPWORLD_KEYPAD_UP | \
226
-                                              EN_REPRAPWORLD_KEYPAD_LEFT) \
227
-                                            )
228
-
287
+  #if ENABLED(STATUS_MESSAGE_SCROLLING)
288
+    extern uint8_t status_scroll_offset;
229 289
   #endif
230 290
 
291
+  bool lcd_blink();
292
+
231 293
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
232 294
     bool is_lcd_clicked();
233 295
     void wait_for_release();
234 296
   #endif
235 297
 
236 298
 #elif ENABLED(EXTENSIBLE_UI)
299
+
237 300
   // These functions are defined elsewhere
238 301
   void lcd_setstatus(const char* const message, const bool persist=false);
239 302
   void lcd_setstatusPGM(const char* const message, const int8_t level=0);
@@ -242,6 +305,7 @@
242 305
   void lcd_refresh();
243 306
   void lcd_reset_alert_level();
244 307
   bool lcd_hasstatus();
308
+
245 309
 #else // MALYAN_LCD or no LCD
246 310
 
247 311
   constexpr bool lcd_wait_for_move = false;
@@ -254,11 +318,11 @@
254 318
   inline void lcd_reset_alert_level() {}
255 319
   inline void lcd_reset_status() {}
256 320
 
257
-#endif // ULTRA_LCD
321
+#endif
258 322
 
259
-#if ENABLED(ULTIPANEL)
323
+#if HAS_LCD_MENU
260 324
 
261
-  #if ENABLED(NEWPANEL) // Uses digital switches, not a shift register
325
+  #if HAS_DIGITAL_ENCODER
262 326
 
263 327
     // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
264 328
     #define BLEN_A 0
@@ -305,6 +369,9 @@
305 369
   #define LCD_CLICKED false
306 370
 #endif
307 371
 
372
+extern uint8_t lcd_status_update_delay;
373
+extern char lcd_status_message[];
374
+
308 375
 #define LCD_MESSAGEPGM(x)      lcd_setstatusPGM(PSTR(x))
309 376
 #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatusPGM(PSTR(x))
310 377
 
@@ -320,3 +387,19 @@
320 387
 // LCD implementations
321 388
 void lcd_implementation_clear();
322 389
 void lcd_implementation_init();
390
+
391
+#if HAS_GRAPHICAL_LCD
392
+  extern bool drawing_screen, first_page;
393
+#elif HAS_SPI_LCD
394
+  constexpr bool first_page = true;
395
+#endif
396
+
397
+#if HAS_CHARACTER_LCD
398
+
399
+  enum HD44780CharSet : uint8_t {
400
+    CHARSET_MENU,
401
+    CHARSET_INFO,
402
+    CHARSET_BOOT
403
+  };
404
+
405
+#endif

Loading…
Cancel
Save