Browse Source

Group status methods, share reset_status with Extensible UI (#12414)

* Group status methods, share reset_status with Extensible UI
* Move common DOGM code to headers
Scott Lahteine 5 years ago
parent
commit
0ee1a92971
No account linked to committer's email address

+ 2
- 4
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp View File

@@ -94,10 +94,8 @@ void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
94 94
   else port->PIO_CODR = mask;
95 95
 }
96 96
 
97
-uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
98
-{
99
-  switch(msg)
100
-  {
97
+uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
98
+  switch(msg) {
101 99
     case U8G_COM_MSG_STOP:
102 100
       break;
103 101
 

+ 1
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -1687,6 +1687,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
1687 1687
       && DISABLED(MKS_12864OLED_SSD1306) ) \
1688 1688
   + (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(BQ_LCD_SMART_CONTROLLER)) \
1689 1689
   + ENABLED(LCD_FOR_MELZI) \
1690
+  + ENABLED(MALYAN_LCD) \
1690 1691
   + ENABLED(MKS_12864OLED) \
1691 1692
   + ENABLED(MKS_12864OLED_SSD1306) \
1692 1693
   + ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \

+ 1
- 1
Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp View File

@@ -19,7 +19,7 @@
19 19
 #include "../ultralcd.h"
20 20
 #include "../../Marlin.h"
21 21
 
22
-#include "ultralcd_common_HD44780.h"
22
+#include "ultralcd_HD44780.h"
23 23
 
24 24
 #include <string.h>
25 25
 

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

@@ -31,7 +31,7 @@
31 31
  * These are the most common LCD character displays.
32 32
  */
33 33
 
34
-#include "ultralcd_common_HD44780.h"
34
+#include "ultralcd_HD44780.h"
35 35
 #include "../ultralcd.h"
36 36
 
37 37
 #include "../../sd/cardreader.h"

Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h → Marlin/src/lcd/HD44780/ultralcd_HD44780.h View File


+ 40
- 33
Marlin/src/lcd/dogm/HAL_LCD_class_defines.h View File

@@ -21,56 +21,63 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
+#include "../../inc/MarlinConfig.h"
25
+
24 26
 // use this file to create the public interface for device drivers that are NOT in the U8G library
25 27
 
26 28
 extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi;
27 29
 extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi;
28
-class U8GLIB_64128N_2X_HAL : public U8GLIB
29
-{
30
-  public:
31
-    U8GLIB_64128N_2X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
32
-      : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset)
33
-      { }
34
-    U8GLIB_64128N_2X_HAL(pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
35
-      : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset)
36
-      { }
30
+
31
+class U8GLIB_64128N_2X_HAL : public U8GLIB {
32
+public:
33
+  U8GLIB_64128N_2X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
34
+    : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset)
35
+    { }
36
+  U8GLIB_64128N_2X_HAL(pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
37
+    : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset)
38
+    { }
37 39
 };
38 40
 
39 41
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi;
40 42
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi;
41
-class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB
42
-{
43
-  public:
44
-    U8GLIB_ST7920_128X64_4X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
45
-      : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)    // a0 = U8G_PIN_NONE
46
-      { }
47
-    U8GLIB_ST7920_128X64_4X_HAL(pin_t cs, pin_t reset = U8G_PIN_NONE)
48
-      : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)   // a0 = U8G_PIN_NONE
49
-      { }
43
+
44
+class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB {
45
+public:
46
+  U8GLIB_ST7920_128X64_4X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
47
+    : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)    // a0 = U8G_PIN_NONE
48
+    { }
49
+  U8GLIB_ST7920_128X64_4X_HAL(pin_t cs, pin_t reset = U8G_PIN_NONE)
50
+    : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)   // a0 = U8G_PIN_NONE
51
+    { }
50 52
 };
51 53
 
52
-// AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp, HAL version uses u8g_dev_st7920_128x64_HAL.cpp
54
+//
55
+// AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp
56
+// HAL version uses u8g_dev_st7920_128x64_HAL.cpp
57
+//
53 58
 extern u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi;
54
-class U8GLIB_ST7920_128X64_RRD : public U8GLIB
55
-{
56
-  public:
57
-    U8GLIB_ST7920_128X64_RRD(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
58
-      : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)   // a0 = U8G_PIN_NONE
59
-      { }
59
+
60
+class U8GLIB_ST7920_128X64_RRD : public U8GLIB {
61
+public:
62
+  U8GLIB_ST7920_128X64_RRD(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
63
+    : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset)   // a0 = U8G_PIN_NONE
64
+    { }
60 65
 };
61 66
 
62 67
 extern u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire;
68
+
63 69
 class U8GLIB_SH1106_128X64_2X_I2C_2_WIRE : public U8GLIB {
64
-  public:
65
-    U8GLIB_SH1106_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE)
66
-    : U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c_2_wire, options)
67
-    {  }
70
+public:
71
+  U8GLIB_SH1106_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE)
72
+  : U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c_2_wire, options)
73
+  {  }
68 74
 };
69 75
 
70 76
 extern u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire;
77
+
71 78
 class U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE : public U8GLIB {
72
-  public:
73
-    U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE)
74
-    : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options)
75
-    {  }
79
+public:
80
+  U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE)
81
+  : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options)
82
+  {  }
76 83
 };

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

@@ -30,8 +30,10 @@
30 30
 #if HAS_GRAPHICAL_LCD && DISABLED(LIGHTWEIGHT_UI)
31 31
 
32 32
 #include "dogm_Statusscreen.h"
33
+#include "ultralcd_DOGM.h"
33 34
 #include "../ultralcd.h"
34 35
 #include "../lcdprint.h"
36
+
35 37
 #include "../../module/motion.h"
36 38
 #include "../../module/temperature.h"
37 39
 

+ 34
- 16
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp View File

@@ -45,7 +45,7 @@
45 45
 
46 46
 #if ENABLED(LIGHTWEIGHT_UI)
47 47
 
48
-#include "status_screen_lite_ST7920_class.h"
48
+#include "status_screen_lite_ST7920.h"
49 49
 
50 50
 #include "../ultralcd.h"
51 51
 #include "../fontutils.h"
@@ -916,8 +916,7 @@ void ST7920_Lite_Status_Screen::on_exit() {
916 916
 }
917 917
 
918 918
 // This is called prior to the KILL screen to
919
-// clear the screen so we don't end up with a
920
-// garbled display.
919
+// clear the screen, preventing a garbled display.
921 920
 void ST7920_Lite_Status_Screen::clear_text_buffer() {
922 921
   cs();
923 922
   reset_state_from_unknown();
@@ -926,23 +925,42 @@ void ST7920_Lite_Status_Screen::clear_text_buffer() {
926 925
   ncs();
927 926
 }
928 927
 
928
+#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
929
+
930
+  #include "ultralcd_st7920_u8glib_rrd_AVR.h"
931
+
932
+  void ST7920_Lite_Status_Screen::cs() {
933
+    ST7920_CS();
934
+    current_bits.synced = false;
935
+  }
936
+
937
+  void ST7920_Lite_Status_Screen::ncs() {
938
+    ST7920_NCS();
939
+    current_bits.synced = false;
940
+  }
941
+
942
+  void ST7920_Lite_Status_Screen::sync_cmd() {
943
+    ST7920_SET_CMD();
944
+  }
945
+
946
+  void ST7920_Lite_Status_Screen::sync_dat() {
947
+    ST7920_SET_DAT();
948
+  }
949
+
950
+  void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) {
951
+    ST7920_WRITE_BYTE(data);
952
+  }
953
+
954
+#endif
955
+
929 956
 void MarlinUI::draw_status_screen() {
930 957
   ST7920_Lite_Status_Screen::update(false);
931 958
 }
932 959
 
933
-/**
934
- * In order to properly update the lite Status Screen,
935
- * we must know when we have entered and left the
936
- * Status Screen. Since the ultralcd code is not
937
- * set up for doing this, we call this function before
938
- * each update indicating whether the current screen
939
- * is the Status Screen.
940
- *
941
- * This function keeps track of whether we have left or
942
- * entered the Status Screen and calls the on_entry()
943
- * and on_exit() methods for cleanup.
944
- */
945
-void lcd_in_status(const bool inStatus) {
960
+// This method is called before each screen update and
961
+// fires on_entry() and on_exit() events upon entering
962
+// or exiting the Status Screen.
963
+void MarlinUI::lcd_in_status(const bool inStatus) {
946 964
   static bool lastInStatus = false;
947 965
   if (lastInStatus == inStatus) return;
948 966
   if ((lastInStatus = inStatus))

Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h → Marlin/src/lcd/dogm/status_screen_lite_ST7920.h View File


+ 0
- 39
Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h View File

@@ -1,39 +0,0 @@
1
-/**
2
- * Lightweight Status Screen for the RepRapDiscount Full
3
- * Graphics Smart Controller (ST7920-based 128x64 LCD)
4
- *
5
- * (c) 2017 Aleph Objects, Inc.
6
- *
7
- * The code in this page is free software: you can
8
- * redistribute it and/or modify it under the terms of the GNU
9
- * General Public License (GNU GPL) as published by the Free Software
10
- * Foundation, either version 3 of the License, or (at your option)
11
- * any later version.  The code is distributed WITHOUT ANY WARRANTY;
12
- * without even the implied warranty of MERCHANTABILITY or FITNESS
13
- * FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
14
- *
15
- */
16
-
17
-#include "status_screen_lite_ST7920_class.h"
18
-
19
-void ST7920_Lite_Status_Screen::cs() {
20
-  ST7920_CS();
21
-  current_bits.synced = false;
22
-}
23
-
24
-void ST7920_Lite_Status_Screen::ncs() {
25
-  ST7920_NCS();
26
-  current_bits.synced = false;
27
-}
28
-
29
-void ST7920_Lite_Status_Screen::sync_cmd() {
30
-  ST7920_SET_CMD();
31
-}
32
-
33
-void ST7920_Lite_Status_Screen::sync_dat() {
34
-  ST7920_SET_DAT();
35
-}
36
-
37
-void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) {
38
-  ST7920_WRITE_BYTE(data);
39
-}

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

@@ -39,14 +39,13 @@
39 39
 
40 40
 #if HAS_GRAPHICAL_LCD
41 41
 
42
-#include "../ultralcd.h"
43
-
44
-#include <U8glib.h>
45
-#include "HAL_LCD_class_defines.h"
42
+#include "ultralcd_DOGM.h"
46 43
 #include "u8g_fontutf8.h"
44
+#include "dogm_Bootscreen.h"
45
+
47 46
 #include "../lcdprint.h"
48 47
 #include "../fontutils.h"
49
-#include "dogm_Bootscreen.h"
48
+#include "../ultralcd.h"
50 49
 
51 50
 #include "../../sd/cardreader.h"
52 51
 #include "../../module/temperature.h"
@@ -177,7 +176,7 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
177 176
 #endif // SHOW_BOOTSCREEN
178 177
 
179 178
 #if ENABLED(LIGHTWEIGHT_UI)
180
-  #include "status_screen_lite_ST7920_class.h"
179
+  #include "status_screen_lite_ST7920.h"
181 180
 #endif
182 181
 
183 182
 // Initialize or re-initialize the LCD

+ 174
- 0
Marlin/src/lcd/dogm/ultralcd_DOGM.h View File

@@ -0,0 +1,174 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * ultralcd_impl_DOGM.h
25
+ */
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#include <U8glib.h>
30
+#include "HAL_LCD_class_defines.h"
31
+
32
+// LCD selection
33
+#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
34
+  #define U8G_CLASS U8GLIB_ST7920_128X64_4X
35
+  #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
36
+    #define U8G_PARAM LCD_PINS_RS
37
+  #else
38
+    #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
39
+  #endif
40
+
41
+#elif ENABLED(U8GLIB_ST7920)
42
+  // RepRap Discount Full Graphics Smart Controller
43
+  #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
44
+    #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
45
+    #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
46
+  #else
47
+    //#define U8G_CLASS U8GLIB_ST7920_128X64_4X
48
+    //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS     // Original u8glib device. 2 stripes, SW SPI
49
+    #define U8G_CLASS U8GLIB_ST7920_128X64_RRD
50
+    #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
51
+                                                                      // AVR version ignores these pin settings
52
+                                                                      // HAL version uses these pin settings
53
+  #endif
54
+
55
+#elif ENABLED(CARTESIO_UI)
56
+  // The CartesioUI display
57
+  //#define U8G_CLASS U8GLIB_DOGM128_2X
58
+  //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
59
+  #define U8G_CLASS U8GLIB_DOGM128_2X
60
+  #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
61
+
62
+#elif ENABLED(U8GLIB_LM6059_AF)
63
+  // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
64
+  //#define U8G_CLASS U8GLIB_LM6059
65
+  //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
66
+  #define U8G_CLASS U8GLIB_LM6059_2X
67
+  #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
68
+
69
+#elif ENABLED(U8GLIB_ST7565_64128N)
70
+  // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
71
+  #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
72
+  #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
73
+    #define U8G_CLASS U8GLIB_64128N_2X_HAL
74
+    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // using HW-SPI
75
+  #else
76
+    #define U8G_CLASS U8GLIB_64128N_2X_HAL
77
+    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // using SW-SPI
78
+  #endif
79
+
80
+#elif ENABLED(MKS_12864OLED_SSD1306)
81
+  // MKS 128x64 (SSD1306) OLED I2C LCD
82
+  #define U8G_CLASS U8GLIB_SSD1306_128X64
83
+  #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
84
+  //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
85
+  //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
86
+
87
+#elif ENABLED(U8GLIB_SSD1306)
88
+  // Generic support for SSD1306 OLED I2C LCDs
89
+  //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
90
+  //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
91
+  #define U8G_CLASS U8GLIB_SSD1306_128X64_2X
92
+  #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
93
+
94
+#elif ENABLED(MKS_12864OLED)
95
+  // MKS 128x64 (SH1106) OLED I2C LCD
96
+  #define U8G_CLASS U8GLIB_SH1106_128X64
97
+  #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
98
+  //#define U8G_CLASS U8GLIB_SH1106_128X64_2X
99
+  //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
100
+#elif ENABLED(U8GLIB_SH1106)
101
+  // Generic support for SH1106 OLED I2C LCDs
102
+  //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
103
+  //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
104
+  #define U8G_CLASS U8GLIB_SH1106_128X64_2X
105
+  #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
106
+#elif ENABLED(U8GLIB_SSD1309)
107
+  // Generic support for SSD1309 OLED I2C LCDs
108
+  #define U8G_CLASS U8GLIB_SSD1309_128X64
109
+  #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
110
+#elif ENABLED(MINIPANEL)
111
+  // The MINIPanel display
112
+  //#define U8G_CLASS U8GLIB_MINI12864
113
+  //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
114
+  #define U8G_CLASS U8GLIB_MINI12864_2X
115
+  #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
116
+#elif ENABLED(U8GLIB_SH1106_EINSTART)
117
+  // Connected via motherboard header
118
+  #define U8G_CLASS U8GLIB_SH1106_128X64
119
+  #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
120
+#else
121
+  // for regular DOGM128 display with HW-SPI
122
+  //#define U8G_CLASS U8GLIB_DOGM128
123
+  //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // HW-SPI Com: CS, A0  // 8 stripes
124
+  #define U8G_CLASS U8GLIB_DOGM128_2X
125
+  #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // HW-SPI Com: CS, A0 // 4 stripes
126
+#endif
127
+
128
+#ifndef LCD_PIXEL_WIDTH
129
+  #define LCD_PIXEL_WIDTH 128
130
+#endif
131
+#ifndef LCD_PIXEL_HEIGHT
132
+  #define LCD_PIXEL_HEIGHT 64
133
+#endif
134
+
135
+// For selective rendering within a Y range
136
+#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
137
+#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
138
+
139
+// Only Western languages support big / small fonts
140
+#if DISABLED(DISPLAY_CHARSET_ISO10646_1)
141
+  #undef USE_BIG_EDIT_FONT
142
+  #undef USE_SMALL_INFOFONT
143
+#endif
144
+
145
+#define MENU_FONT_NAME    ISO10646_1_5x7
146
+#define MENU_FONT_WIDTH    6
147
+#define MENU_FONT_ASCENT  10
148
+#define MENU_FONT_DESCENT  2
149
+#define MENU_FONT_HEIGHT  (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
150
+
151
+#if ENABLED(USE_BIG_EDIT_FONT)
152
+  #define EDIT_FONT_NAME    u8g_font_9x18
153
+  #define EDIT_FONT_WIDTH    9
154
+  #define EDIT_FONT_ASCENT  10
155
+  #define EDIT_FONT_DESCENT  3
156
+#else
157
+  #define EDIT_FONT_NAME    MENU_FONT_NAME
158
+  #define EDIT_FONT_WIDTH   MENU_FONT_WIDTH
159
+  #define EDIT_FONT_ASCENT  MENU_FONT_ASCENT
160
+  #define EDIT_FONT_DESCENT MENU_FONT_DESCENT
161
+#endif
162
+#define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
163
+
164
+// Get the Ascent, Descent, and total Height for the Info Screen font
165
+#if ENABLED(USE_SMALL_INFOFONT)
166
+  extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
167
+  #define INFO_FONT_ASCENT 7
168
+#else
169
+  #define INFO_FONT_ASCENT 8
170
+#endif
171
+#define INFO_FONT_DESCENT 2
172
+#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
173
+
174
+extern U8G_CLASS u8g;

+ 8
- 74
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp View File

@@ -27,60 +27,7 @@
27 27
 
28 28
 #if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
29 29
 
30
-#include "../../HAL/shared/Delay.h"
31
-
32
-#define ST7920_CLK_PIN  LCD_PINS_D4
33
-#define ST7920_DAT_PIN  LCD_PINS_ENABLE
34
-#define ST7920_CS_PIN   LCD_PINS_RS
35
-
36
-//#define PAGE_HEIGHT 8   //128 byte framebuffer
37
-#define PAGE_HEIGHT 16  //256 byte framebuffer
38
-//#define PAGE_HEIGHT 32  //512 byte framebuffer
39
-
40
-#define LCD_PIXEL_WIDTH 128
41
-#define LCD_PIXEL_HEIGHT 64
42
-
43
-#include <U8glib.h>
44
-
45
-//set optimization so ARDUINO optimizes this file
46
-#pragma GCC optimize (3)
47
-
48
-// If you want you can define your own set of delays in Configuration.h
49
-//#define ST7920_DELAY_1 DELAY_NS(0)
50
-//#define ST7920_DELAY_2 DELAY_NS(0)
51
-//#define ST7920_DELAY_3 DELAY_NS(0)
52
-
53
-#if F_CPU >= 20000000
54
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
55
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
56
-  #define CPU_ST7920_DELAY_3 DELAY_NS(50)
57
-#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE)
58
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
59
-  #define CPU_ST7920_DELAY_2 DELAY_NS(188)
60
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
61
-#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) || MB(EINSY_RETRO)
62
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
63
-  #define CPU_ST7920_DELAY_2 DELAY_NS(250)
64
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
65
-#elif MB(RAMBO)
66
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
67
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
68
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
69
-#elif MB(BQ_ZUM_MEGA_3D)
70
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
71
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
72
-  #define CPU_ST7920_DELAY_3 DELAY_NS(189)
73
-#elif defined(ARDUINO_ARCH_STM32)
74
-  #define CPU_ST7920_DELAY_1 DELAY_NS(300)
75
-  #define CPU_ST7920_DELAY_2 DELAY_NS(40)
76
-  #define CPU_ST7920_DELAY_3 DELAY_NS(340)
77
-#elif F_CPU == 16000000
78
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
79
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
80
-  #define CPU_ST7920_DELAY_3 DELAY_NS(63)
81
-#else
82
-  #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'"
83
-#endif
30
+#include "ultralcd_st7920_u8glib_rrd_AVR.h"
84 31
 
85 32
 #ifndef ST7920_DELAY_1
86 33
   #define ST7920_DELAY_1 CPU_ST7920_DELAY_1
@@ -92,13 +39,19 @@
92 39
   #define ST7920_DELAY_3 CPU_ST7920_DELAY_3
93 40
 #endif
94 41
 
42
+// Optimize this code with -O3
43
+#pragma GCC optimize (3)
44
+
95 45
 #define ST7920_SND_BIT \
96 46
   WRITE(ST7920_CLK_PIN, LOW);        ST7920_DELAY_1; \
97 47
   WRITE(ST7920_DAT_PIN, val & 0x80); ST7920_DELAY_2; \
98 48
   WRITE(ST7920_CLK_PIN, HIGH);       ST7920_DELAY_3; \
99 49
   val <<= 1
100 50
 
101
-static void ST7920_SWSPI_SND_8BIT(uint8_t val) {
51
+// Optimize this code with -O3
52
+#pragma GCC optimize (3)
53
+
54
+void ST7920_SWSPI_SND_8BIT(uint8_t val) {
102 55
   ST7920_SND_BIT; // 1
103 56
   ST7920_SND_BIT; // 2
104 57
   ST7920_SND_BIT; // 3
@@ -109,19 +62,6 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val) {
109 62
   ST7920_SND_BIT; // 8
110 63
 }
111 64
 
112
-#if DOGM_SPI_DELAY_US > 0
113
-  #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US)
114
-#else
115
-  #define U8G_DELAY() DELAY_US(10)
116
-#endif
117
-
118
-#define ST7920_CS()              { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); }
119
-#define ST7920_NCS()             { WRITE(ST7920_CS_PIN,0); }
120
-#define ST7920_SET_CMD()         { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); }
121
-#define ST7920_SET_DAT()         { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
122
-#define ST7920_WRITE_BYTE(a)     { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); }
123
-#define ST7920_WRITE_BYTES(p,l)  { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); }
124
-
125 65
 uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
126 66
   uint8_t i, y;
127 67
   switch (msg) {
@@ -192,12 +132,6 @@ uint8_t   u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U
192 132
 u8g_pb_t  u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf};
193 133
 u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn};
194 134
 
195
-#if ENABLED(LIGHTWEIGHT_UI)
196
-  // We have to include the code for the lightweight UI here
197
-  // as it relies on macros that are only defined in this file.
198
-  #include "status_screen_lite_ST7920_spi.h"
199
-#endif
200
-
201 135
 #pragma GCC reset_options
202 136
 
203 137
 #endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__

+ 97
- 0
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h View File

@@ -0,0 +1,97 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+// NOTE - the HAL version of the rrd device uses a generic ST7920 device.  See the
24
+// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
25
+
26
+#include "../../inc/MarlinConfig.h"
27
+
28
+#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
29
+
30
+#include "../../HAL/shared/Delay.h"
31
+
32
+#define ST7920_CLK_PIN  LCD_PINS_D4
33
+#define ST7920_DAT_PIN  LCD_PINS_ENABLE
34
+#define ST7920_CS_PIN   LCD_PINS_RS
35
+
36
+//#define PAGE_HEIGHT 8   //128 byte framebuffer
37
+#define PAGE_HEIGHT 16  //256 byte framebuffer
38
+//#define PAGE_HEIGHT 32  //512 byte framebuffer
39
+
40
+#define LCD_PIXEL_WIDTH 128
41
+#define LCD_PIXEL_HEIGHT 64
42
+
43
+#include <U8glib.h>
44
+
45
+// If you want you can define your own set of delays in Configuration.h
46
+//#define ST7920_DELAY_1 DELAY_NS(0)
47
+//#define ST7920_DELAY_2 DELAY_NS(0)
48
+//#define ST7920_DELAY_3 DELAY_NS(0)
49
+
50
+#if F_CPU >= 20000000
51
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
52
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
53
+  #define CPU_ST7920_DELAY_3 DELAY_NS(50)
54
+#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE)
55
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
56
+  #define CPU_ST7920_DELAY_2 DELAY_NS(188)
57
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
58
+#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) || MB(EINSY_RETRO)
59
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
60
+  #define CPU_ST7920_DELAY_2 DELAY_NS(250)
61
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
62
+#elif MB(RAMBO)
63
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
64
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
65
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
66
+#elif MB(BQ_ZUM_MEGA_3D)
67
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
68
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
69
+  #define CPU_ST7920_DELAY_3 DELAY_NS(189)
70
+#elif defined(ARDUINO_ARCH_STM32)
71
+  #define CPU_ST7920_DELAY_1 DELAY_NS(300)
72
+  #define CPU_ST7920_DELAY_2 DELAY_NS(40)
73
+  #define CPU_ST7920_DELAY_3 DELAY_NS(340)
74
+#elif F_CPU == 16000000
75
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
76
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
77
+  #define CPU_ST7920_DELAY_3 DELAY_NS(63)
78
+#else
79
+  #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'"
80
+#endif
81
+
82
+void ST7920_SWSPI_SND_8BIT(uint8_t val);
83
+
84
+#if DOGM_SPI_DELAY_US > 0
85
+  #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US)
86
+#else
87
+  #define U8G_DELAY() DELAY_US(10)
88
+#endif
89
+
90
+#define ST7920_CS()              { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); }
91
+#define ST7920_NCS()             { WRITE(ST7920_CS_PIN,0); }
92
+#define ST7920_SET_CMD()         { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); }
93
+#define ST7920_SET_DAT()         { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
94
+#define ST7920_WRITE_BYTE(a)     { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); }
95
+#define ST7920_WRITE_BYTES(p,l)  { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); }
96
+
97
+#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__

+ 4
- 26
Marlin/src/lcd/extensible_ui/ui_api.cpp View File

@@ -45,6 +45,7 @@
45 45
 
46 46
 #if ENABLED(EXTENSIBLE_UI)
47 47
 
48
+#include "../ultralcd.h"
48 49
 #include "../../gcode/queue.h"
49 50
 #include "../../module/motion.h"
50 51
 #include "../../module/planner.h"
@@ -712,32 +713,9 @@ void MarlinUI::update() {
712 713
   UI::onIdle();
713 714
 }
714 715
 
715
-bool MarlinUI::hasstatus() { return true; }
716
-bool MarlinUI::detected() { return true; }
717
-void MarlinUI::reset_alert_level() { }
718
-void MarlinUI::refresh() { }
719
-void MarlinUI::setstatus(const char * const message, const bool persist /* = false */) { UI::onStatusChanged(message); }
720
-void MarlinUI::setstatusPGM(const char * const message, int8_t level /* = 0 */)        { UI::onStatusChanged((progmem_str)message); }
721
-void MarlinUI::setalertstatusPGM(const char * const message)                    { setstatusPGM(message, 0); }
722
-
723
-void MarlinUI::reset_status() {
724
-  static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
725
-  static const char printing[] PROGMEM = MSG_PRINTING;
726
-  static const char welcome[] PROGMEM = WELCOME_MSG;
727
-  PGM_P msg;
728
-  if (print_job_timer.isPaused())
729
-    msg = paused;
730
-  #if ENABLED(SDSUPPORT)
731
-    else if (IS_SD_PRINTING())
732
-      return setstatus(card.longest_filename(), true);
733
-  #endif
734
-  else if (print_job_timer.isRunning())
735
-    msg = printing;
736
-  else
737
-    msg = welcome;
738
-
739
-  setstatusPGM(msg, -1);
740
-}
716
+void MarlinUI::setstatus(const char * const message, const bool persist/*=false*/)  { UI::onStatusChanged(message); }
717
+void MarlinUI::setstatusPGM(PGM_P const message, int8_t level/*=0*/)                { UI::onStatusChanged((progmem_str)message); }
718
+void MarlinUI::setalertstatusPGM(PGM_P const message)                               { setstatusPGM(message, 0); }
741 719
 
742 720
 void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
743 721
   char buff[64];

+ 5
- 4
Marlin/src/lcd/malyanlcd.cpp View File

@@ -45,6 +45,7 @@
45 45
 
46 46
 #if ENABLED(MALYAN_LCD)
47 47
 
48
+#include "ultralcd.h"
48 49
 #include "../module/temperature.h"
49 50
 #include "../module/planner.h"
50 51
 #include "../module/stepper.h"
@@ -479,10 +480,10 @@ void MarlinUI::init() {
479 480
 /**
480 481
  * Set an alert.
481 482
  */
482
-void MarlinUI::setalertstatusPGM(PGM_P message) {
483
-  char message_buffer[MAX_CURLY_COMMAND];
484
-  sprintf_P(message_buffer, PSTR("{E:%s}"), message);
485
-  write_to_lcd(message_buffer);
483
+void MarlinUI::setalertstatusPGM(PGM_P const message) {
484
+  write_to_lcd_P(PSTR("{E:"));
485
+  write_to_lcd_P(message);
486
+  write_to_lcd_P("}");
486 487
 }
487 488
 
488 489
 #endif // MALYAN_LCD

+ 146
- 143
Marlin/src/lcd/ultralcd.cpp View File

@@ -22,48 +22,35 @@
22 22
 
23 23
 #include "../inc/MarlinConfigPre.h"
24 24
 
25
-#if HAS_SPI_LCD
26
-
27
-#include <stdarg.h>
25
+// These displays all share the MarlinUI class
26
+#if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
27
+  #include "ultralcd.h"
28
+  MarlinUI ui;
29
+#endif
28 30
 
29
-#include "ultralcd.h"
31
+#if HAS_SPI_LCD
30 32
 
31
-MarlinUI ui;
33
+#if HAS_GRAPHICAL_LCD
34
+  #include "dogm/ultralcd_DOGM.h"
35
+#endif
32 36
 
33 37
 #include "lcdprint.h"
34 38
 
35 39
 #include "../sd/cardreader.h"
36 40
 #include "../module/temperature.h"
37 41
 #include "../module/planner.h"
38
-#include "../module/stepper.h"
39
-#include "../module/motion.h"
40
-#include "../module/probe.h"
41 42
 #include "../module/printcounter.h"
42
-#include "../gcode/gcode.h"
43
+#include "../module/motion.h"
43 44
 #include "../gcode/queue.h"
44
-#include "../module/configuration_store.h"
45
-#include "../module/tool_change.h"
46 45
 
47 46
 #include "../Marlin.h"
48 47
 
49
-#if ENABLED(ADVANCED_PAUSE_FEATURE)
50
-  #include "../feature/pause.h"
51
-#endif
52
-
53 48
 #if ENABLED(POWER_LOSS_RECOVERY)
54
-  #include "../feature/power_loss_recovery.h"
55
-#endif
56
-
57
-#if ENABLED(PRINTCOUNTER) && ENABLED(LCD_INFO_MENU)
58
-  #include "../libs/duration_t.h"
59
-#endif
60
-
61
-#if ENABLED(BLTOUCH)
62
-  #include "../module/endstops.h"
49
+ #include "../feature/power_loss_recovery.h"
63 50
 #endif
64 51
 
65
-#if HAS_LEVELING
66
-  #include "../feature/bedlevel/bedlevel.h"
52
+#if ENABLED(AUTO_BED_LEVELING_UBL)
53
+ #include "../feature/bedlevel/bedlevel.h"
67 54
 #endif
68 55
 
69 56
 #if DISABLED(LCD_USE_I2C_BUZZER)
@@ -454,28 +441,6 @@ void MarlinUI::status_screen() {
454 441
   draw_status_screen();
455 442
 }
456 443
 
457
-/**
458
- * Reset the status message
459
- */
460
-void MarlinUI::reset_status() {
461
-  static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
462
-  static const char printing[] PROGMEM = MSG_PRINTING;
463
-  static const char welcome[] PROGMEM = WELCOME_MSG;
464
-  PGM_P msg;
465
-  if (print_job_timer.isPaused())
466
-    msg = paused;
467
-  #if ENABLED(SDSUPPORT)
468
-    else if (IS_SD_PRINTING())
469
-      return setstatus(card.longest_filename(), true);
470
-  #endif
471
-  else if (print_job_timer.isRunning())
472
-    msg = printing;
473
-  else
474
-    msg = welcome;
475
-
476
-  setstatusPGM(msg, -1);
477
-}
478
-
479 444
 void MarlinUI::kill_screen(PGM_P lcd_msg) {
480 445
   init();
481 446
   setalertstatusPGM(lcd_msg);
@@ -507,6 +472,10 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
507 472
   #endif
508 473
 }
509 474
 
475
+////////////////////////////////////////////
476
+/////////////// Manual Move ////////////////
477
+////////////////////////////////////////////
478
+
510 479
 #if HAS_LCD_MENU
511 480
 
512 481
   extern bool no_reentry; // Flag to prevent recursion into menu handlers
@@ -891,101 +860,6 @@ void MarlinUI::update() {
891 860
   } // ELAPSED(ms, next_lcd_update_ms)
892 861
 }
893 862
 
894
-void MarlinUI::finishstatus(const bool persist) {
895
-
896
-  #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
897
-    UNUSED(persist);
898
-  #endif
899
-
900
-  #if ENABLED(LCD_PROGRESS_BAR)
901
-    progress_bar_ms = millis();
902
-    #if PROGRESS_MSG_EXPIRE > 0
903
-      expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
904
-    #endif
905
-  #endif
906
-
907
-  #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
908
-    next_filament_display = millis() + 5000UL; // Show status message for 5s
909
-  #endif
910
-
911
-  #if ENABLED(STATUS_MESSAGE_SCROLLING)
912
-    status_scroll_offset = 0;
913
-  #endif
914
-
915
-  refresh();
916
-}
917
-
918
-bool MarlinUI::hasstatus() { return (status_message[0] != '\0'); }
919
-
920
-void MarlinUI::setstatus(const char * const message, const bool persist) {
921
-  if (status_message_level > 0) return;
922
-
923
-  // Here we have a problem. The message is encoded in UTF8, so
924
-  // arbitrarily cutting it will be a problem. We MUST be sure
925
-  // that there is no cutting in the middle of a multibyte character!
926
-
927
-  // Get a pointer to the null terminator
928
-  const char* pend = message + strlen(message);
929
-
930
-  //  If length of supplied UTF8 string is greater than
931
-  // our buffer size, start cutting whole UTF8 chars
932
-  while ((pend - message) > MAX_MESSAGE_LENGTH) {
933
-    --pend;
934
-    while (!START_OF_UTF8_CHAR(*pend)) --pend;
935
-  };
936
-
937
-  // At this point, we have the proper cut point. Use it
938
-  uint8_t maxLen = pend - message;
939
-  strncpy(status_message, message, maxLen);
940
-  status_message[maxLen] = '\0';
941
-
942
-  finishstatus(persist);
943
-}
944
-
945
-void MarlinUI::setstatusPGM(PGM_P const message, int8_t level) {
946
-  if (level < 0) level = status_message_level = 0;
947
-  if (level < status_message_level) return;
948
-  status_message_level = level;
949
-
950
-  // Here we have a problem. The message is encoded in UTF8, so
951
-  // arbitrarily cutting it will be a problem. We MUST be sure
952
-  // that there is no cutting in the middle of a multibyte character!
953
-
954
-  // Get a pointer to the null terminator
955
-  PGM_P pend = message + strlen_P(message);
956
-
957
-  //  If length of supplied UTF8 string is greater than
958
-  // our buffer size, start cutting whole UTF8 chars
959
-  while ((pend - message) > MAX_MESSAGE_LENGTH) {
960
-    --pend;
961
-    while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend;
962
-  };
963
-
964
-  // At this point, we have the proper cut point. Use it
965
-  uint8_t maxLen = pend - message;
966
-  strncpy_P(status_message, message, maxLen);
967
-  status_message[maxLen] = '\0';
968
-
969
-  finishstatus(level > 0);
970
-}
971
-
972
-void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
973
-  if (level < status_message_level) return;
974
-  status_message_level = level;
975
-  va_list args;
976
-  va_start(args, fmt);
977
-  vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
978
-  va_end(args);
979
-  finishstatus(level > 0);
980
-}
981
-
982
-void MarlinUI::setalertstatusPGM(PGM_P const message) {
983
-  setstatusPGM(message, 1);
984
-  #if HAS_LCD_MENU
985
-    return_to_status();
986
-  #endif
987
-}
988
-
989 863
 #if ENABLED(ADC_KEYPAD)
990 864
 
991 865
   typedef struct {
@@ -1185,4 +1059,133 @@ void MarlinUI::setalertstatusPGM(PGM_P const message) {
1185 1059
 
1186 1060
 #endif // HAS_ENCODER_ACTION
1187 1061
 
1062
+////////////////////////////////////////////
1063
+/////////////// Status Line ////////////////
1064
+////////////////////////////////////////////
1065
+
1066
+void MarlinUI::finishstatus(const bool persist) {
1067
+
1068
+  #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
1069
+    UNUSED(persist);
1070
+  #endif
1071
+
1072
+  #if ENABLED(LCD_PROGRESS_BAR)
1073
+    progress_bar_ms = millis();
1074
+    #if PROGRESS_MSG_EXPIRE > 0
1075
+      expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1076
+    #endif
1077
+  #endif
1078
+
1079
+  #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
1080
+    next_filament_display = millis() + 5000UL; // Show status message for 5s
1081
+  #endif
1082
+
1083
+  #if ENABLED(STATUS_MESSAGE_SCROLLING)
1084
+    status_scroll_offset = 0;
1085
+  #endif
1086
+
1087
+  refresh();
1088
+}
1089
+
1090
+bool MarlinUI::hasstatus() { return (status_message[0] != '\0'); }
1091
+
1092
+void MarlinUI::setstatus(const char * const message, const bool persist) {
1093
+  if (status_message_level > 0) return;
1094
+
1095
+  // Here we have a problem. The message is encoded in UTF8, so
1096
+  // arbitrarily cutting it will be a problem. We MUST be sure
1097
+  // that there is no cutting in the middle of a multibyte character!
1098
+
1099
+  // Get a pointer to the null terminator
1100
+  const char* pend = message + strlen(message);
1101
+
1102
+  //  If length of supplied UTF8 string is greater than
1103
+  // our buffer size, start cutting whole UTF8 chars
1104
+  while ((pend - message) > MAX_MESSAGE_LENGTH) {
1105
+    --pend;
1106
+    while (!START_OF_UTF8_CHAR(*pend)) --pend;
1107
+  };
1108
+
1109
+  // At this point, we have the proper cut point. Use it
1110
+  uint8_t maxLen = pend - message;
1111
+  strncpy(status_message, message, maxLen);
1112
+  status_message[maxLen] = '\0';
1113
+
1114
+  finishstatus(persist);
1115
+}
1116
+
1117
+#include <stdarg.h>
1118
+
1119
+void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
1120
+  if (level < status_message_level) return;
1121
+  status_message_level = level;
1122
+  va_list args;
1123
+  va_start(args, fmt);
1124
+  vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
1125
+  va_end(args);
1126
+  finishstatus(level > 0);
1127
+}
1128
+
1129
+void MarlinUI::setstatusPGM(PGM_P const message, int8_t level) {
1130
+  if (level < 0) level = status_message_level = 0;
1131
+  if (level < status_message_level) return;
1132
+  status_message_level = level;
1133
+
1134
+  // Here we have a problem. The message is encoded in UTF8, so
1135
+  // arbitrarily cutting it will be a problem. We MUST be sure
1136
+  // that there is no cutting in the middle of a multibyte character!
1137
+
1138
+  // Get a pointer to the null terminator
1139
+  PGM_P pend = message + strlen_P(message);
1140
+
1141
+  //  If length of supplied UTF8 string is greater than
1142
+  // our buffer size, start cutting whole UTF8 chars
1143
+  while ((pend - message) > MAX_MESSAGE_LENGTH) {
1144
+    --pend;
1145
+    while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend;
1146
+  };
1147
+
1148
+  // At this point, we have the proper cut point. Use it
1149
+  uint8_t maxLen = pend - message;
1150
+  strncpy_P(status_message, message, maxLen);
1151
+  status_message[maxLen] = '\0';
1152
+
1153
+  finishstatus(level > 0);
1154
+}
1155
+
1156
+void MarlinUI::setalertstatusPGM(PGM_P const message) {
1157
+  setstatusPGM(message, 1);
1158
+  #if HAS_LCD_MENU
1159
+    return_to_status();
1160
+  #endif
1161
+}
1162
+
1188 1163
 #endif // HAS_SPI_LCD
1164
+
1165
+#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
1166
+
1167
+  #include "../module/printcounter.h"
1168
+
1169
+  /**
1170
+   * Reset the status message
1171
+   */
1172
+  void MarlinUI::reset_status() {
1173
+    static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
1174
+    static const char printing[] PROGMEM = MSG_PRINTING;
1175
+    static const char welcome[] PROGMEM = WELCOME_MSG;
1176
+    PGM_P msg;
1177
+    if (print_job_timer.isPaused())
1178
+      msg = paused;
1179
+    #if ENABLED(SDSUPPORT)
1180
+      else if (IS_SD_PRINTING())
1181
+        return setstatus(card.longest_filename(), true);
1182
+    #endif
1183
+    else if (print_job_timer.isRunning())
1184
+      msg = printing;
1185
+    else
1186
+      msg = welcome;
1187
+
1188
+    setstatusPGM(msg, -1);
1189
+  }
1190
+
1191
+#endif

+ 24
- 169
Marlin/src/lcd/ultralcd.h View File

@@ -38,166 +38,6 @@
38 38
   #include "../libs/buzzer.h"
39 39
 #endif
40 40
 
41
-#if HAS_GRAPHICAL_LCD
42
-
43
-  #ifndef LCD_PIXEL_WIDTH
44
-    #define LCD_PIXEL_WIDTH 128
45
-  #endif
46
-  #ifndef LCD_PIXEL_HEIGHT
47
-    #define LCD_PIXEL_HEIGHT 64
48
-  #endif
49
-
50
-  // LCD selection
51
-  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
52
-    #define U8G_CLASS U8GLIB_ST7920_128X64_4X
53
-    #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
54
-      #define U8G_PARAM LCD_PINS_RS
55
-    #else
56
-      #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
57
-    #endif
58
-
59
-  #elif ENABLED(U8GLIB_ST7920)
60
-    // RepRap Discount Full Graphics Smart Controller
61
-    #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
62
-      #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
63
-      #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
64
-    #else
65
-      //#define U8G_CLASS U8GLIB_ST7920_128X64_4X
66
-      //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS     // Original u8glib device. 2 stripes, SW SPI
67
-      #define U8G_CLASS U8GLIB_ST7920_128X64_RRD
68
-      #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
69
-                                                                        // AVR version ignores these pin settings
70
-                                                                        // HAL version uses these pin settings
71
-    #endif
72
-
73
-  #elif ENABLED(CARTESIO_UI)
74
-    // The CartesioUI display
75
-    //#define U8G_CLASS U8GLIB_DOGM128_2X
76
-    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
77
-    #define U8G_CLASS U8GLIB_DOGM128_2X
78
-    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
79
-
80
-  #elif ENABLED(U8GLIB_LM6059_AF)
81
-    // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
82
-    //#define U8G_CLASS U8GLIB_LM6059
83
-    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
84
-    #define U8G_CLASS U8GLIB_LM6059_2X
85
-    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
86
-
87
-  #elif ENABLED(U8GLIB_ST7565_64128N)
88
-    // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
89
-    #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
90
-    #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
91
-      #define U8G_CLASS U8GLIB_64128N_2X_HAL
92
-      #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // using HW-SPI
93
-    #else
94
-      #define U8G_CLASS U8GLIB_64128N_2X_HAL
95
-      #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // using SW-SPI
96
-    #endif
97
-
98
-  #elif ENABLED(MKS_12864OLED_SSD1306)
99
-    // MKS 128x64 (SSD1306) OLED I2C LCD
100
-    #define U8G_CLASS U8GLIB_SSD1306_128X64
101
-    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
102
-    //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
103
-    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
104
-
105
-  #elif ENABLED(U8GLIB_SSD1306)
106
-    // Generic support for SSD1306 OLED I2C LCDs
107
-    //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
108
-    //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
109
-    #define U8G_CLASS U8GLIB_SSD1306_128X64_2X
110
-    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
111
-
112
-  #elif ENABLED(MKS_12864OLED)
113
-    // MKS 128x64 (SH1106) OLED I2C LCD
114
-    #define U8G_CLASS U8GLIB_SH1106_128X64
115
-    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0     // 8 stripes
116
-    //#define U8G_CLASS U8GLIB_SH1106_128X64_2X
117
-    //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0   // 4 stripes
118
-  #elif ENABLED(U8GLIB_SH1106)
119
-    // Generic support for SH1106 OLED I2C LCDs
120
-    //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
121
-    //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)           // 4 stripes
122
-    #define U8G_CLASS U8GLIB_SH1106_128X64_2X
123
-    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)             // 4 stripes
124
-  #elif ENABLED(U8GLIB_SSD1309)
125
-    // Generic support for SSD1309 OLED I2C LCDs
126
-    #define U8G_CLASS U8GLIB_SSD1309_128X64
127
-    #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
128
-  #elif ENABLED(MINIPANEL)
129
-    // The MINIPanel display
130
-    //#define U8G_CLASS U8GLIB_MINI12864
131
-    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // 8 stripes
132
-    #define U8G_CLASS U8GLIB_MINI12864_2X
133
-    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // 4 stripes
134
-  #elif ENABLED(U8GLIB_SH1106_EINSTART)
135
-    // Connected via motherboard header
136
-    #define U8G_CLASS U8GLIB_SH1106_128X64
137
-    #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
138
-  #else
139
-    // for regular DOGM128 display with HW-SPI
140
-    //#define U8G_CLASS U8GLIB_DOGM128
141
-    //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0                            // HW-SPI Com: CS, A0  // 8 stripes
142
-    #define U8G_CLASS U8GLIB_DOGM128_2X
143
-    #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                              // HW-SPI Com: CS, A0 // 4 stripes
144
-  #endif
145
-
146
-  #include <U8glib.h>
147
-  #include "dogm/HAL_LCD_class_defines.h"
148
-  extern U8G_CLASS u8g;
149
-
150
-  // For selective rendering within a Y range
151
-  #define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
152
-  #define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
153
-
154
-  // Only Western languages support big / small fonts
155
-  #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
156
-    #undef USE_BIG_EDIT_FONT
157
-    #undef USE_SMALL_INFOFONT
158
-  #endif
159
-
160
-  #define MENU_FONT_NAME    ISO10646_1_5x7
161
-  #define MENU_FONT_WIDTH    6
162
-  #define MENU_FONT_ASCENT  10
163
-  #define MENU_FONT_DESCENT  2
164
-  #define MENU_FONT_HEIGHT  (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
165
-
166
-  #if ENABLED(USE_BIG_EDIT_FONT)
167
-    #define EDIT_FONT_NAME    u8g_font_9x18
168
-    #define EDIT_FONT_WIDTH    9
169
-    #define EDIT_FONT_ASCENT  10
170
-    #define EDIT_FONT_DESCENT  3
171
-  #else
172
-    #define EDIT_FONT_NAME    MENU_FONT_NAME
173
-    #define EDIT_FONT_WIDTH   MENU_FONT_WIDTH
174
-    #define EDIT_FONT_ASCENT  MENU_FONT_ASCENT
175
-    #define EDIT_FONT_DESCENT MENU_FONT_DESCENT
176
-  #endif
177
-  #define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
178
-
179
-  // Get the Ascent, Descent, and total Height for the Info Screen font
180
-  #if ENABLED(USE_SMALL_INFOFONT)
181
-    extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
182
-    #define INFO_FONT_ASCENT 7
183
-  #else
184
-    #define INFO_FONT_ASCENT 8
185
-  #endif
186
-  #define INFO_FONT_DESCENT 2
187
-  #define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
188
-
189
-  enum MarlinFont : uint8_t {
190
-    FONT_STATUSMENU = 1,
191
-    FONT_EDIT,
192
-    FONT_MENU
193
-  };
194
-
195
-  #if ENABLED(LIGHTWEIGHT_UI)
196
-    void lcd_in_status(const bool inStatus);
197
-  #endif
198
-
199
-#endif // HAS_GRAPHICAL_LCD
200
-
201 41
 #define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
202 42
 
203 43
 #if HAS_SPI_LCD
@@ -364,6 +204,14 @@
364 204
   #endif
365 205
 #endif
366 206
 
207
+#if HAS_GRAPHICAL_LCD
208
+  enum MarlinFont : uint8_t {
209
+    FONT_STATUSMENU = 1,
210
+    FONT_EDIT,
211
+    FONT_MENU
212
+  };
213
+#endif
214
+
367 215
 #define LCD_MESSAGEPGM(x)      ui.setstatusPGM(PSTR(x))
368 216
 #define LCD_ALERTMESSAGEPGM(x) ui.setalertstatusPGM(PSTR(x))
369 217
 
@@ -397,12 +245,10 @@ public:
397 245
   #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
398 246
     static void init();
399 247
     static void update();
400
-    static bool detected();
401 248
     static void setalertstatusPGM(PGM_P message);
402 249
   #else // NO LCD
403 250
     static inline void init() {}
404 251
     static inline void update() {}
405
-    static constexpr bool detected() { return true; }
406 252
     static inline void setalertstatusPGM(PGM_P message) { UNUSED(message); }
407 253
   #endif
408 254
 
@@ -410,6 +256,8 @@ public:
410 256
 
411 257
     #if HAS_SPI_LCD
412 258
 
259
+      static bool detected();
260
+
413 261
       static LCDViewAction lcdDrawUpdate;
414 262
       static inline bool should_draw() { return bool(lcdDrawUpdate); }
415 263
       static inline void refresh(const LCDViewAction type) { lcdDrawUpdate = type; }
@@ -455,6 +303,7 @@ public:
455 303
       #if ENABLED(STATUS_MESSAGE_SCROLLING)
456 304
         static uint8_t status_scroll_offset;
457 305
       #endif
306
+      static bool hasstatus();
458 307
 
459 308
       static uint8_t lcd_status_update_delay;
460 309
       static uint8_t status_message_level;      // Higher levels block lower levels
@@ -495,15 +344,15 @@ public:
495 344
 
496 345
     #else
497 346
 
498
-      static void refresh();
499
-      static void reset_alert_level();
347
+      static void refresh() {}
348
+      static inline void reset_alert_level() {}
349
+      static constexpr bool hasstatus() { return true; }
500 350
 
501 351
     #endif
502 352
 
503 353
     static bool get_blink();
504 354
     static void kill_screen(PGM_P const lcd_msg);
505 355
     static void draw_kill_screen();
506
-    static bool hasstatus();
507 356
     static void setstatus(const char* const message, const bool persist=false);
508 357
     static void setstatusPGM(PGM_P const message, const int8_t level=0);
509 358
     static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
@@ -512,12 +361,12 @@ public:
512 361
   #else // MALYAN_LCD or NO LCD
513 362
 
514 363
     static inline void refresh() {}
515
-    static constexpr bool hasstatus() { return false; }
516 364
     static inline void setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
517 365
     static inline void setstatusPGM(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
518 366
     static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
519 367
     static inline void reset_status() {}
520 368
     static inline void reset_alert_level() {}
369
+    static constexpr bool hasstatus() { return false; }
521 370
 
522 371
   #endif
523 372
 
@@ -563,6 +412,10 @@ public:
563 412
     static inline bool on_status_screen() { return currentScreen == status_screen; }
564 413
     static inline void run_current_screen() { (*currentScreen)(); }
565 414
 
415
+    #if ENABLED(LIGHTWEIGHT_UI)
416
+      static void lcd_in_status(const bool inStatus);
417
+    #endif
418
+
566 419
     static inline void defer_status_screen(const bool defer) {
567 420
       #if LCD_TIMEOUT_TO_STATUS
568 421
         defer_return_to_status = defer;
@@ -636,13 +489,13 @@ public:
636 489
       static inline void encoder_direction_menus()  { encoderDirection = -(ENCODERBASE); }
637 490
     #else
638 491
       static constexpr int8_t encoderDirection = ENCODERBASE;
639
-      static inline void encoder_direction_normal() { }
640
-      static inline void encoder_direction_menus()  { }
492
+      static inline void encoder_direction_normal() {}
493
+      static inline void encoder_direction_menus()  {}
641 494
     #endif
642 495
 
643 496
   #else
644 497
 
645
-    static inline void update_buttons() { }
498
+    static inline void update_buttons() {}
646 499
 
647 500
   #endif
648 501
 
@@ -660,6 +513,8 @@ private:
660 513
     #endif
661 514
     static void draw_status_screen();
662 515
     static void finishstatus(const bool persist);
516
+  #else
517
+    static inline void finishstatus(const bool persist) { UNUSED(persist); refresh(); }
663 518
   #endif
664 519
 };
665 520
 

Loading…
Cancel
Save