浏览代码

Refactor LCD menus

Scott Lahteine 6 年前
父节点
当前提交
2bf18950ab

+ 1
- 1
Marlin/src/core/language.h 查看文件

264
 
264
 
265
 // LCD Menu Messages
265
 // LCD Menu Messages
266
 
266
 
267
-#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(../lcd/dogm/language_data_##M.h)
267
+#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(language_data_##M.h)
268
 #define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M)
268
 #define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M)
269
 #define INCLUDE_LANGUAGE_DATA LANGUAGE_DATA_INCL(LCD_LANGUAGE)
269
 #define INCLUDE_LANGUAGE_DATA LANGUAGE_DATA_INCL(LCD_LANGUAGE)
270
 
270
 

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp 查看文件

628
 
628
 
629
     LEAVE:
629
     LEAVE:
630
 
630
 
631
-    #if ENABLED(NEWPANEL)
631
+    #if ENABLED(ULTIPANEL)
632
       lcd_reset_alert_level();
632
       lcd_reset_alert_level();
633
       lcd_quick_feedback(true);
633
       lcd_quick_feedback(true);
634
       lcd_reset_status();
634
       lcd_reset_status();

+ 0
- 1
Marlin/src/gcode/calibrate/G28.cpp 查看文件

210
 
210
 
211
     // Cancel the active G29 session
211
     // Cancel the active G29 session
212
     #if ENABLED(PROBE_MANUALLY)
212
     #if ENABLED(PROBE_MANUALLY)
213
-      extern bool g29_in_progress;
214
       g29_in_progress = false;
213
       g29_in_progress = false;
215
     #endif
214
     #endif
216
 
215
 

+ 17
- 10
Marlin/src/inc/Conditionals_LCD.h 查看文件

298
   #define ULTIPANEL
298
   #define ULTIPANEL
299
 #endif
299
 #endif
300
 
300
 
301
-#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
301
+#if ENABLED(NO_LCD_MENUS)
302
+  #undef ULTIPANEL
303
+#endif
304
+
305
+#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
306
+
307
+#if HAS_GRAPHICAL_LCD
302
   #ifndef LCD_WIDTH
308
   #ifndef LCD_WIDTH
303
     #ifdef LCD_WIDTH_OVERRIDE
309
     #ifdef LCD_WIDTH_OVERRIDE
304
       #define LCD_WIDTH LCD_WIDTH_OVERRIDE
310
       #define LCD_WIDTH LCD_WIDTH_OVERRIDE
311
   #endif
317
   #endif
312
 #endif
318
 #endif
313
 
319
 
314
-#if ENABLED(NO_LCD_MENUS)
315
-  #undef ULTIPANEL
316
-#endif
317
-
318
 #if ENABLED(ULTIPANEL)
320
 #if ENABLED(ULTIPANEL)
319
   #define NEWPANEL  // Disable this if you actually have no click-encoder panel
321
   #define NEWPANEL  // Disable this if you actually have no click-encoder panel
320
   #define ULTRA_LCD
322
   #define ULTRA_LCD
333
   #endif
335
   #endif
334
 #endif
336
 #endif
335
 
337
 
336
-#if ENABLED(DOGLCD)
338
+// Aliases for LCD features
339
+#define HAS_SPI_LCD          ENABLED(ULTRA_LCD)
340
+#define HAS_CHARACTER_LCD   (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD))
341
+#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
342
+#define HAS_LCD_MENU         ENABLED(ULTIPANEL)
343
+#define HAS_DEBUG_MENU      (HAS_LCD_MENU && ENABLED(LCD_PROGRESS_BAR_TEST))
344
+
345
+#if HAS_GRAPHICAL_LCD
337
   /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */
346
   /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */
338
   // \x00 intentionally skipped to avoid problems in strings
347
   // \x00 intentionally skipped to avoid problems in strings
339
   #define LCD_STR_REFRESH     "\x01"
348
   #define LCD_STR_REFRESH     "\x01"
369
 /**
378
 /**
370
  * Default LCD contrast for dogm-like LCD displays
379
  * Default LCD contrast for dogm-like LCD displays
371
  */
380
  */
372
-#if ENABLED(DOGLCD)
381
+#if HAS_GRAPHICAL_LCD
373
 
382
 
374
   #define HAS_LCD_CONTRAST ( \
383
   #define HAS_LCD_CONTRAST ( \
375
       ENABLED(MAKRPANEL) \
384
       ENABLED(MAKRPANEL) \
394
 #endif
403
 #endif
395
 
404
 
396
 // Boot screens
405
 // Boot screens
397
-#if DISABLED(ULTRA_LCD)
406
+#if !HAS_SPI_LCD
398
   #undef SHOW_BOOTSCREEN
407
   #undef SHOW_BOOTSCREEN
399
 #elif !defined(BOOTSCREEN_TIMEOUT)
408
 #elif !defined(BOOTSCREEN_TIMEOUT)
400
   #define BOOTSCREEN_TIMEOUT 2500
409
   #define BOOTSCREEN_TIMEOUT 2500
401
 #endif
410
 #endif
402
 
411
 
403
-#define HAS_DEBUG_MENU (ENABLED(ULTIPANEL) && ENABLED(LCD_PROGRESS_BAR_TEST))
404
-
405
 /**
412
 /**
406
  * Extruders have some combination of stepper motors and hotends
413
  * Extruders have some combination of stepper motors and hotends
407
  * so we separate these concepts into the defines:
414
  * so we separate these concepts into the defines:

Marlin/src/lcd/lcdprint_hd44780.cpp → Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp 查看文件

12
  *   Western(English), Cyrillic(Russian), Kana(Japanese) charsets.
12
  *   Western(English), Cyrillic(Russian), Kana(Japanese) charsets.
13
  */
13
  */
14
 
14
 
15
-#include "../inc/MarlinConfigPre.h"
16
-#include "../inc/MarlinConfig.h"
15
+#include "../../inc/MarlinConfigPre.h"
17
 
16
 
18
-#if ENABLED(ULTRA_LCD)
19
-#include "ultralcd.h"
20
-#include "../Marlin.h"
17
+#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)
18
+
19
+#include "../ultralcd.h"
20
+#include "../../Marlin.h"
21
 
21
 
22
-#if DISABLED(DOGLCD)
23
 #include <string.h>
22
 #include <string.h>
24
-#include "fontutils.h"
25
-#include "lcdprint.h"
23
+#include "../fontutils.h"
24
+#include "../lcdprint.h"
26
 
25
 
27
 #include "ultralcd_common_HD44780.h"
26
 #include "ultralcd_common_HD44780.h"
28
 #ifndef LCD_CLASS
27
 #ifndef LCD_CLASS
1040
   return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
1039
   return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
1041
 }
1040
 }
1042
 
1041
 
1043
-#endif // DOGLCD
1044
-#endif // ULTRA_LCD
1042
+#endif // ULTRA_LCD && !DOGLCD

Marlin/src/lcd/ultralcd_common_HD44780.h → Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h 查看文件

19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
-
23
-#ifndef ULTRALCD_COMMON_HD44780_H
24
-#define ULTRALCD_COMMON_HD44780_H
22
+#pragma once
25
 
23
 
26
 /**
24
 /**
27
  * Implementation of the LCD display routines for a Hitachi HD44780 display.
25
  * Implementation of the LCD display routines for a Hitachi HD44780 display.
28
  * These are the most common LCD character displays.
26
  * These are the most common LCD character displays.
29
  */
27
  */
30
 
28
 
31
-#include "../inc/MarlinConfig.h"
29
+#include "../../inc/MarlinConfig.h"
32
 
30
 
33
 #if LCD_HEIGHT > 3
31
 #if LCD_HEIGHT > 3
34
-  #include "../libs/duration_t.h"
32
+  #include "../../libs/duration_t.h"
35
 #endif
33
 #endif
36
 
34
 
37
 #if ENABLED(AUTO_BED_LEVELING_UBL)
35
 #if ENABLED(AUTO_BED_LEVELING_UBL)
38
-  #include "../feature/bedlevel/ubl/ubl.h"
36
+  #include "../../feature/bedlevel/ubl/ubl.h"
39
 
37
 
40
   #if ENABLED(ULTIPANEL)
38
   #if ENABLED(ULTIPANEL)
41
     #define ULTRA_X_PIXELS_PER_CHAR    5
39
     #define ULTRA_X_PIXELS_PER_CHAR    5
183
 
181
 
184
 #endif
182
 #endif
185
 
183
 
186
-#include "fontutils.h"
187
-#include "lcdprint.h"
184
+#include "../fontutils.h"
185
+#include "../lcdprint.h"
188
 
186
 
189
 #if ENABLED(LCD_PROGRESS_BAR)
187
 #if ENABLED(LCD_PROGRESS_BAR)
190
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
188
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
191
 #endif
189
 #endif
192
-
193
-enum HD44780CharSet : char {
194
-  CHARSET_MENU,
195
-  CHARSET_INFO,
196
-  CHARSET_BOOT
197
-};
198
-
199
-#endif // ULTRALCD_COMMON_HD44780_H

Marlin/src/lcd/ultralcd_impl_HD44780.h → Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.h 查看文件

69
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
69
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
70
 #endif
70
 #endif
71
 
71
 
72
-#include "fontutils.h"
73
-#include "lcdprint.h"
72
+#include "../fontutils.h"
73
+#include "../lcdprint.h"
74
 
74
 
75
 #if ENABLED(LCD_PROGRESS_BAR)
75
 #if ENABLED(LCD_PROGRESS_BAR)
76
   static millis_t progress_bar_ms = 0;     // Start millis of the current progress bar cycle
76
   static millis_t progress_bar_ms = 0;     // Start millis of the current progress bar cycle
90
   lcd.createChar(c, temp);
90
   lcd.createChar(c, temp);
91
 }
91
 }
92
 
92
 
93
-static void lcd_set_custom_characters(
93
+void lcd_set_custom_characters(
94
   #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
94
   #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
95
     const uint8_t screen_charset=CHARSET_INFO
95
     const uint8_t screen_charset=CHARSET_INFO
96
   #endif
96
   #endif
308
 
308
 
309
 }
309
 }
310
 
310
 
311
-static void lcd_implementation_init(
311
+void lcd_implementation_init(
312
   #if ENABLED(LCD_PROGRESS_BAR)
312
   #if ENABLED(LCD_PROGRESS_BAR)
313
     const uint8_t screen_charset=CHARSET_INFO
313
     const uint8_t screen_charset=CHARSET_INFO
314
   #endif
314
   #endif
744
    *         |01234567890123456789|
744
    *         |01234567890123456789|
745
    */
745
    */
746
 
746
 
747
-  static void lcd_impl_status_screen_0() {
747
+  void lcd_impl_status_screen_0() {
748
     const bool blink = lcd_blink();
748
     const bool blink = lcd_blink();
749
 
749
 
750
     // ========== Line 1 ==========
750
     // ========== Line 1 ==========
969
 
969
 
970
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
970
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
971
 
971
 
972
-    static void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder=active_extruder) {
972
+    void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder) {
973
       if (row < LCD_HEIGHT) {
973
       if (row < LCD_HEIGHT) {
974
         lcd_moveto(LCD_WIDTH - 9, row);
974
         lcd_moveto(LCD_WIDTH - 9, row);
975
         _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], lcd_blink());
975
         _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], lcd_blink());
978
 
978
 
979
   #endif // ADVANCED_PAUSE_FEATURE
979
   #endif // ADVANCED_PAUSE_FEATURE
980
 
980
 
981
-  static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
981
+  void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center/*=true*/, const bool invert/*=false*/, const char *valstr/*=NULL*/) {
982
     UNUSED(invert);
982
     UNUSED(invert);
983
     int8_t n = LCD_WIDTH;
983
     int8_t n = LCD_WIDTH;
984
     lcd_moveto(0, row);
984
     lcd_moveto(0, row);
991
     for (; n > 0; --n) lcd_put_wchar(' ');
991
     for (; n > 0; --n) lcd_put_wchar(' ');
992
   }
992
   }
993
 
993
 
994
-  static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
994
+  void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
995
     uint8_t n = LCD_WIDTH - 2;
995
     uint8_t n = LCD_WIDTH - 2;
996
     lcd_moveto(0, row);
996
     lcd_moveto(0, row);
997
     lcd_put_wchar(sel ? pre_char : ' ');
997
     lcd_put_wchar(sel ? pre_char : ' ');
1000
     lcd_put_wchar(post_char);
1000
     lcd_put_wchar(post_char);
1001
   }
1001
   }
1002
 
1002
 
1003
-  static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1003
+  void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1004
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
1004
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
1005
     lcd_moveto(0, row);
1005
     lcd_moveto(0, row);
1006
     lcd_put_wchar(sel ? pre_char : ' ');
1006
     lcd_put_wchar(sel ? pre_char : ' ');
1009
     while (n--) lcd_put_wchar(' ');
1009
     while (n--) lcd_put_wchar(' ');
1010
     lcd_put_u8str(data);
1010
     lcd_put_u8str(data);
1011
   }
1011
   }
1012
-  static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1012
+  void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1013
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
1013
     uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
1014
     lcd_moveto(0, row);
1014
     lcd_moveto(0, row);
1015
     lcd_put_wchar(sel ? pre_char : ' ');
1015
     lcd_put_wchar(sel ? pre_char : ' ');
1019
     lcd_put_u8str_P(data);
1019
     lcd_put_u8str_P(data);
1020
   }
1020
   }
1021
 
1021
 
1022
-  #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src)
1023
-  #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
1024
-
1025
-  void lcd_implementation_drawedit(PGM_P pstr, const char* const value=NULL) {
1022
+  void lcd_implementation_drawedit(PGM_P pstr, const char* const value/*=NULL*/) {
1026
     lcd_moveto(1, 1);
1023
     lcd_moveto(1, 1);
1027
     lcd_put_u8str_P(pstr);
1024
     lcd_put_u8str_P(pstr);
1028
     if (value != NULL) {
1025
     if (value != NULL) {
1071
       lcd_put_wchar(post_char);
1068
       lcd_put_wchar(post_char);
1072
     }
1069
     }
1073
 
1070
 
1074
-    static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
1071
+    void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
1075
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' ');
1072
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' ');
1076
     }
1073
     }
1077
 
1074
 
1078
-    static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
1075
+    void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
1079
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]);
1076
       lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]);
1080
     }
1077
     }
1081
 
1078
 
1082
   #endif // SDSUPPORT
1079
   #endif // SDSUPPORT
1083
 
1080
 
1084
-  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
1085
-  #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
1086
-  #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
1087
-  #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
1088
-
1089
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1081
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1090
 
1082
 
1091
-    extern millis_t next_button_update_ms;
1092
-
1093
     static uint8_t lcd_implementation_read_slow_buttons() {
1083
     static uint8_t lcd_implementation_read_slow_buttons() {
1094
       #if ENABLED(LCD_I2C_TYPE_MCP23017)
1084
       #if ENABLED(LCD_I2C_TYPE_MCP23017)
1095
         // Reading these buttons this is likely to be too slow to call inside interrupt context
1085
         // Reading these buttons this is likely to be too slow to call inside interrupt context

+ 1
- 6
Marlin/src/lcd/dogm/HAL_LCD_class_defines.h 查看文件

19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
-
22
+#pragma once
23
 
23
 
24
 // use this file to create the public interface for device drivers that are NOT in the U8G library
24
 // use this file to create the public interface for device drivers that are NOT in the U8G library
25
 
25
 
36
       { }
36
       { }
37
 };
37
 };
38
 
38
 
39
-
40
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi;
39
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi;
41
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi;
40
 extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi;
42
 class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB
41
 class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB
50
       { }
49
       { }
51
 };
50
 };
52
 
51
 
53
-
54
 // AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp, HAL version uses u8g_dev_st7920_128x64_HAL.cpp
52
 // AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp, HAL version uses u8g_dev_st7920_128x64_HAL.cpp
55
 extern u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi;
53
 extern u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi;
56
 class U8GLIB_ST7920_128X64_RRD : public U8GLIB
54
 class U8GLIB_ST7920_128X64_RRD : public U8GLIB
61
       { }
59
       { }
62
 };
60
 };
63
 
61
 
64
-
65
 extern u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire;
62
 extern u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire;
66
 class U8GLIB_SH1106_128X64_2X_I2C_2_WIRE : public U8GLIB {
63
 class U8GLIB_SH1106_128X64_2X_I2C_2_WIRE : public U8GLIB {
67
   public:
64
   public:
70
     {  }
67
     {  }
71
 };
68
 };
72
 
69
 
73
-
74
-
75
 extern u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire;
70
 extern u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire;
76
 class U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE : public U8GLIB {
71
 class U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE : public U8GLIB {
77
   public:
72
   public:

Marlin/src/lcd/lcdprint_u8g.cpp → Marlin/src/lcd/dogm/lcdprint_u8g.cpp 查看文件

7
  * @copyright GPL/BSD
7
  * @copyright GPL/BSD
8
  */
8
  */
9
 
9
 
10
-#include "../inc/MarlinConfigPre.h"
10
+#include "../../inc/MarlinConfigPre.h"
11
 
11
 
12
 #if ENABLED(DOGLCD)
12
 #if ENABLED(DOGLCD)
13
 
13
 
16
 #define _lcd_write(a) pu8g->print(a)
16
 #define _lcd_write(a) pu8g->print(a)
17
 #define _lcd_setcursor(col, row) pu8g->setPrintPos((col), (row));
17
 #define _lcd_setcursor(col, row) pu8g->setPrintPos((col), (row));
18
 
18
 
19
-#include "ultralcd.h"
20
-#include "../Marlin.h"
19
+#include "../ultralcd.h"
20
+#include "../../Marlin.h"
21
 
21
 
22
-#include "fontutils.h"
22
+#include "../fontutils.h"
23
 #include "u8g_fontutf8.h"
23
 #include "u8g_fontutf8.h"
24
-#include "lcdprint.h"
24
+#include "../lcdprint.h"
25
 
25
 
26
 int lcd_glyph_height(void) {
26
 int lcd_glyph_height(void) {
27
   return u8g_GetFontBBXHeight(pu8g->getU8g());
27
   return u8g_GetFontBBXHeight(pu8g->getU8g());

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_DOGM.h 查看文件

198
   #endif
198
   #endif
199
 }
199
 }
200
 
200
 
201
-static void lcd_impl_status_screen_0() {
201
+void lcd_impl_status_screen_0() {
202
 
202
 
203
   const bool blink = lcd_blink();
203
   const bool blink = lcd_blink();
204
 
204
 

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h 查看文件

947
   ncs();
947
   ncs();
948
 }
948
 }
949
 
949
 
950
-static void lcd_impl_status_screen_0() {
950
+void lcd_impl_status_screen_0() {
951
   ST7920_Lite_Status_Screen::update(false);
951
   ST7920_Lite_Status_Screen::update(false);
952
 }
952
 }
953
 
953
 

Marlin/src/lcd/u8g_fontutf8.cpp → Marlin/src/lcd/dogm/u8g_fontutf8.cpp 查看文件

7
  * @copyright GPL/BSD
7
  * @copyright GPL/BSD
8
  */
8
  */
9
 
9
 
10
-#include "../inc/MarlinConfigPre.h"
10
+#include "../../inc/MarlinConfigPre.h"
11
 
11
 
12
 #if ENABLED(DOGLCD)
12
 #if ENABLED(DOGLCD)
13
 
13
 
14
 #include <string.h>
14
 #include <string.h>
15
-#include "fontutils.h"
15
+#include "../fontutils.h"
16
 #include "u8g_fontutf8.h"
16
 #include "u8g_fontutf8.h"
17
 
17
 
18
 ////////////////////////////////////////////////////////////
18
 ////////////////////////////////////////////////////////////

Marlin/src/lcd/u8g_fontutf8.h → Marlin/src/lcd/dogm/u8g_fontutf8.h 查看文件

6
  * @date    2015-02-19
6
  * @date    2015-02-19
7
  * @copyright GPL/BSD
7
  * @copyright GPL/BSD
8
  */
8
  */
9
-#ifndef _UXG_FONTUTF8_H
10
-#define _UXG_FONTUTF8_H 1
9
+#pragma once
11
 
10
 
12
 #include <U8glib.h>
11
 #include <U8glib.h>
13
-#include "fontutils.h"
12
+#include "../fontutils.h"
14
 
13
 
15
 // the macro to indicate a UTF-8 string
14
 // the macro to indicate a UTF-8 string
16
 // You should to save the C/C++ source in UTF-8 encoding!
15
 // You should to save the C/C++ source in UTF-8 encoding!
25
   const u8g_fntpgm_uint8_t *fntdata;
24
   const u8g_fntpgm_uint8_t *fntdata;
26
 } uxg_fontinfo_t;
25
 } uxg_fontinfo_t;
27
 
26
 
28
-int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
27
+int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
29
 
28
 
30
-unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
29
+unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
31
 
30
 
32
-unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
33
-unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length);
31
+unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
32
+unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length);
34
 
33
 
35
 int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
34
 int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
36
 int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
35
 int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
37
 
36
 
38
 #define uxg_GetFont(puxg) ((puxg)->font)
37
 #define uxg_GetFont(puxg) ((puxg)->font)
39
-
40
-#endif // _UXG_FONTUTF8_H

Marlin/src/lcd/ultralcd_impl_DOGM.h → Marlin/src/lcd/dogm/ultralcd_impl_DOGM.h 查看文件

36
 #ifndef ULTRALCD_IMPL_DOGM_H
36
 #ifndef ULTRALCD_IMPL_DOGM_H
37
 #define ULTRALCD_IMPL_DOGM_H
37
 #define ULTRALCD_IMPL_DOGM_H
38
 
38
 
39
-#include "../inc/MarlinConfig.h"
39
+#include "../../inc/MarlinConfig.h"
40
 
40
 
41
 /**
41
 /**
42
  * Implementation of the LCD display routines for a DOGM128 graphic display.
42
  * Implementation of the LCD display routines for a DOGM128 graphic display.
43
  * These are common LCD 128x64 pixel graphic displays.
43
  * These are common LCD 128x64 pixel graphic displays.
44
  */
44
  */
45
-#include "ultralcd.h"
45
+#include "../ultralcd.h"
46
 
46
 
47
-/*
48
-#if ENABLED(U8GLIB_ST7565_64128N)
49
-  #include "dogm/ultralcd_st7565_u8glib_VIKI.h"
50
-#elif ENABLED(U8GLIB_ST7920)
51
-  #include "dogm/ultralcd_st7920_u8glib_rrd.h"
52
-#endif
53
-*/
54
-
55
-#include "dogm/dogm_bitmaps.h"
47
+#include "dogm_bitmaps.h"
56
 
48
 
57
 #if ENABLED(SDSUPPORT)
49
 #if ENABLED(SDSUPPORT)
58
-  #include "../libs/duration_t.h"
50
+  #include "../../libs/duration_t.h"
59
 #endif
51
 #endif
60
 
52
 
61
 #include <U8glib.h>
53
 #include <U8glib.h>
62
 
54
 
63
-#include "fontutils.h"
55
+#include "../fontutils.h"
64
 #include "u8g_fontutf8.h"
56
 #include "u8g_fontutf8.h"
65
 
57
 
66
-#include "dogm/HAL_LCD_class_defines.h"
58
+#include "HAL_LCD_class_defines.h"
67
 
59
 
68
 #if ENABLED(AUTO_BED_LEVELING_UBL)
60
 #if ENABLED(AUTO_BED_LEVELING_UBL)
69
-  #include "../feature/bedlevel/ubl/ubl.h"
61
+  #include "../../feature/bedlevel/ubl/ubl.h"
70
 #endif
62
 #endif
71
 
63
 
72
 // Only Western languages support big / small fonts
64
 // Only Western languages support big / small fonts
76
 #endif
68
 #endif
77
 
69
 
78
 #if ENABLED(USE_SMALL_INFOFONT)
70
 #if ENABLED(USE_SMALL_INFOFONT)
79
-  #include "dogm/dogm_font_data_6x9_marlin.h"
71
+  #include "dogm_font_data_6x9_marlin.h"
80
   #define FONT_STATUSMENU_NAME u8g_font_6x9
72
   #define FONT_STATUSMENU_NAME u8g_font_6x9
81
   #define INFO_FONT_HEIGHT 7
73
   #define INFO_FONT_HEIGHT 7
82
 #else
74
 #else
89
 
81
 
90
 #include LANGUAGE_DATA_INCL(LCD_LANGUAGE)
82
 #include LANGUAGE_DATA_INCL(LCD_LANGUAGE)
91
 
83
 
92
-#include "dogm/dogm_font_data_ISO10646_1.h"
84
+#include "dogm_font_data_ISO10646_1.h"
93
 #define FONT_MENU_NAME ISO10646_1_5x7
85
 #define FONT_MENU_NAME ISO10646_1_5x7
94
 
86
 
95
 //#define FONT_STATUSMENU_NAME FONT_MENU_NAME
87
 //#define FONT_STATUSMENU_NAME FONT_MENU_NAME
199
   #define LCD_PIXEL_HEIGHT 64
191
   #define LCD_PIXEL_HEIGHT 64
200
 #endif
192
 #endif
201
 
193
 
202
-#include "lcdprint.h"
194
+#include "../lcdprint.h"
203
 
195
 
204
 int16_t lcd_contrast; // Initialized by settings.load()
196
 int16_t lcd_contrast; // Initialized by settings.load()
205
 static char currentfont = 0;
197
 static char currentfont = 0;
302
 #endif // SHOW_BOOTSCREEN
294
 #endif // SHOW_BOOTSCREEN
303
 
295
 
304
 #if ENABLED(LIGHTWEIGHT_UI)
296
 #if ENABLED(LIGHTWEIGHT_UI)
305
-  #include "dogm/status_screen_lite_ST7920.h"
297
+  #include "status_screen_lite_ST7920.h"
306
 #else
298
 #else
307
-  #include "dogm/status_screen_DOGM.h"
299
+  #include "status_screen_DOGM.h"
308
 #endif
300
 #endif
309
 
301
 
310
 // Initialize or re-initialize the LCD
302
 // Initialize or re-initialize the LCD
311
-static void lcd_implementation_init() {
303
+void lcd_implementation_init() {
312
 
304
 
313
   #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
305
   #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
314
     OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
306
     OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
374
 
366
 
375
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
367
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
376
 
368
 
377
-    static void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder=active_extruder) {
369
+    void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder) {
378
       row_y1 = row * row_height + 1;
370
       row_y1 = row * row_height + 1;
379
       row_y2 = row_y1 + row_height - 1;
371
       row_y2 = row_y1 + row_height - 1;
380
 
372
 
394
   #endif // ADVANCED_PAUSE_FEATURE
386
   #endif // ADVANCED_PAUSE_FEATURE
395
 
387
 
396
   // Set the colors for a menu item based on whether it is selected
388
   // Set the colors for a menu item based on whether it is selected
397
-  static bool lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) {
389
+  static bool mark_as_selected(const uint8_t row, const bool isSelected) {
398
     row_y1 = row * row_height + 1;
390
     row_y1 = row * row_height + 1;
399
     row_y2 = row_y1 + row_height - 1;
391
     row_y2 = row_y1 + row_height - 1;
400
 
392
 
423
   }
415
   }
424
 
416
 
425
   // Draw a static line of text in the same idiom as a menu item
417
   // Draw a static line of text in the same idiom as a menu item
426
-  static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
418
+  void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center/*=true*/, const bool invert/*=false*/, const char* valstr/*=NULL*/) {
427
 
419
 
428
-    if (lcd_implementation_mark_as_selected(row, invert)) {
420
+    if (mark_as_selected(row, invert)) {
429
 
421
 
430
       uint8_t n = LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * (START_COL); // pixel width of string allowed
422
       uint8_t n = LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * (START_COL); // pixel width of string allowed
431
 
423
 
443
   }
435
   }
444
 
436
 
445
   // Draw a generic menu item
437
   // Draw a generic menu item
446
-  static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
438
+  void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
447
     UNUSED(pre_char);
439
     UNUSED(pre_char);
448
 
440
 
449
-    if (lcd_implementation_mark_as_selected(row, isSelected)) {
441
+    if (mark_as_selected(row, isSelected)) {
450
       uint8_t n = LCD_WIDTH - (START_COL) - 2;
442
       uint8_t n = LCD_WIDTH - (START_COL) - 2;
451
       n *= DOG_CHAR_WIDTH;
443
       n *= DOG_CHAR_WIDTH;
452
       n -= lcd_put_u8str_max_P(pstr, n);
444
       n -= lcd_put_u8str_max_P(pstr, n);
457
     }
449
     }
458
   }
450
   }
459
 
451
 
460
-  // Macros for specific types of menu items
461
-  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
462
-  #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
463
-  #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
464
-  #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
465
-
466
   // Draw a menu item with an editable value
452
   // Draw a menu item with an editable value
467
-  static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
468
-    if (lcd_implementation_mark_as_selected(row, isSelected)) {
453
+  void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
454
+    if (mark_as_selected(row, isSelected)) {
469
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
455
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
470
       uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
456
       uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
471
       n *= DOG_CHAR_WIDTH;
457
       n *= DOG_CHAR_WIDTH;
477
     }
463
     }
478
   }
464
   }
479
 
465
 
480
-  // Macros for edit items
481
-  #define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
482
-  #define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
483
-
484
-  #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src)
485
-  #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
486
-
487
-  void lcd_implementation_drawedit(PGM_P const pstr, const char* const value=NULL) {
466
+  void lcd_implementation_drawedit(PGM_P const pstr, const char* const value/*=NULL*/) {
488
     const uint8_t labellen = utf8_strlen_P(pstr),
467
     const uint8_t labellen = utf8_strlen_P(pstr),
489
                   vallen = utf8_strlen(value);
468
                   vallen = utf8_strlen(value);
490
 
469
 
536
 
515
 
537
   #if ENABLED(SDSUPPORT)
516
   #if ENABLED(SDSUPPORT)
538
 
517
 
539
-    static void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
518
+    void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
540
       UNUSED(pstr);
519
       UNUSED(pstr);
541
 
520
 
542
-      lcd_implementation_mark_as_selected(row, isSelected);
521
+      mark_as_selected(row, isSelected);
543
 
522
 
544
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
523
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
545
 
524
 
572
       while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
551
       while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
573
     }
552
     }
574
 
553
 
575
-    #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, false)
576
-    #define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, true)
577
-
578
   #endif // SDSUPPORT
554
   #endif // SDSUPPORT
579
 
555
 
580
   #if ENABLED(AUTO_BED_LEVELING_UBL)
556
   #if ENABLED(AUTO_BED_LEVELING_UBL)
666
 
642
 
667
   #endif // AUTO_BED_LEVELING_UBL
643
   #endif // AUTO_BED_LEVELING_UBL
668
 
644
 
645
+  #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
646
+
647
+    void _lcd_zoffset_overlay_gfx(const float zvalue) {
648
+      // Determine whether the user is raising or lowering the nozzle.
649
+      static int8_t dir;
650
+      static float old_zvalue;
651
+      if (zvalue != old_zvalue) {
652
+        dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0;
653
+        old_zvalue = zvalue;
654
+      }
655
+
656
+      #if ENABLED(OVERLAY_GFX_REVERSE)
657
+        const unsigned char *rot_up = ccw_bmp, *rot_down = cw_bmp;
658
+      #else
659
+        const unsigned char *rot_up = cw_bmp, *rot_down = ccw_bmp;
660
+      #endif
661
+
662
+      #if ENABLED(USE_BIG_EDIT_FONT)
663
+        const int left = 0, right = 45, nozzle = 95;
664
+      #else
665
+        const int left = 5, right = 90, nozzle = 60;
666
+      #endif
667
+
668
+      // Draw a representation of the nozzle
669
+      if (PAGE_CONTAINS(3, 16))  u8g.drawBitmapP(nozzle + 6, 4 - dir, 2, 12, nozzle_bmp);
670
+      if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp);
671
+
672
+      // Draw cw/ccw indicator and up/down arrows.
673
+      if (PAGE_CONTAINS(47, 62)) {
674
+        u8g.drawBitmapP(left  + 0, 47, 3, 16, rot_down);
675
+        u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up);
676
+        u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp);
677
+        u8g.drawBitmapP(left  + 20, 49 - dir, 2, 13, down_arrow_bmp);
678
+      }
679
+    }
680
+
681
+  #endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
682
+
669
 #endif // ULTIPANEL
683
 #endif // ULTIPANEL
670
 
684
 
671
 #endif // __ULTRALCD_IMPL_DOGM_H
685
 #endif // __ULTRALCD_IMPL_DOGM_H

+ 1
- 4
Marlin/src/lcd/fontutils.h 查看文件

6
  * @date    2016-08-19
6
  * @date    2016-08-19
7
  * @copyright GPL/BSD
7
  * @copyright GPL/BSD
8
  */
8
  */
9
-#ifndef _FONT_UTILS_H
10
-#define _FONT_UTILS_H
9
+#pragma once
11
 
10
 
12
 #include <stdlib.h>
11
 #include <stdlib.h>
13
 #include <Arduino.h>
12
 #include <Arduino.h>
45
 /* Returns lenght of string in CHARACTERS, NOT BYTES */
44
 /* Returns lenght of string in CHARACTERS, NOT BYTES */
46
 uint8_t utf8_strlen(const char *pstart);
45
 uint8_t utf8_strlen(const char *pstart);
47
 uint8_t utf8_strlen_P(PGM_P pstart);
46
 uint8_t utf8_strlen_P(PGM_P pstart);
48
-
49
-#endif // _FONT_UTILS_H

+ 1
- 1
Marlin/src/lcd/language/language_zh_CN.h 查看文件

229
 #define MSG_E6STEPS                         _UxGT("挤出机6步数/mm") //"E6steps/mm"
229
 #define MSG_E6STEPS                         _UxGT("挤出机6步数/mm") //"E6steps/mm"
230
 #define MSG_TEMPERATURE                     _UxGT("温度")  //"Temperature"
230
 #define MSG_TEMPERATURE                     _UxGT("温度")  //"Temperature"
231
 #define MSG_MOTION                          _UxGT("运动")  //"Motion"
231
 #define MSG_MOTION                          _UxGT("运动")  //"Motion"
232
-#define MSG_FILAMENT                        _UxGT("丝料测容")  //"Filament" lcd_control_volumetric_menu
232
+#define MSG_FILAMENT                        _UxGT("丝料测容")  //"Filament" menu_advanced_filament
233
 #define MSG_VOLUMETRIC_ENABLED              _UxGT("测容积mm³")  //"E in mm3" volumetric_enabled
233
 #define MSG_VOLUMETRIC_ENABLED              _UxGT("测容积mm³")  //"E in mm3" volumetric_enabled
234
 #define MSG_FILAMENT_DIAM                   _UxGT("丝料直径")  //"Fil. Dia."
234
 #define MSG_FILAMENT_DIAM                   _UxGT("丝料直径")  //"Fil. Dia."
235
 #define MSG_FILAMENT_UNLOAD                 _UxGT("卸载 mm") // "Unload mm"
235
 #define MSG_FILAMENT_UNLOAD                 _UxGT("卸载 mm") // "Unload mm"

+ 1
- 1
Marlin/src/lcd/language/language_zh_TW.h 查看文件

229
 #define MSG_E6STEPS                         _UxGT("擠出機6步數/mm") //"E6steps/mm"
229
 #define MSG_E6STEPS                         _UxGT("擠出機6步數/mm") //"E6steps/mm"
230
 #define MSG_TEMPERATURE                     _UxGT("溫度")  //"Temperature"
230
 #define MSG_TEMPERATURE                     _UxGT("溫度")  //"Temperature"
231
 #define MSG_MOTION                          _UxGT("運作")  //"Motion"
231
 #define MSG_MOTION                          _UxGT("運作")  //"Motion"
232
-#define MSG_FILAMENT                        _UxGT("絲料測容")  //"Filament" lcd_control_volumetric_menu
232
+#define MSG_FILAMENT                        _UxGT("絲料測容")  //"Filament" menu_control_volumetric
233
 #define MSG_VOLUMETRIC_ENABLED              _UxGT("測容積mm³")  //"E in mm3" volumetric_enabled
233
 #define MSG_VOLUMETRIC_ENABLED              _UxGT("測容積mm³")  //"E in mm3" volumetric_enabled
234
 #define MSG_FILAMENT_DIAM                   _UxGT("絲料直徑")  //"Fil. Dia."
234
 #define MSG_FILAMENT_DIAM                   _UxGT("絲料直徑")  //"Fil. Dia."
235
 #define MSG_FILAMENT_UNLOAD                 _UxGT("卸載 mm") // "Unload mm"
235
 #define MSG_FILAMENT_UNLOAD                 _UxGT("卸載 mm") // "Unload mm"

+ 5
- 3
Marlin/src/lcd/lcdprint.h 查看文件

11
 
11
 
12
 #include "fontutils.h"
12
 #include "fontutils.h"
13
 
13
 
14
-#if DISABLED(DOGLCD)
15
-  #define _UxGT(a) a
14
+#include "../inc/MarlinConfigPre.h"
15
+
16
+#if HAS_GRAPHICAL_LCD
17
+  #include "dogm/u8g_fontutf8.h"
16
 #else
18
 #else
17
-  #include "u8g_fontutf8.h"
19
+  #define _UxGT(a) a
18
 #endif
20
 #endif
19
 
21
 
20
 #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u)
22
 #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u)

+ 4660
- 0
Marlin/src/lcd/menu/menu.cpp
文件差异内容过多而无法显示
查看文件


+ 396
- 0
Marlin/src/lcd/menu/menu.h 查看文件

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
+#pragma once
23
+
24
+#include "../ultralcd.h"
25
+#include "../../inc/MarlinConfig.h"
26
+
27
+extern uint32_t encoderPosition;
28
+extern int8_t encoderLine, encoderTopLine, screen_items;
29
+extern millis_t lastEncoderMovementMillis;
30
+extern bool screen_changed;
31
+
32
+constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
33
+
34
+void scroll_screen(const uint8_t limit, const bool is_menu);
35
+bool use_click();
36
+bool printer_busy();
37
+void lcd_completion_feedback(const bool good=true);
38
+void lcd_goto_previous_menu();
39
+void lcd_goto_previous_menu_no_defer();
40
+
41
+////////////////////////////////////////////
42
+///////// Menu Item Draw Functions /////////
43
+////////////////////////////////////////////
44
+
45
+#if ENABLED(SDSUPPORT)
46
+  class CardReader;
47
+#endif
48
+
49
+void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char);
50
+void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
51
+void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL);
52
+#if ENABLED(ADVANCED_PAUSE_FEATURE)
53
+  void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder);
54
+#endif
55
+#if HAS_GRAPHICAL_LCD
56
+  void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm);
57
+  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
58
+  #define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
59
+  #define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
60
+  #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, SRC)
61
+  #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
62
+  #if ENABLED(SDSUPPORT)
63
+    void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
64
+    #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, false)
65
+    #define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, true)
66
+  #endif
67
+  #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
68
+    void _lcd_zoffset_overlay_gfx(const float zvalue);
69
+  #endif
70
+#else
71
+  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
72
+  void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
73
+  void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
74
+  #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', SRC)
75
+  #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
76
+  #if ENABLED(SDSUPPORT)
77
+    void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard);
78
+    void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard);
79
+  #endif
80
+#endif
81
+#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
82
+#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
83
+#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
84
+
85
+#if ENABLED(AUTO_BED_LEVELING_UBL)
86
+  void lcd_implementation_ubl_plot(const uint8_t x, const uint8_t inverted_y);
87
+#endif
88
+
89
+////////////////////////////////////////////
90
+/////// Edit Setting Draw Functions ////////
91
+////////////////////////////////////////////
92
+
93
+#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(TYPE, NAME, STRFUNC) \
94
+  FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE * const data, ...) { \
95
+    UNUSED(pstr2); \
96
+    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
97
+  } \
98
+  FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_callback_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE * const data, ...) { \
99
+    UNUSED(pstr2); \
100
+    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
101
+  } \
102
+  FORCE_INLINE void lcd_implementation_drawmenu_setting_edit_accessor_ ## NAME (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \
103
+    UNUSED(pstr2); UNUSED(pset); \
104
+    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
105
+  } \
106
+  typedef void NAME##_void
107
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int3, itostr3);
108
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int4, itostr4sign);
109
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint8_t, int8, i8tostr3);
110
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3);
111
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52);
112
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign);
113
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj);
114
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign);
115
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52sign, ftostr52sign);
116
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj);
117
+DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint32_t, long5, ftostr5rj);
118
+
119
+#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data)                    DRAW_BOOL_SETTING(sel, row, pstr, data)
120
+#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) DRAW_BOOL_SETTING(sel, row, pstr, data)
121
+#define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset)     DRAW_BOOL_SETTING(sel, row, pstr, data)
122
+
123
+////////////////////////////////////////////
124
+/////////////// Menu Actions ///////////////
125
+////////////////////////////////////////////
126
+
127
+#define menu_action_back(dummy) _menu_action_back()
128
+void _menu_action_back();
129
+void menu_action_submenu(screenFunc_t data);
130
+void menu_action_function(menuAction_t data);
131
+void menu_action_gcode(const char* pgcode);
132
+
133
+#if ENABLED(SDSUPPORT)
134
+  void menu_action_sdfile(CardReader &theCard);
135
+  void menu_action_sddirectory(CardReader &theCard);
136
+#endif
137
+
138
+////////////////////////////////////////////
139
+/////////// Menu Editing Actions ///////////
140
+////////////////////////////////////////////
141
+
142
+#define DECLARE_MENU_EDIT_TYPE(TYPE, NAME) \
143
+  bool _menu_edit_ ## NAME(); \
144
+  void menu_edit_ ## NAME(); \
145
+  void menu_edit_callback_ ## NAME(); \
146
+  void _menu_action_setting_edit_ ## NAME(PGM_P const pstr, TYPE* const ptr, const TYPE minValue, const TYPE maxValue); \
147
+  void menu_action_setting_edit_callback_ ## NAME(PGM_P const pstr, TYPE * const ptr, const TYPE minValue, const TYPE maxValue, const screenFunc_t callback=NULL, const bool live=false); \
148
+  FORCE_INLINE void menu_action_setting_edit_ ## NAME(PGM_P const pstr, TYPE * const ptr, const TYPE minValue, const TYPE maxValue) { \
149
+    menu_action_setting_edit_callback_ ## NAME(pstr, ptr, minValue, maxValue); \
150
+  } \
151
+  typedef void NAME##_void
152
+
153
+DECLARE_MENU_EDIT_TYPE(int16_t, int3);
154
+DECLARE_MENU_EDIT_TYPE(int16_t, int4);
155
+DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
156
+DECLARE_MENU_EDIT_TYPE(float, float3);
157
+DECLARE_MENU_EDIT_TYPE(float, float52);
158
+DECLARE_MENU_EDIT_TYPE(float, float43);
159
+DECLARE_MENU_EDIT_TYPE(float, float5);
160
+DECLARE_MENU_EDIT_TYPE(float, float51);
161
+DECLARE_MENU_EDIT_TYPE(float, float52sign);
162
+DECLARE_MENU_EDIT_TYPE(float, float62);
163
+DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
164
+
165
+void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr);
166
+void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callbackFunc);
167
+
168
+////////////////////////////////////////////
169
+//////////// Menu System Macros ////////////
170
+////////////////////////////////////////////
171
+
172
+/**
173
+ * SCREEN_OR_MENU_LOOP generates init code for a screen or menu
174
+ *
175
+ *   encoderTopLine is the top menu line to display
176
+ *   _lcdLineNr is the index of the LCD line (e.g., 0-3)
177
+ *   _menuLineNr is the menu item to draw and process
178
+ *   _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM
179
+ */
180
+#define SCREEN_OR_MENU_LOOP() \
181
+  int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
182
+  for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \
183
+    _thisItemNr = 0
184
+
185
+/**
186
+ * START_SCREEN  Opening code for a screen having only static items.
187
+ *               Do simplified scrolling of the entire screen.
188
+ *
189
+ * START_MENU    Opening code for a screen with menu items.
190
+ *               Scroll as-needed to keep the selected line in view.
191
+ */
192
+#define START_SCREEN() \
193
+  scroll_screen(menu_bottom, false); \
194
+  bool _skipStatic = false; \
195
+  SCREEN_OR_MENU_LOOP()
196
+
197
+#define START_MENU() \
198
+  scroll_screen(1, true); \
199
+  bool _skipStatic = true; \
200
+  SCREEN_OR_MENU_LOOP()
201
+
202
+#define END_SCREEN() \
203
+  } \
204
+  screen_items = _thisItemNr
205
+
206
+#define END_MENU() \
207
+  } \
208
+  screen_items = _thisItemNr; \
209
+  UNUSED(_skipStatic)
210
+
211
+/**
212
+ * REVERSE_MENU_DIRECTION
213
+ *
214
+ * To reverse the menu direction we need a general way to reverse
215
+ * the direction of the encoder everywhere. So encoderDirection is
216
+ * added to allow the encoder to go the other way.
217
+ *
218
+ * This behavior is limited to scrolling Menus and SD card listings,
219
+ * and is disabled in other contexts.
220
+ */
221
+#if ENABLED(REVERSE_MENU_DIRECTION)
222
+  extern int8_t encoderDirection;
223
+  #define ENCODER_DIRECTION_NORMAL() (encoderDirection =  1)
224
+  #define ENCODER_DIRECTION_MENUS()  (encoderDirection = -1)
225
+#else
226
+  #define ENCODER_DIRECTION_NORMAL() NOOP
227
+  #define ENCODER_DIRECTION_MENUS()  NOOP
228
+#endif
229
+
230
+#if ENABLED(ENCODER_RATE_MULTIPLIER)
231
+
232
+  extern bool encoderRateMultiplierEnabled;
233
+  #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
234
+
235
+  //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
236
+
237
+  /**
238
+   * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
239
+   */
240
+  #define MENU_MULTIPLIER_ITEM(TYPE, LABEL, ...) do { \
241
+      _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
242
+      encoderRateMultiplierEnabled = true; \
243
+      lastEncoderMovementMillis = 0; \
244
+      _MENU_ITEM_PART_2(TYPE, PSTR(LABEL), ## __VA_ARGS__); \
245
+    }while(0)
246
+
247
+#else // !ENCODER_RATE_MULTIPLIER
248
+  #define ENCODER_RATE_MULTIPLY(F) NOOP
249
+#endif // !ENCODER_RATE_MULTIPLIER
250
+
251
+/**
252
+ * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
253
+ *
254
+ *   lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
255
+ *   menu_action_[type](arg3...)
256
+ *
257
+ * Examples:
258
+ *   MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
259
+ *   or
260
+ *   MENU_BACK(MSG_WATCH)
261
+ *     lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH))
262
+ *     menu_action_back()
263
+ *
264
+ *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
265
+ *     lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
266
+ *     menu_action_function(lcd_sdcard_pause)
267
+ *
268
+ *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
269
+ *   MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
270
+ *     lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
271
+ *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
272
+ *
273
+ */
274
+#define _MENU_ITEM_PART_1(TYPE, ...) \
275
+  if (_menuLineNr == _thisItemNr) { \
276
+    if (encoderLine == _thisItemNr && lcd_clicked) { \
277
+      lcd_clicked = false
278
+
279
+#define _MENU_ITEM_PART_2(TYPE, PLABEL, ...) \
280
+      menu_action_ ## TYPE(__VA_ARGS__); \
281
+      if (screen_changed) return; \
282
+    } \
283
+    if (lcdDrawUpdate) \
284
+      lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ## __VA_ARGS__); \
285
+  } \
286
+  ++_thisItemNr
287
+
288
+#define MENU_ITEM_P(TYPE, PLABEL, ...) do { \
289
+    _skipStatic = false; \
290
+    _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
291
+    _MENU_ITEM_PART_2(TYPE, PLABEL, ## __VA_ARGS__); \
292
+  }while(0)
293
+
294
+#define MENU_ITEM(TYPE, LABEL, ...) MENU_ITEM_P(TYPE, PSTR(LABEL), ## __VA_ARGS__)
295
+
296
+#define MENU_ITEM_ADDON_START(X) \
297
+  if (lcdDrawUpdate && _menuLineNr == _thisItemNr - 1) { \
298
+    SETCURSOR(X, _lcdLineNr)
299
+
300
+#define MENU_ITEM_ADDON_END() } (0)
301
+
302
+#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
303
+
304
+// Used to print static text with no visible cursor.
305
+// Parameters: label [, bool center [, bool invert [, char *value] ] ]
306
+#define STATIC_ITEM_P(LABEL, ...) do{ \
307
+  if (_menuLineNr == _thisItemNr) { \
308
+    if (_skipStatic && encoderLine <= _thisItemNr) { \
309
+      encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
310
+      ++encoderLine; \
311
+    } \
312
+    if (lcdDrawUpdate) \
313
+      lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \
314
+  } \
315
+  ++_thisItemNr; } while(0)
316
+
317
+#define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__)
318
+
319
+#define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
320
+#define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
321
+#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
322
+#if ENABLED(ENCODER_RATE_MULTIPLIER)
323
+  #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
324
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
325
+#else // !ENCODER_RATE_MULTIPLIER
326
+  #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
327
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
328
+#endif // !ENCODER_RATE_MULTIPLIER
329
+
330
+////////////////////////////////////////////
331
+/////////////// Menu Screens ///////////////
332
+////////////////////////////////////////////
333
+
334
+void menu_main();
335
+void menu_move();
336
+
337
+#if ENABLED(SDSUPPORT)
338
+  void menu_sdcard();
339
+#endif
340
+
341
+// First Fan Speed title in "Tune" and "Control>Temperature" menus
342
+#if FAN_COUNT > 0 && HAS_FAN0
343
+  #if FAN_COUNT > 1
344
+    #define FAN_SPEED_1_SUFFIX " 1"
345
+  #else
346
+    #define FAN_SPEED_1_SUFFIX ""
347
+  #endif
348
+#endif
349
+
350
+////////////////////////////////////////////
351
+//////// Menu Item Helper Functions ////////
352
+////////////////////////////////////////////
353
+
354
+void lcd_move_z();
355
+void lcd_synchronize(PGM_P const msg=NULL);
356
+void line_to_z(const float &z);
357
+void _lcd_draw_homing();
358
+
359
+void watch_temp_callback_E0();
360
+void watch_temp_callback_E1();
361
+void watch_temp_callback_E2();
362
+void watch_temp_callback_E3();
363
+void watch_temp_callback_E4();
364
+void watch_temp_callback_E5();
365
+void watch_temp_callback_bed();
366
+
367
+#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)
368
+  void lcd_enqueue_command(const char * const cmd);
369
+  void lcd_enqueue_commands_P(PGM_P const cmd);
370
+#endif
371
+
372
+#if ENABLED(LEVEL_BED_CORNERS)
373
+  void _lcd_level_bed_corners();
374
+#endif
375
+
376
+#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
377
+  extern float lcd_z_fade_height;
378
+  void _lcd_set_z_fade_height();
379
+#endif
380
+
381
+#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))
382
+  void _lcd_toggle_bed_leveling();
383
+#endif
384
+
385
+#if ENABLED(BABYSTEPPING)
386
+  #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
387
+    void lcd_babystep_zoffset();
388
+  #else
389
+    void lcd_babystep_z();
390
+  #endif
391
+#endif
392
+
393
+#if ENABLED(EEPROM_SETTINGS)
394
+  void lcd_store_settings();
395
+  void lcd_load_settings();
396
+#endif

+ 372
- 5158
Marlin/src/lcd/ultralcd.cpp
文件差异内容过多而无法显示
查看文件


+ 33
- 12
Marlin/src/lcd/ultralcd.h 查看文件

19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
-
23
-#ifndef ULTRALCD_H
24
-#define ULTRALCD_H
22
+#pragma once
25
 
23
 
26
 #include "../inc/MarlinConfig.h"
24
 #include "../inc/MarlinConfig.h"
27
 
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
34
+  };
35
+#endif
36
+
28
 #if ENABLED(ULTRA_LCD) || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
37
 #if ENABLED(ULTRA_LCD) || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
29
   void lcd_init();
38
   void lcd_init();
30
   bool lcd_detected();
39
   bool lcd_detected();
71
 
80
 
72
   #if HAS_BUZZER
81
   #if HAS_BUZZER
73
     void lcd_buzz(const long duration, const uint16_t freq);
82
     void lcd_buzz(const long duration, const uint16_t freq);
83
+  #else
84
+    inline void lcd_buzz(const long duration, const uint16_t freq) { UNUSED(duration); UNUSED(freq); }
74
   #endif
85
   #endif
75
 
86
 
76
   void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual
87
   void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual
108
   #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
119
   #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
109
   #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
120
   #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
110
 
121
 
111
-  #if ENABLED(ULTIPANEL) // LCD with a click-wheel input
122
+  #if HAS_LCD_MENU
112
 
123
 
113
-    extern bool defer_return_to_status;
114
-
115
-    // Function pointer to menu functions.
116
     typedef void (*screenFunc_t)();
124
     typedef void (*screenFunc_t)();
117
     typedef void (*menuAction_t)();
125
     typedef void (*menuAction_t)();
126
+    extern screenFunc_t currentScreen;
127
+    void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0);
128
+
129
+    extern bool lcd_clicked, defer_return_to_status;
118
 
130
 
119
     extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
131
     extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
120
     extern uint8_t lcd_preheat_fan_speed[2];
132
     extern uint8_t lcd_preheat_fan_speed[2];
131
       constexpr bool lcd_wait_for_move = false;
143
       constexpr bool lcd_wait_for_move = false;
132
     #endif
144
     #endif
133
 
145
 
134
-    void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0);
135
-
136
-    void lcd_completion_feedback(const bool good=true);
146
+    // Manual Movement
147
+    constexpr float manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE;
148
+    #if IS_KINEMATIC
149
+      extern bool processing_manual_move;
150
+    #else
151
+      constexpr bool processing_manual_move = false;
152
+    #endif
137
 
153
 
138
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
154
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
139
       void lcd_advanced_pause_show_message(const AdvancedPauseMessage message,
155
       void lcd_advanced_pause_show_message(const AdvancedPauseMessage message,
273
 
289
 
274
 #endif
290
 #endif
275
 
291
 
292
+#if ENABLED(LCD_HAS_SLOW_BUTTONS)
293
+  extern volatile uint8_t slow_buttons;
294
+#endif
295
+
276
 #if ENABLED(REPRAPWORLD_KEYPAD)
296
 #if ENABLED(REPRAPWORLD_KEYPAD)
277
   #ifdef EN_C
297
   #ifdef EN_C
278
     #define LCD_CLICKED ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU)
298
     #define LCD_CLICKED ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU)
297
   void lcd_reselect_last_file();
317
   void lcd_reselect_last_file();
298
 #endif
318
 #endif
299
 
319
 
300
-
301
-#endif // ULTRALCD_H
320
+// LCD implementations
321
+void lcd_implementation_clear();
322
+void lcd_implementation_init();

+ 2
- 4
Marlin/src/libs/duration_t.h 查看文件

19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
+#pragma once
22
 
23
 
23
-#ifndef __DURATION_T__
24
-#define __DURATION_T__
24
+#include <Arduino.h>
25
 
25
 
26
 struct duration_t {
26
 struct duration_t {
27
   /**
27
   /**
163
     }
163
     }
164
   }
164
   }
165
 };
165
 };
166
-
167
-#endif // __DURATION_T__

+ 1
- 1
Marlin/src/module/motion.h 查看文件

108
   extern bool soft_endstops_enabled;
108
   extern bool soft_endstops_enabled;
109
   void clamp_to_software_endstops(float target[XYZ]);
109
   void clamp_to_software_endstops(float target[XYZ]);
110
 #else
110
 #else
111
-  #define soft_endstops_enabled false
111
+  constexpr bool soft_endstops_enabled = false;
112
   #define clamp_to_software_endstops(x) NOOP
112
   #define clamp_to_software_endstops(x) NOOP
113
 #endif
113
 #endif
114
 
114
 

+ 1
- 1
buildroot/share/tests/megaatmega2560_tests 查看文件

30
 opt_set POWER_SUPPLY 1
30
 opt_set POWER_SUPPLY 1
31
 opt_set GRID_MAX_POINTS_X 16
31
 opt_set GRID_MAX_POINTS_X 16
32
 opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING \
32
 opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING \
33
-           REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS PINS_DEBUGGING \
33
+           REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST EEPROM_SETTINGS PINS_DEBUGGING \
34
            BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL \
34
            BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL \
35
            NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \
35
            NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \
36
            AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
36
            AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \

正在加载...
取消
保存