瀏覽代碼

Miscellaneous LCD code renaming, reordering (#12430)

* Move special characters to language.h
* Apply some naming standards
* Clean up menu item draw functions
* Rename some Temperature methods
* UI => ExtUI
Scott Lahteine 6 年之前
父節點
當前提交
d82c350de7
沒有連結到貢獻者的電子郵件帳戶。

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

94
   #define WEBSITE_URL DEFAULT_WEBSITE_URL
94
   #define WEBSITE_URL DEFAULT_WEBSITE_URL
95
 #endif
95
 #endif
96
 
96
 
97
+#if HAS_GRAPHICAL_LCD
98
+  //
99
+  // Custom characters from Marlin_symbols.fon which was merged into ISO10646-0-3.bdf
100
+  // \x00 intentionally skipped to avoid problems in strings
101
+  //
102
+  #define LCD_STR_REFRESH     "\x01"
103
+  #define LCD_STR_FOLDER      "\x02"
104
+  #define LCD_STR_ARROW_RIGHT "\x03"
105
+  #define LCD_STR_UPLEVEL     "\x04"
106
+  #define LCD_STR_CLOCK       "\x05"
107
+  #define LCD_STR_FEEDRATE    "\x06"
108
+  #define LCD_STR_BEDTEMP     "\x07"
109
+  #define LCD_STR_THERMOMETER "\x08"
110
+  #define LCD_STR_DEGREE      "\x09"
111
+
112
+  #define LCD_STR_SPECIAL_MAX '\x09'
113
+  // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin.
114
+  // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
115
+
116
+  // Symbol characters
117
+  #define LCD_STR_FILAM_DIA   "\xF8"
118
+  #define LCD_STR_FILAM_MUL   "\xA4"
119
+
120
+#elif HAS_CHARACTER_LCD
121
+
122
+  // Custom characters defined in the first 8 characters of the LCD
123
+  #define LCD_STR_BEDTEMP     "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!
124
+  #define LCD_STR_DEGREE      "\x01"
125
+  #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation
126
+  #define LCD_STR_UPLEVEL     "\x03"
127
+  #define LCD_STR_REFRESH     "\x04"
128
+  #define LCD_STR_FOLDER      "\x05"
129
+  #define LCD_STR_FEEDRATE    "\x06"
130
+  #define LCD_STR_CLOCK       "\x07"
131
+  #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
132
+
133
+#endif
134
+
97
 // Common LCD messages
135
 // Common LCD messages
98
 
136
 
99
   /* nothing here yet */
137
   /* nothing here yet */

+ 1
- 1
Marlin/src/feature/runout.h 查看文件

95
         if (ran_out) {
95
         if (ran_out) {
96
           filament_ran_out = true;
96
           filament_ran_out = true;
97
           #if ENABLED(EXTENSIBLE_UI)
97
           #if ENABLED(EXTENSIBLE_UI)
98
-            UI::onFilamentRunout();
98
+            ExtUI::onFilamentRunout();
99
           #endif
99
           #endif
100
           enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
100
           enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
101
           planner.synchronize();
101
           planner.synchronize();

+ 3
- 3
Marlin/src/gcode/eeprom/M500-M504.cpp 查看文件

45
 void GcodeSuite::M500() {
45
 void GcodeSuite::M500() {
46
   (void)settings.save(CHAT_PORT);
46
   (void)settings.save(CHAT_PORT);
47
   #if ENABLED(EXTENSIBLE_UI)
47
   #if ENABLED(EXTENSIBLE_UI)
48
-    UI::onStoreSettings();
48
+    ExtUI::onStoreSettings();
49
   #endif
49
   #endif
50
 }
50
 }
51
 
51
 
59
     #endif
59
     #endif
60
   );
60
   );
61
   #if ENABLED(EXTENSIBLE_UI)
61
   #if ENABLED(EXTENSIBLE_UI)
62
-    UI::onLoadSettings();
62
+    ExtUI::onLoadSettings();
63
   #endif
63
   #endif
64
 }
64
 }
65
 
65
 
69
 void GcodeSuite::M502() {
69
 void GcodeSuite::M502() {
70
   (void)settings.reset(CHAT_PORT);
70
   (void)settings.reset(CHAT_PORT);
71
   #if ENABLED(EXTENSIBLE_UI)
71
   #if ENABLED(EXTENSIBLE_UI)
72
-    UI::onFactoryReset();
72
+    ExtUI::onFactoryReset();
73
   #endif
73
   #endif
74
 }
74
 }
75
 
75
 

+ 3
- 3
Marlin/src/gcode/stats/M75-M78.cpp 查看文件

33
 void GcodeSuite::M75() {
33
 void GcodeSuite::M75() {
34
   print_job_timer.start();
34
   print_job_timer.start();
35
   #if ENABLED(EXTENSIBLE_UI)
35
   #if ENABLED(EXTENSIBLE_UI)
36
-    UI::onPrintTimerStarted();
36
+    ExtUI::onPrintTimerStarted();
37
   #endif
37
   #endif
38
 }
38
 }
39
 
39
 
43
 void GcodeSuite::M76() {
43
 void GcodeSuite::M76() {
44
   print_job_timer.pause();
44
   print_job_timer.pause();
45
   #if ENABLED(EXTENSIBLE_UI)
45
   #if ENABLED(EXTENSIBLE_UI)
46
-    UI::onPrintTimerPaused();
46
+    ExtUI::onPrintTimerPaused();
47
   #endif
47
   #endif
48
 }
48
 }
49
 
49
 
53
 void GcodeSuite::M77() {
53
 void GcodeSuite::M77() {
54
  print_job_timer.stop();
54
  print_job_timer.stop();
55
  #if ENABLED(EXTENSIBLE_UI)
55
  #if ENABLED(EXTENSIBLE_UI)
56
-   UI::onPrintTimerStopped();
56
+   ExtUI::onPrintTimerStopped();
57
  #endif
57
  #endif
58
 }
58
 }
59
 
59
 

+ 1
- 37
Marlin/src/inc/Conditionals_LCD.h 查看文件

309
 #define HAS_DIGITAL_ENCODER  ENABLED(NEWPANEL)
309
 #define HAS_DIGITAL_ENCODER  ENABLED(NEWPANEL)
310
 
310
 
311
 #if HAS_GRAPHICAL_LCD
311
 #if HAS_GRAPHICAL_LCD
312
-  //
313
-  // Custom characters from Marlin_symbols.fon which was merged into ISO10646-0-3.bdf
314
-  // \x00 intentionally skipped to avoid problems in strings
315
-  //
316
-  #define LCD_STR_REFRESH     "\x01"
317
-  #define LCD_STR_FOLDER      "\x02"
318
-  #define LCD_STR_ARROW_RIGHT "\x03"
319
-  #define LCD_STR_UPLEVEL     "\x04"
320
-  #define LCD_STR_CLOCK       "\x05"
321
-  #define LCD_STR_FEEDRATE    "\x06"
322
-  #define LCD_STR_BEDTEMP     "\x07"
323
-  #define LCD_STR_THERMOMETER "\x08"
324
-  #define LCD_STR_DEGREE      "\x09"
325
-
326
-  #define LCD_STR_SPECIAL_MAX '\x09'
327
-  // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin.
328
-  // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
329
-
330
-  // Symbol characters
331
-  #define LCD_STR_FILAM_DIA   "\xf8"
332
-  #define LCD_STR_FILAM_MUL   "\xa4"
333
-
334
   /**
312
   /**
335
-   * Default LCD contrast for dogm-like LCD displays
313
+   * Default LCD contrast for Graphical LCD displays
336
    */
314
    */
337
   #define HAS_LCD_CONTRAST (                \
315
   #define HAS_LCD_CONTRAST (                \
338
        ENABLED(MAKRPANEL)                   \
316
        ENABLED(MAKRPANEL)                   \
353
       #define DEFAULT_LCD_CONTRAST 32
331
       #define DEFAULT_LCD_CONTRAST 32
354
     #endif
332
     #endif
355
   #endif
333
   #endif
356
-
357
-#else
358
-
359
-  // Custom characters defined in the first 8 characters of the LCD
360
-  #define LCD_BEDTEMP_CHAR     0x00  // Print only as a char. This will have 'unexpected' results when used in a string!
361
-  #define LCD_DEGREE_CHAR      0x01
362
-  #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation
363
-  #define LCD_UPLEVEL_CHAR     0x03
364
-  #define LCD_STR_REFRESH     "\x04"
365
-  #define LCD_STR_FOLDER      "\x05"
366
-  #define LCD_FEEDRATE_CHAR    0x06
367
-  #define LCD_CLOCK_CHAR       0x07
368
-  #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
369
-
370
 #endif
334
 #endif
371
 
335
 
372
 // Boot screens
336
 // Boot screens

+ 22
- 31
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp 查看文件

290
     else
290
     else
291
   #endif
291
   #endif
292
     { // Info Screen uses 5 special characters
292
     { // Info Screen uses 5 special characters
293
-      createChar_P(LCD_BEDTEMP_CHAR, bedTemp);
294
-      createChar_P(LCD_DEGREE_CHAR, degree);
293
+      createChar_P(LCD_STR_BEDTEMP[0], bedTemp);
294
+      createChar_P(LCD_STR_DEGREE[0], degree);
295
       createChar_P(LCD_STR_THERMOMETER[0], thermometer);
295
       createChar_P(LCD_STR_THERMOMETER[0], thermometer);
296
-      createChar_P(LCD_FEEDRATE_CHAR, feedrate);
297
-      createChar_P(LCD_CLOCK_CHAR, clock);
296
+      createChar_P(LCD_STR_FEEDRATE[0], feedrate);
297
+      createChar_P(LCD_STR_CLOCK[0], clock);
298
 
298
 
299
       #if ENABLED(LCD_PROGRESS_BAR)
299
       #if ENABLED(LCD_PROGRESS_BAR)
300
         if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen
300
         if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen
304
         else
304
         else
305
       #endif
305
       #endif
306
         {
306
         {
307
-          createChar_P(LCD_UPLEVEL_CHAR, uplevel);
307
+          createChar_P(LCD_STR_UPLEVEL[0], uplevel);
308
           #if ENABLED(SDSUPPORT)
308
           #if ENABLED(SDSUPPORT)
309
             // SD Card sub-menu special characters
309
             // SD Card sub-menu special characters
310
             createChar_P(LCD_STR_REFRESH[0], refresh);
310
             createChar_P(LCD_STR_REFRESH[0], refresh);
553
       lcd_put_u8str(itostr3left(t2 + 0.5));
553
       lcd_put_u8str(itostr3left(t2 + 0.5));
554
 
554
 
555
   if (prefix >= 0) {
555
   if (prefix >= 0) {
556
-    lcd_put_wchar(LCD_DEGREE_CHAR);
556
+    lcd_put_wchar(LCD_STR_DEGREE[0]);
557
     lcd_put_wchar(' ');
557
     lcd_put_wchar(' ');
558
     if (t2 < 10) lcd_put_wchar(' ');
558
     if (t2 < 10) lcd_put_wchar(' ');
559
   }
559
   }
564
     #if HAS_LEVELING
564
     #if HAS_LEVELING
565
       planner.leveling_active && blink ? '_' :
565
       planner.leveling_active && blink ? '_' :
566
     #endif
566
     #endif
567
-    LCD_BEDTEMP_CHAR
567
+    LCD_STR_BEDTEMP[0]
568
   ), blink);
568
   ), blink);
569
 }
569
 }
570
 
570
 
769
       //
769
       //
770
       #if HOTENDS > 1
770
       #if HOTENDS > 1
771
         lcd_moveto(8, 0);
771
         lcd_moveto(8, 0);
772
-        lcd_put_wchar((char)LCD_STR_THERMOMETER[0]);
772
+        lcd_put_wchar(LCD_STR_THERMOMETER[0]);
773
         _draw_heater_status(1, -1, blink);
773
         _draw_heater_status(1, -1, blink);
774
       #elif HAS_HEATED_BED
774
       #elif HAS_HEATED_BED
775
         lcd_moveto(8, 0);
775
         lcd_moveto(8, 0);
776
-        lcd_put_wchar((char)LCD_BEDTEMP_CHAR);
776
+        lcd_put_wchar(LCD_STR_BEDTEMP[0]);
777
         _draw_heater_status(-1, -1, blink);
777
         _draw_heater_status(-1, -1, blink);
778
       #endif
778
       #endif
779
 
779
 
850
     #if LCD_HEIGHT > 3
850
     #if LCD_HEIGHT > 3
851
 
851
 
852
       lcd_moveto(0, 2);
852
       lcd_moveto(0, 2);
853
-      lcd_put_wchar(LCD_FEEDRATE_CHAR);
853
+      lcd_put_wchar(LCD_STR_FEEDRATE[0]);
854
       lcd_put_u8str(itostr3(feedrate_percentage));
854
       lcd_put_u8str(itostr3(feedrate_percentage));
855
       lcd_put_wchar('%');
855
       lcd_put_wchar('%');
856
 
856
 
859
       const uint8_t len = elapsed.toDigital(buffer),
859
       const uint8_t len = elapsed.toDigital(buffer),
860
                     timepos = LCD_WIDTH - len - 1;
860
                     timepos = LCD_WIDTH - len - 1;
861
       lcd_moveto(timepos, 2);
861
       lcd_moveto(timepos, 2);
862
-      lcd_put_wchar(LCD_CLOCK_CHAR);
862
+      lcd_put_wchar(LCD_STR_CLOCK[0]);
863
       lcd_put_u8str(buffer);
863
       lcd_put_u8str(buffer);
864
 
864
 
865
       #if LCD_WIDTH >= 20
865
       #if LCD_WIDTH >= 20
921
     #endif
921
     #endif
922
 
922
 
923
     lcd_moveto(LCD_WIDTH - 9, 1);
923
     lcd_moveto(LCD_WIDTH - 9, 1);
924
-    lcd_put_wchar(LCD_FEEDRATE_CHAR);
924
+    lcd_put_wchar(LCD_STR_FEEDRATE[0]);
925
     lcd_put_u8str(itostr3(feedrate_percentage));
925
     lcd_put_u8str(itostr3(feedrate_percentage));
926
     lcd_put_wchar('%');
926
     lcd_put_wchar('%');
927
 
927
 
950
       duration_t elapsed = print_job_timer.duration();
950
       duration_t elapsed = print_job_timer.duration();
951
       char buffer[14];
951
       char buffer[14];
952
       (void)elapsed.toDigital(buffer);
952
       (void)elapsed.toDigital(buffer);
953
-      lcd_put_wchar(LCD_CLOCK_CHAR);
953
+      lcd_put_wchar(LCD_STR_CLOCK[0]);
954
       lcd_put_u8str(buffer);
954
       lcd_put_u8str(buffer);
955
     #endif
955
     #endif
956
 
956
 
990
     for (; n > 0; --n) lcd_put_wchar(' ');
990
     for (; n > 0; --n) lcd_put_wchar(' ');
991
   }
991
   }
992
 
992
 
993
-  void draw_menu_item_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
993
+  void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
994
     uint8_t n = LCD_WIDTH - 2;
994
     uint8_t n = LCD_WIDTH - 2;
995
     lcd_moveto(0, row);
995
     lcd_moveto(0, row);
996
-    lcd_put_wchar(isSelected ? pre_char : ' ');
996
+    lcd_put_wchar(sel ? pre_char : ' ');
997
     n -= lcd_put_u8str_max_P(pstr, n);
997
     n -= lcd_put_u8str_max_P(pstr, n);
998
     while (n--) lcd_put_wchar(' ');
998
     while (n--) lcd_put_wchar(' ');
999
     lcd_put_wchar(post_char);
999
     lcd_put_wchar(post_char);
1000
   }
1000
   }
1001
 
1001
 
1002
-  void draw_menu_item_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1003
-    uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
1002
+  void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
1003
+    uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data));
1004
     lcd_moveto(0, row);
1004
     lcd_moveto(0, row);
1005
-    lcd_put_wchar(isSelected ? pre_char : ' ');
1005
+    lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1006
     n -= lcd_put_u8str_max_P(pstr, n);
1006
     n -= lcd_put_u8str_max_P(pstr, n);
1007
     lcd_put_wchar(':');
1007
     lcd_put_wchar(':');
1008
     while (n--) lcd_put_wchar(' ');
1008
     while (n--) lcd_put_wchar(' ');
1009
-    lcd_put_u8str(data);
1010
-  }
1011
-  void draw_menu_item_setting_edit_generic_P(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
1012
-    uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
1013
-    lcd_moveto(0, row);
1014
-    lcd_put_wchar(isSelected ? pre_char : ' ');
1015
-    n -= lcd_put_u8str_max_P(pstr, n);
1016
-    lcd_put_wchar(':');
1017
-    while (n--) lcd_put_wchar(' ');
1018
-    lcd_put_u8str_P(data);
1009
+    if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str(data);
1019
   }
1010
   }
1020
 
1011
 
1021
   void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) {
1012
   void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) {
1033
 
1024
 
1034
   #if ENABLED(SDSUPPORT)
1025
   #if ENABLED(SDSUPPORT)
1035
 
1026
 
1036
-    void draw_sd_menu_item(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
1027
+    void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
1037
       const char post_char = isDir ? LCD_STR_FOLDER[0] : ' ',
1028
       const char post_char = isDir ? LCD_STR_FOLDER[0] : ' ',
1038
-                 sel_char = isSelected ? '>' : ' ';
1029
+                 sel_char = sel ? LCD_STR_ARROW_RIGHT[0] : ' ';
1039
       UNUSED(pstr);
1030
       UNUSED(pstr);
1040
       lcd_moveto(0, row);
1031
       lcd_moveto(0, row);
1041
       lcd_put_wchar(sel_char);
1032
       lcd_put_wchar(sel_char);
1045
       if (theCard.longFilename[0]) {
1036
       if (theCard.longFilename[0]) {
1046
         #if ENABLED(SCROLL_LONG_FILENAMES)
1037
         #if ENABLED(SCROLL_LONG_FILENAMES)
1047
           static uint8_t filename_scroll_hash;
1038
           static uint8_t filename_scroll_hash;
1048
-          if (isSelected) {
1039
+          if (sel) {
1049
             uint8_t name_hash = row;
1040
             uint8_t name_hash = row;
1050
             for (uint8_t l = FILENAME_LENGTH; l--;)
1041
             for (uint8_t l = FILENAME_LENGTH; l--;)
1051
               name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l];  // rotate, xor
1042
               name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l];  // rotate, xor

+ 9
- 9
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp 查看文件

265
   #endif // ADVANCED_PAUSE_FEATURE
265
   #endif // ADVANCED_PAUSE_FEATURE
266
 
266
 
267
   // Set the colors for a menu item based on whether it is selected
267
   // Set the colors for a menu item based on whether it is selected
268
-  static bool mark_as_selected(const uint8_t row, const bool isSelected) {
268
+  static bool mark_as_selected(const uint8_t row, const bool sel) {
269
     row_y1 = row * (MENU_FONT_HEIGHT) + 1;
269
     row_y1 = row * (MENU_FONT_HEIGHT) + 1;
270
     row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
270
     row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
271
 
271
 
272
     if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false;
272
     if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false;
273
 
273
 
274
-    if (isSelected) {
274
+    if (sel) {
275
       #if ENABLED(MENU_HOLLOW_FRAME)
275
       #if ENABLED(MENU_HOLLOW_FRAME)
276
         u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH);
276
         u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH);
277
         u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH);
277
         u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH);
314
   }
314
   }
315
 
315
 
316
   // Draw a generic menu item
316
   // Draw a generic menu item
317
-  void draw_menu_item_generic(const bool isSelected, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) {
317
+  void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) {
318
     UNUSED(pre_char);
318
     UNUSED(pre_char);
319
 
319
 
320
-    if (mark_as_selected(row, isSelected)) {
320
+    if (mark_as_selected(row, sel)) {
321
       uint8_t n = LCD_WIDTH - 2;
321
       uint8_t n = LCD_WIDTH - 2;
322
       n *= MENU_FONT_WIDTH;
322
       n *= MENU_FONT_WIDTH;
323
       n -= lcd_put_u8str_max_P(pstr, n);
323
       n -= lcd_put_u8str_max_P(pstr, n);
329
   }
329
   }
330
 
330
 
331
   // Draw a menu item with an editable value
331
   // Draw a menu item with an editable value
332
-  void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
333
-    if (mark_as_selected(row, isSelected)) {
332
+  void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
333
+    if (mark_as_selected(row, sel)) {
334
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
334
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
335
       uint8_t n = LCD_WIDTH - 2 - vallen;
335
       uint8_t n = LCD_WIDTH - 2 - vallen;
336
       n *= MENU_FONT_WIDTH;
336
       n *= MENU_FONT_WIDTH;
396
 
396
 
397
   #if ENABLED(SDSUPPORT)
397
   #if ENABLED(SDSUPPORT)
398
 
398
 
399
-    void draw_sd_menu_item(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
399
+    void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
400
       UNUSED(pstr);
400
       UNUSED(pstr);
401
 
401
 
402
-      mark_as_selected(row, isSelected);
402
+      mark_as_selected(row, sel);
403
 
403
 
404
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
404
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
405
 
405
 
408
       if (theCard.longFilename[0]) {
408
       if (theCard.longFilename[0]) {
409
         #if ENABLED(SCROLL_LONG_FILENAMES)
409
         #if ENABLED(SCROLL_LONG_FILENAMES)
410
           static uint8_t filename_scroll_hash;
410
           static uint8_t filename_scroll_hash;
411
-          if (isSelected) {
411
+          if (sel) {
412
             uint8_t name_hash = row;
412
             uint8_t name_hash = row;
413
             for (uint8_t l = FILENAME_LENGTH; l--;)
413
             for (uint8_t l = FILENAME_LENGTH; l--;)
414
               name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l];  // rotate, xor
414
               name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l];  // rotate, xor

+ 2
- 2
Marlin/src/lcd/extensible_ui/lib/example.cpp 查看文件

27
 
27
 
28
 // To implement a new UI, complete the functions below and
28
 // To implement a new UI, complete the functions below and
29
 // read or update Marlin's state using the methods in the
29
 // read or update Marlin's state using the methods in the
30
-// UI methods in "../ui_api.h"
30
+// ExtUI methods in "../ui_api.h"
31
 //
31
 //
32
 // Although it may be possible to access other state
32
 // Although it may be possible to access other state
33
 // variables from Marlin, using the API here possibly
33
 // variables from Marlin, using the API here possibly
34
 // helps ensure future compatibility.
34
 // helps ensure future compatibility.
35
 
35
 
36
-namespace UI {
36
+namespace ExtUI {
37
   void onStartup() {
37
   void onStartup() {
38
     /* Initialize the display module here. The following
38
     /* Initialize the display module here. The following
39
      * routines are available for access to the GPIO pins:
39
      * routines are available for access to the GPIO pins:

+ 15
- 15
Marlin/src/lcd/extensible_ui/ui_api.cpp 查看文件

93
   uint8_t manual_motion : 1;
93
   uint8_t manual_motion : 1;
94
 } flags;
94
 } flags;
95
 
95
 
96
-namespace UI {
96
+namespace ExtUI {
97
   #ifdef __SAM3X8E__
97
   #ifdef __SAM3X8E__
98
     /**
98
     /**
99
      * Implement a special millis() to allow time measurement
99
      * Implement a special millis() to allow time measurement
593
       #if ENABLED(PARK_HEAD_ON_PAUSE)
593
       #if ENABLED(PARK_HEAD_ON_PAUSE)
594
         enqueue_and_echo_commands_P(PSTR("M125"));
594
         enqueue_and_echo_commands_P(PSTR("M125"));
595
       #endif
595
       #endif
596
-      UI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
596
+      ExtUI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
597
     #endif
597
     #endif
598
   }
598
   }
599
 
599
 
605
         card.startFileprint();
605
         card.startFileprint();
606
         print_job_timer.start();
606
         print_job_timer.start();
607
       #endif
607
       #endif
608
-      UI::onStatusChanged(PSTR(MSG_PRINTING));
608
+      ExtUI::onStatusChanged(PSTR(MSG_PRINTING));
609
     #endif
609
     #endif
610
   }
610
   }
611
 
611
 
613
     #if ENABLED(SDSUPPORT)
613
     #if ENABLED(SDSUPPORT)
614
       wait_for_heatup = wait_for_user = false;
614
       wait_for_heatup = wait_for_user = false;
615
       card.abort_sd_printing = true;
615
       card.abort_sd_printing = true;
616
-      UI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
616
+      ExtUI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
617
     #endif
617
     #endif
618
   }
618
   }
619
 
619
 
678
     #endif
678
     #endif
679
   }
679
   }
680
 
680
 
681
-} // namespace UI
681
+} // namespace ExtUI
682
 
682
 
683
 // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
683
 // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
684
 
684
 
686
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
686
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
687
     SET_INPUT_PULLUP(SD_DETECT_PIN);
687
     SET_INPUT_PULLUP(SD_DETECT_PIN);
688
   #endif
688
   #endif
689
-  UI::onStartup();
689
+  ExtUI::onStartup();
690
 }
690
 }
691
 
691
 
692
 void MarlinUI::update() {
692
 void MarlinUI::update() {
698
       if (sd_status) {
698
       if (sd_status) {
699
         card.initsd();
699
         card.initsd();
700
         if (card.cardOK)
700
         if (card.cardOK)
701
-          UI::onMediaInserted();
701
+          ExtUI::onMediaInserted();
702
         else
702
         else
703
-          UI::onMediaError();
703
+          ExtUI::onMediaError();
704
       }
704
       }
705
       else {
705
       else {
706
         const bool ok = card.cardOK;
706
         const bool ok = card.cardOK;
707
         card.release();
707
         card.release();
708
-        if (ok) UI::onMediaRemoved();
708
+        if (ok) ExtUI::onMediaRemoved();
709
       }
709
       }
710
     }
710
     }
711
   #endif // SDSUPPORT
711
   #endif // SDSUPPORT
712
-  UI::_processManualMoveToDestination();
713
-  UI::onIdle();
712
+  ExtUI::_processManualMoveToDestination();
713
+  ExtUI::onIdle();
714
 }
714
 }
715
 
715
 
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); }
716
+void MarlinUI::setstatus(const char * const message, const bool persist/*=false*/)  { ExtUI::onStatusChanged(message); }
717
+void MarlinUI::setstatusPGM(PGM_P const message, int8_t level/*=0*/)                { ExtUI::onStatusChanged((progmem_str)message); }
718
 void MarlinUI::setalertstatusPGM(PGM_P const message)                               { setstatusPGM(message, 0); }
718
 void MarlinUI::setalertstatusPGM(PGM_P const message)                               { setstatusPGM(message, 0); }
719
 
719
 
720
 void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
720
 void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
724
   vsnprintf_P(buff, sizeof(buff), fmt, args);
724
   vsnprintf_P(buff, sizeof(buff), fmt, args);
725
   va_end(args);
725
   va_end(args);
726
   buff[63] = '\0';
726
   buff[63] = '\0';
727
-  UI::onStatusChanged(buff);
727
+  ExtUI::onStatusChanged(buff);
728
 }
728
 }
729
 
729
 
730
 void MarlinUI::kill_screen(PGM_P const msg) {
730
 void MarlinUI::kill_screen(PGM_P const msg) {
731
   if (!flags.printer_killed) {
731
   if (!flags.printer_killed) {
732
     flags.printer_killed = true;
732
     flags.printer_killed = true;
733
-    UI::onPrinterKilled(msg);
733
+    ExtUI::onPrinterKilled(msg);
734
   }
734
   }
735
 }
735
 }
736
 
736
 

+ 3
- 3
Marlin/src/lcd/extensible_ui/ui_api.h 查看文件

47
 
47
 
48
 typedef const __FlashStringHelper *progmem_str;
48
 typedef const __FlashStringHelper *progmem_str;
49
 
49
 
50
-namespace UI {
50
+namespace ExtUI {
51
 
51
 
52
   enum axis_t     : uint8_t { X, Y, Z };
52
   enum axis_t     : uint8_t { X, Y, Z };
53
   enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 };
53
   enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 };
257
  *   UI_INCREMENT(TargetTemp_celsius, E0)
257
  *   UI_INCREMENT(TargetTemp_celsius, E0)
258
  *
258
  *
259
  */
259
  */
260
-#define UI_INCREMENT_BY(method, inc, ...) UI::set ## method(UI::get ## method (__VA_ARGS__) + inc, ##__VA_ARGS__)
261
-#define UI_DECREMENT_BY(method, inc, ...) UI::set ## method(UI::get ## method (__VA_ARGS__) - inc, ##__VA_ARGS__)
260
+#define UI_INCREMENT_BY(method, inc, ...) ExtUI::set ## method(ExtUI::get ## method (__VA_ARGS__) + inc, ##__VA_ARGS__)
261
+#define UI_DECREMENT_BY(method, inc, ...) ExtUI::set ## method(ExtUI::get ## method (__VA_ARGS__) - inc, ##__VA_ARGS__)
262
 
262
 
263
 #define UI_INCREMENT(method, ...) UI_INCREMENT_BY(method, increment, ##__VA_ARGS__)
263
 #define UI_INCREMENT(method, ...) UI_INCREMENT_BY(method, increment, ##__VA_ARGS__)
264
 #define UI_DECREMENT(method, ...) UI_DECREMENT_BY(method, increment, ##__VA_ARGS__)
264
 #define UI_DECREMENT(method, ...) UI_DECREMENT_BY(method, increment, ##__VA_ARGS__)

+ 8
- 8
Marlin/src/lcd/menu/menu.cpp 查看文件

102
 /////////// Common Menu Actions ////////////
102
 /////////// Common Menu Actions ////////////
103
 ////////////////////////////////////////////
103
 ////////////////////////////////////////////
104
 
104
 
105
-void menu_item_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); }
105
+void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); }
106
 
106
 
107
 ////////////////////////////////////////////
107
 ////////////////////////////////////////////
108
 /////////// Menu Editing Actions ///////////
108
 /////////// Menu Editing Actions ///////////
119
  *
119
  *
120
  * For example, DEFINE_MENU_EDIT_ITEM(int3) expands into these functions:
120
  * For example, DEFINE_MENU_EDIT_ITEM(int3) expands into these functions:
121
  *
121
  *
122
- *   bool menu_item_int3::_edit();
123
- *   void menu_item_int3::edit(); // edit int16_t (interactively)
124
- *   void menu_item_int3::action_setting_edit(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback = null, const bool live = false);
122
+ *   bool MenuItem_int3::_edit();
123
+ *   void MenuItem_int3::edit(); // edit int16_t (interactively)
124
+ *   void MenuItem_int3::action_edit(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback = null, const bool live = false);
125
  *
125
  *
126
  * You can then use one of the menu macros to present the edit interface:
126
  * You can then use one of the menu macros to present the edit interface:
127
  *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
127
  *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
128
  *
128
  *
129
  * This expands into a more primitive menu item:
129
  * This expands into a more primitive menu item:
130
- *   MENU_ITEM_VARIANT(int3, _setting_edit, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
130
+ *   MENU_ITEM_VARIANT(int3, _edit, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
131
  *
131
  *
132
  * ...which calls:
132
  * ...which calls:
133
- *       menu_item_int3::action_setting_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
133
+ *       MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
134
  */
134
  */
135
 void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
135
 void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
136
   ui.encoder_direction_normal();
136
   ui.encoder_direction_normal();
158
   liveEdit = le;
158
   liveEdit = le;
159
 }
159
 }
160
 
160
 
161
-#define DEFINE_MENU_EDIT_ITEM(NAME) template class TMenuItem<NAME ## _item_info>;
161
+#define DEFINE_MENU_EDIT_ITEM(NAME) template class TMenuItem<MenuItemInfo_##NAME>;
162
 
162
 
163
 DEFINE_MENU_EDIT_ITEM(int3);
163
 DEFINE_MENU_EDIT_ITEM(int3);
164
 DEFINE_MENU_EDIT_ITEM(int4);
164
 DEFINE_MENU_EDIT_ITEM(int4);
172
 DEFINE_MENU_EDIT_ITEM(float62);
172
 DEFINE_MENU_EDIT_ITEM(float62);
173
 DEFINE_MENU_EDIT_ITEM(long5);
173
 DEFINE_MENU_EDIT_ITEM(long5);
174
 
174
 
175
-void menu_item_bool::action_setting_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) {
175
+void MenuItem_bool::action_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) {
176
   UNUSED(pstr); *ptr ^= true; ui.refresh();
176
   UNUSED(pstr); *ptr ^= true; ui.refresh();
177
   if (callback) (*callback)();
177
   if (callback) (*callback)();
178
 }
178
 }

+ 73
- 79
Marlin/src/lcd/menu/menu.h 查看文件

37
 ////////////////////////////////////////////
37
 ////////////////////////////////////////////
38
 
38
 
39
 #define DECLARE_MENU_EDIT_TYPE(TYPE, NAME, STRFUNC, SCALE) \
39
 #define DECLARE_MENU_EDIT_TYPE(TYPE, NAME, STRFUNC, SCALE) \
40
-  struct NAME ## _item_info { \
40
+  struct MenuItemInfo_##NAME { \
41
     typedef TYPE type_t; \
41
     typedef TYPE type_t; \
42
     static constexpr float scale = SCALE; \
42
     static constexpr float scale = SCALE; \
43
     static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \
43
     static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \
44
   };
44
   };
45
 
45
 
46
-DECLARE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1);
47
-DECLARE_MENU_EDIT_TYPE(int16_t, int4, itostr4sign, 1);
48
-DECLARE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1);
49
-DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1);
50
-DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100);
51
-DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000);
52
-DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f);
53
-DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10);
54
-DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100);
55
-DECLARE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100);
56
-DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f);
46
+DECLARE_MENU_EDIT_TYPE(int16_t,  int3,        itostr3,         1     );
47
+DECLARE_MENU_EDIT_TYPE(int16_t,  int4,        itostr4sign,     1     );
48
+DECLARE_MENU_EDIT_TYPE(uint8_t,  int8,        i8tostr3,        1     );
49
+DECLARE_MENU_EDIT_TYPE(float,    float3,      ftostr3,         1     );
50
+DECLARE_MENU_EDIT_TYPE(float,    float52,     ftostr52,      100     );
51
+DECLARE_MENU_EDIT_TYPE(float,    float43,     ftostr43sign, 1000     );
52
+DECLARE_MENU_EDIT_TYPE(float,    float5,      ftostr5rj,       0.01f );
53
+DECLARE_MENU_EDIT_TYPE(float,    float51,     ftostr51sign,   10     );
54
+DECLARE_MENU_EDIT_TYPE(float,    float52sign, ftostr52sign,  100     );
55
+DECLARE_MENU_EDIT_TYPE(float,    float62,     ftostr62rj,    100     );
56
+DECLARE_MENU_EDIT_TYPE(uint32_t, long5,       ftostr5rj,       0.01f );
57
 
57
 
58
 ////////////////////////////////////////////
58
 ////////////////////////////////////////////
59
 ///////// Menu Item Draw Functions /////////
59
 ///////// Menu Item Draw Functions /////////
60
 ////////////////////////////////////////////
60
 ////////////////////////////////////////////
61
 
61
 
62
-void draw_menu_item_generic(const bool isSelected, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
63
-void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
64
 void draw_edit_screen(PGM_P const pstr, const char* const value=NULL);
62
 void draw_edit_screen(PGM_P const pstr, const char* const value=NULL);
63
+void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
64
+void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL);
65
+void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm);
66
+FORCE_INLINE void draw_menu_item_back(const bool sel, const uint8_t row, PGM_P const pstr) { draw_menu_item(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]); }
67
+FORCE_INLINE void draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data) { _draw_menu_item_edit(sel, row, pstr, data, false); }
68
+FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data) { _draw_menu_item_edit(sel, row, pstr, data, true); }
69
+#define draw_menu_item_submenu(sel, row, pstr, data)  draw_menu_item(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
70
+#define draw_menu_item_gcode(sel, row, pstr, gcode)   draw_menu_item(sel, row, pstr, '>', ' ')
71
+#define draw_menu_item_function(sel, row, pstr, data) draw_menu_item(sel, row, pstr, '>', ' ')
72
+#define DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(VAL)      draw_menu_item_edit(sel, row, pstr, VAL)
73
+#define DRAW_BOOL_SETTING(sel, row, pstr, data)       draw_menu_item_edit_P(sel, row, pstr, (*(data))?PSTR(MSG_LCD_ON):PSTR(MSG_LCD_OFF))
74
+
65
 #if ENABLED(SDSUPPORT)
75
 #if ENABLED(SDSUPPORT)
66
   class CardReader;
76
   class CardReader;
67
-  void draw_sd_menu_item(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
68
-  inline void draw_menu_item_sdfile(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, false); }
69
-  inline void draw_menu_item_sdfolder(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, true); }
77
+  void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir);
78
+  FORCE_INLINE void draw_menu_item_sdfile(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, false); }
79
+  FORCE_INLINE void draw_menu_item_sdfolder(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, true); }
70
 #endif
80
 #endif
71
-#if HAS_GRAPHICAL_LCD
72
-  void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm);
73
-  #define draw_menu_item_back(sel, row, pstr) draw_menu_item_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
74
-  #define draw_menu_item_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
75
-  #define draw_menu_item_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
76
-  #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) draw_menu_item_setting_edit_generic(sel, row, pstr, SRC)
77
-  #define DRAW_BOOL_SETTING(sel, row, pstr, data) draw_menu_item_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_LCD_ON):PSTR(MSG_LCD_OFF))
78
-  #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)
79
-    void _lcd_zoffset_overlay_gfx(const float zvalue);
80
-  #endif
81
-#else
82
-  #define draw_menu_item_back(sel, row, pstr) draw_menu_item_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
83
-  void draw_menu_item_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
84
-  void draw_menu_item_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data);
85
-  #define DRAWMENU_SETTING_EDIT_GENERIC(SRC) draw_menu_item_setting_edit_generic(sel, row, pstr, '>', SRC)
86
-  #define DRAW_BOOL_SETTING(sel, row, pstr, data) draw_menu_item_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_LCD_ON):PSTR(MSG_LCD_OFF))
81
+
82
+#if HAS_GRAPHICAL_LCD && (ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY))
83
+  void _lcd_zoffset_overlay_gfx(const float zvalue);
87
 #endif
84
 #endif
88
-#define draw_menu_item_submenu(sel, row, pstr, data) draw_menu_item_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
89
-#define draw_menu_item_gcode(sel, row, pstr, gcode) draw_menu_item_generic(sel, row, pstr, '>', ' ')
90
-#define draw_menu_item_function(sel, row, pstr, data) draw_menu_item_generic(sel, row, pstr, '>', ' ')
91
 
85
 
92
 ////////////////////////////////////////////
86
 ////////////////////////////////////////////
93
 /////// Edit Setting Draw Functions ////////
87
 /////// Edit Setting Draw Functions ////////
94
 ////////////////////////////////////////////
88
 ////////////////////////////////////////////
95
 
89
 
96
-#define _DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(TYPE, NAME, STRFUNC) \
97
-  FORCE_INLINE void draw_menu_item_setting_edit_ ## NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE * const data, ...) { \
90
+#define _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(TYPE, NAME, STRFUNC) \
91
+  FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE * const data, ...) { \
98
     UNUSED(pstr2); \
92
     UNUSED(pstr2); \
99
-    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
93
+    DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
100
   } \
94
   } \
101
-  FORCE_INLINE void draw_menu_item_setting_edit_accessor_ ## NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \
95
+  FORCE_INLINE void draw_menu_item_edit_accessor_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \
102
     UNUSED(pstr2); UNUSED(pset); \
96
     UNUSED(pstr2); UNUSED(pset); \
103
-    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
97
+    DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
104
   } \
98
   } \
105
   typedef void NAME##_void
99
   typedef void NAME##_void
106
-#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(NAME) _DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(NAME ## _item_info::type_t, NAME, NAME ## _item_info::strfunc)
107
-
108
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int3);
109
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int4);
110
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int8);
111
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float3);
112
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float52);
113
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float43);
114
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float5);
115
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float51);
116
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float52sign);
117
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float62);
118
-DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(long5);
119
-
120
-#define draw_menu_item_setting_edit_bool(sel, row, pstr, pstr2, data, ...)           DRAW_BOOL_SETTING(sel, row, pstr, data)
121
-#define draw_menu_item_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data)
100
+#define DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(NAME) _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(MenuItemInfo_##NAME::type_t, NAME, MenuItemInfo_##NAME::strfunc)
101
+
102
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3);
103
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4);
104
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8);
105
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3);
106
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52);
107
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43);
108
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5);
109
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51);
110
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign);
111
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float62);
112
+DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5);
113
+
114
+#define draw_menu_item_edit_bool(sel, row, pstr, pstr2, data, ...)           DRAW_BOOL_SETTING(sel, row, pstr, data)
115
+#define draw_menu_item_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data)
122
 
116
 
123
 ////////////////////////////////////////////
117
 ////////////////////////////////////////////
124
 /////////////// Menu Actions ///////////////
118
 /////////////// Menu Actions ///////////////
125
 ////////////////////////////////////////////
119
 ////////////////////////////////////////////
126
 
120
 
127
-class menu_item_back {
121
+class MenuItem_back {
128
   public:
122
   public:
129
     static inline void action() { ui.goto_previous_screen(); }
123
     static inline void action() { ui.goto_previous_screen(); }
130
 };
124
 };
131
 
125
 
132
-class menu_item_submenu {
126
+class MenuItem_submenu {
133
   public:
127
   public:
134
     static inline void action(const screenFunc_t func) { ui.save_previous_screen(); ui.goto_screen(func); }
128
     static inline void action(const screenFunc_t func) { ui.save_previous_screen(); ui.goto_screen(func); }
135
 };
129
 };
136
 
130
 
137
-class menu_item_gcode {
131
+class MenuItem_gcode {
138
   public:
132
   public:
139
     static void action(const char * const pgcode);
133
     static void action(const char * const pgcode);
140
 };
134
 };
141
 
135
 
142
-class menu_item_function {
136
+class MenuItem_function {
143
   public:
137
   public:
144
     static inline void action(const menuAction_t func) { (*func)(); };
138
     static inline void action(const menuAction_t func) { (*func)(); };
145
 };
139
 };
160
 class TMenuItem : MenuItemBase {
154
 class TMenuItem : MenuItemBase {
161
   private:
155
   private:
162
     typedef typename NAME::type_t type_t;
156
     typedef typename NAME::type_t type_t;
163
-    inline static float unscale(const float value)    {return value * (1.0f / NAME::scale);}
164
-    inline static float scale(const float value)      {return value * NAME::scale;}
165
-    static void  load(void *ptr, const int32_t value) {*((type_t*)ptr) = unscale(value);}
166
-    static char* to_string(const int32_t value)       {return NAME::strfunc(unscale(value));}
157
+    inline static float unscale(const float value)    { return value * (1.0f / NAME::scale);  }
158
+    inline static float scale(const float value)      { return value * NAME::scale;           }
159
+    static void  load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value);     }
160
+    static char* to_string(const int32_t value)       { return NAME::strfunc(unscale(value)); }
167
   public:
161
   public:
168
-    static void action_setting_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) {
162
+    static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) {
169
       const int32_t minv = scale(minValue);
163
       const int32_t minv = scale(minValue);
170
       init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live);
164
       init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live);
171
     }
165
     }
172
     static void edit() { MenuItemBase::edit(to_string, load); }
166
     static void edit() { MenuItemBase::edit(to_string, load); }
173
 };
167
 };
174
 
168
 
175
-#define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem<NAME ## _item_info> menu_item_ ## NAME;
169
+#define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem<MenuItemInfo_##NAME> MenuItem_##NAME;
176
 
170
 
177
 DECLARE_MENU_EDIT_ITEM(int3);
171
 DECLARE_MENU_EDIT_ITEM(int3);
178
 DECLARE_MENU_EDIT_ITEM(int4);
172
 DECLARE_MENU_EDIT_ITEM(int4);
186
 DECLARE_MENU_EDIT_ITEM(float62);
180
 DECLARE_MENU_EDIT_ITEM(float62);
187
 DECLARE_MENU_EDIT_ITEM(long5);
181
 DECLARE_MENU_EDIT_ITEM(long5);
188
 
182
 
189
-class menu_item_bool {
183
+class MenuItem_bool {
190
   public:
184
   public:
191
-    static void action_setting_edit(PGM_P const pstr, bool* ptr, const screenFunc_t callbackFunc=NULL);
185
+    static void action_edit(PGM_P const pstr, bool* ptr, const screenFunc_t callbackFunc=NULL);
192
 };
186
 };
193
 
187
 
194
 ////////////////////////////////////////////
188
 ////////////////////////////////////////////
247
  * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
241
  * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
248
  *
242
  *
249
  *   draw_menu_item_<type>[_variant](sel, row, label, arg3...)
243
  *   draw_menu_item_<type>[_variant](sel, row, label, arg3...)
250
- *   menu_item_<type>::action[_variant](arg3...)
244
+ *   MenuItem_<type>::action[_variant](arg3...)
251
  *
245
  *
252
  * Examples:
246
  * Examples:
253
  *   MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
247
  *   MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
254
  *   or
248
  *   or
255
  *   MENU_BACK(MSG_WATCH)
249
  *   MENU_BACK(MSG_WATCH)
256
  *     draw_menu_item_back(sel, row, PSTR(MSG_WATCH))
250
  *     draw_menu_item_back(sel, row, PSTR(MSG_WATCH))
257
- *     menu_item_back::action()
251
+ *     MenuItem_back::action()
258
  *
252
  *
259
  *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
253
  *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
260
  *     draw_menu_item_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
254
  *     draw_menu_item_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
261
- *     menu_item_function::action(lcd_sdcard_pause)
255
+ *     MenuItem_function::action(lcd_sdcard_pause)
262
  *
256
  *
263
  *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
257
  *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
264
- *     draw_menu_item_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
265
- *     menu_item_int3::action_setting_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
258
+ *     draw_menu_item_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
259
+ *     MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
266
  *
260
  *
267
  */
261
  */
268
 #define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, ...) do { \
262
 #define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, ...) do { \
270
     if (_menuLineNr == _thisItemNr) { \
264
     if (_menuLineNr == _thisItemNr) { \
271
       if (encoderLine == _thisItemNr && ui.use_click()) { \
265
       if (encoderLine == _thisItemNr && ui.use_click()) { \
272
         _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \
266
         _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \
273
-        menu_item_ ## TYPE ::action ## VARIANT(__VA_ARGS__); \
267
+        MenuItem_##TYPE ::action ## VARIANT(__VA_ARGS__); \
274
         if (screen_changed) return; \
268
         if (screen_changed) return; \
275
       } \
269
       } \
276
       if (ui.should_draw()) \
270
       if (ui.should_draw()) \
305
 #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
299
 #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
306
 #define MENU_ITEM_P(TYPE, PLABEL, ...)                       _MENU_ITEM_VARIANT_P(TYPE,              , false, PLABEL,                   ## __VA_ARGS__)
300
 #define MENU_ITEM_P(TYPE, PLABEL, ...)                       _MENU_ITEM_VARIANT_P(TYPE,              , false, PLABEL,                   ## __VA_ARGS__)
307
 #define MENU_ITEM(TYPE, LABEL, ...)                          _MENU_ITEM_VARIANT_P(TYPE,              , false, PSTR(LABEL),              ## __VA_ARGS__)
301
 #define MENU_ITEM(TYPE, LABEL, ...)                          _MENU_ITEM_VARIANT_P(TYPE,              , false, PSTR(LABEL),              ## __VA_ARGS__)
308
-#define MENU_ITEM_EDIT(TYPE, LABEL, ...)                     _MENU_ITEM_VARIANT_P(TYPE, _setting_edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
309
-#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...)            _MENU_ITEM_VARIANT_P(TYPE, _setting_edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
310
-#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...)          _MENU_ITEM_VARIANT_P(TYPE, _setting_edit,  true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
311
-#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _setting_edit,  true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
302
+#define MENU_ITEM_EDIT(TYPE, LABEL, ...)                     _MENU_ITEM_VARIANT_P(TYPE, _edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
303
+#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...)            _MENU_ITEM_VARIANT_P(TYPE, _edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
304
+#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...)          _MENU_ITEM_VARIANT_P(TYPE, _edit,  true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
305
+#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _edit,  true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__)
312
 
306
 
313
 ////////////////////////////////////////////
307
 ////////////////////////////////////////////
314
 /////////////// Menu Screens ///////////////
308
 /////////////// Menu Screens ///////////////

+ 2
- 2
Marlin/src/lcd/menu/menu_sdcard.cpp 查看文件

72
   }
72
   }
73
 #endif
73
 #endif
74
 
74
 
75
-class menu_item_sdfile {
75
+class MenuItem_sdfile {
76
   public:
76
   public:
77
     static void action(CardReader &theCard) {
77
     static void action(CardReader &theCard) {
78
       #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
78
       #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
84
     }
84
     }
85
 };
85
 };
86
 
86
 
87
-class menu_item_sdfolder {
87
+class MenuItem_sdfolder {
88
   public:
88
   public:
89
     static void action(CardReader &theCard) {
89
     static void action(CardReader &theCard) {
90
       card.chdir(theCard.filename);
90
       card.chdir(theCard.filename);

+ 1
- 1
Marlin/src/lcd/ultralcd.cpp 查看文件

269
             #if HAS_LCD_MENU
269
             #if HAS_LCD_MENU
270
               if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
270
               if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
271
               else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
271
               else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
272
-              else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { menu_item_back::action(); quick_feedback(); }
272
+              else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { MenuItem_back::action(); quick_feedback(); }
273
               else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { return_to_status(); quick_feedback(); }
273
               else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { return_to_status(); quick_feedback(); }
274
             #endif
274
             #endif
275
           }
275
           }

+ 1
- 1
Marlin/src/libs/buzzer.cpp 查看文件

64
     if (state.tone.frequency > 0) {
64
     if (state.tone.frequency > 0) {
65
       #if ENABLED(EXTENSIBLE_UI)
65
       #if ENABLED(EXTENSIBLE_UI)
66
         CRITICAL_SECTION_START;
66
         CRITICAL_SECTION_START;
67
-        UI::onPlayTone(state.tone.frequency, state.tone.duration);
67
+        ExtUI::onPlayTone(state.tone.frequency, state.tone.duration);
68
         CRITICAL_SECTION_END;
68
         CRITICAL_SECTION_END;
69
       #elif ENABLED(SPEAKER)
69
       #elif ENABLED(SPEAKER)
70
         CRITICAL_SECTION_START;
70
         CRITICAL_SECTION_START;

+ 13
- 13
Marlin/src/module/temperature.cpp 查看文件

943
 
943
 
944
 // Derived from RepRap FiveD extruder::getTemperature()
944
 // Derived from RepRap FiveD extruder::getTemperature()
945
 // For hot end temperature measurement.
945
 // For hot end temperature measurement.
946
-float Temperature::analog2temp(const int raw, const uint8_t e) {
946
+float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
947
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
947
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
948
     if (e > HOTENDS)
948
     if (e > HOTENDS)
949
   #else
949
   #else
1015
 #if HAS_HEATED_BED
1015
 #if HAS_HEATED_BED
1016
   // Derived from RepRap FiveD extruder::getTemperature()
1016
   // Derived from RepRap FiveD extruder::getTemperature()
1017
   // For bed temperature measurement.
1017
   // For bed temperature measurement.
1018
-  float Temperature::analog2tempBed(const int raw) {
1018
+  float Temperature::analog_to_celsius_bed(const int raw) {
1019
     #if ENABLED(HEATER_BED_USES_THERMISTOR)
1019
     #if ENABLED(HEATER_BED_USES_THERMISTOR)
1020
       SCAN_THERMISTOR_TABLE(BEDTEMPTABLE, BEDTEMPTABLE_LEN);
1020
       SCAN_THERMISTOR_TABLE(BEDTEMPTABLE, BEDTEMPTABLE_LEN);
1021
     #elif ENABLED(HEATER_BED_USES_AD595)
1021
     #elif ENABLED(HEATER_BED_USES_AD595)
1031
 #if HAS_TEMP_CHAMBER
1031
 #if HAS_TEMP_CHAMBER
1032
   // Derived from RepRap FiveD extruder::getTemperature()
1032
   // Derived from RepRap FiveD extruder::getTemperature()
1033
   // For chamber temperature measurement.
1033
   // For chamber temperature measurement.
1034
-  float Temperature::analog2tempChamber(const int raw) {
1034
+  float Temperature::analog_to_celsiusChamber(const int raw) {
1035
     #if ENABLED(HEATER_CHAMBER_USES_THERMISTOR)
1035
     #if ENABLED(HEATER_CHAMBER_USES_THERMISTOR)
1036
       SCAN_THERMISTOR_TABLE(CHAMBERTEMPTABLE, CHAMBERTEMPTABLE_LEN);
1036
       SCAN_THERMISTOR_TABLE(CHAMBERTEMPTABLE, CHAMBERTEMPTABLE_LEN);
1037
     #elif ENABLED(HEATER_CHAMBER_USES_AD595)
1037
     #elif ENABLED(HEATER_CHAMBER_USES_AD595)
1054
   #if ENABLED(HEATER_0_USES_MAX6675)
1054
   #if ENABLED(HEATER_0_USES_MAX6675)
1055
     current_temperature_raw[0] = read_max6675();
1055
     current_temperature_raw[0] = read_max6675();
1056
   #endif
1056
   #endif
1057
-  HOTEND_LOOP() current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
1057
+  HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e);
1058
   #if HAS_HEATED_BED
1058
   #if HAS_HEATED_BED
1059
-    current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
1059
+    current_temperature_bed = analog_to_celsius_bed(current_temperature_bed_raw);
1060
   #endif
1060
   #endif
1061
   #if HAS_TEMP_CHAMBER
1061
   #if HAS_TEMP_CHAMBER
1062
-    current_temperature_chamber = Temperature::analog2tempChamber(current_temperature_chamber_raw);
1062
+    current_temperature_chamber = analog_to_celsiusChamber(current_temperature_chamber_raw);
1063
   #endif
1063
   #endif
1064
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1064
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1065
-    redundant_temperature = Temperature::analog2temp(redundant_temperature_raw, 1);
1065
+    redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1);
1066
   #endif
1066
   #endif
1067
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
1067
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
1068
-    filament_width_meas = analog2widthFil();
1068
+    filament_width_meas = analog_to_mm_fil_width();
1069
   #endif
1069
   #endif
1070
 
1070
 
1071
   #if ENABLED(USE_WATCHDOG)
1071
   #if ENABLED(USE_WATCHDOG)
1080
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
1080
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
1081
 
1081
 
1082
   // Convert raw Filament Width to millimeters
1082
   // Convert raw Filament Width to millimeters
1083
-  float Temperature::analog2widthFil() {
1083
+  float Temperature::analog_to_mm_fil_width() {
1084
     return current_raw_filwidth * 5.0f * (1.0f / 16383.0f);
1084
     return current_raw_filwidth * 5.0f * (1.0f / 16383.0f);
1085
   }
1085
   }
1086
 
1086
 
1299
 
1299
 
1300
   #define TEMP_MIN_ROUTINE(NR) \
1300
   #define TEMP_MIN_ROUTINE(NR) \
1301
     minttemp[NR] = HEATER_ ##NR## _MINTEMP; \
1301
     minttemp[NR] = HEATER_ ##NR## _MINTEMP; \
1302
-    while (analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \
1302
+    while (analog_to_celsius_hotend(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \
1303
       if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
1303
       if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
1304
         minttemp_raw[NR] += OVERSAMPLENR; \
1304
         minttemp_raw[NR] += OVERSAMPLENR; \
1305
       else \
1305
       else \
1307
     }
1307
     }
1308
   #define TEMP_MAX_ROUTINE(NR) \
1308
   #define TEMP_MAX_ROUTINE(NR) \
1309
     maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \
1309
     maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \
1310
-    while (analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \
1310
+    while (analog_to_celsius_hotend(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \
1311
       if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
1311
       if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
1312
         maxttemp_raw[NR] -= OVERSAMPLENR; \
1312
         maxttemp_raw[NR] -= OVERSAMPLENR; \
1313
       else \
1313
       else \
1363
 
1363
 
1364
   #if HAS_HEATED_BED
1364
   #if HAS_HEATED_BED
1365
     #ifdef BED_MINTEMP
1365
     #ifdef BED_MINTEMP
1366
-      while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
1366
+      while (analog_to_celsius_bed(bed_minttemp_raw) < BED_MINTEMP) {
1367
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1367
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1368
           bed_minttemp_raw += OVERSAMPLENR;
1368
           bed_minttemp_raw += OVERSAMPLENR;
1369
         #else
1369
         #else
1372
       }
1372
       }
1373
     #endif // BED_MINTEMP
1373
     #endif // BED_MINTEMP
1374
     #ifdef BED_MAXTEMP
1374
     #ifdef BED_MAXTEMP
1375
-      while (analog2tempBed(bed_maxttemp_raw) > BED_MAXTEMP) {
1375
+      while (analog_to_celsius_bed(bed_maxttemp_raw) > BED_MAXTEMP) {
1376
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1376
         #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
1377
           bed_maxttemp_raw -= OVERSAMPLENR;
1377
           bed_maxttemp_raw -= OVERSAMPLENR;
1378
         #else
1378
         #else

+ 4
- 4
Marlin/src/module/temperature.h 查看文件

311
     /**
311
     /**
312
      * Static (class) methods
312
      * Static (class) methods
313
      */
313
      */
314
-    static float analog2temp(const int raw, const uint8_t e);
314
+    static float analog_to_celsius_hotend(const int raw, const uint8_t e);
315
 
315
 
316
     #if HAS_HEATED_BED
316
     #if HAS_HEATED_BED
317
-      static float analog2tempBed(const int raw);
317
+      static float analog_to_celsius_bed(const int raw);
318
     #endif
318
     #endif
319
     #if HAS_TEMP_CHAMBER
319
     #if HAS_TEMP_CHAMBER
320
-      static float analog2tempChamber(const int raw);
320
+      static float analog_to_celsiusChamber(const int raw);
321
     #endif
321
     #endif
322
 
322
 
323
     /**
323
     /**
358
     #endif
358
     #endif
359
 
359
 
360
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
360
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
361
-      static float analog2widthFil();         // Convert raw Filament Width to millimeters
361
+      static float analog_to_mm_fil_width();         // Convert raw Filament Width to millimeters
362
       static int8_t widthFil_to_size_ratio(); // Convert Filament Width (mm) to an extrusion ratio
362
       static int8_t widthFil_to_size_ratio(); // Convert Filament Width (mm) to an extrusion ratio
363
     #endif
363
     #endif
364
 
364
 

Loading…
取消
儲存