ソースを参照

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,6 +94,44 @@
94 94
   #define WEBSITE_URL DEFAULT_WEBSITE_URL
95 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 135
 // Common LCD messages
98 136
 
99 137
   /* nothing here yet */

+ 1
- 1
Marlin/src/feature/runout.h ファイルの表示

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

+ 3
- 3
Marlin/src/gcode/eeprom/M500-M504.cpp ファイルの表示

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

+ 3
- 3
Marlin/src/gcode/stats/M75-M78.cpp ファイルの表示

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

+ 1
- 37
Marlin/src/inc/Conditionals_LCD.h ファイルの表示

@@ -309,30 +309,8 @@
309 309
 #define HAS_DIGITAL_ENCODER  ENABLED(NEWPANEL)
310 310
 
311 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 315
   #define HAS_LCD_CONTRAST (                \
338 316
        ENABLED(MAKRPANEL)                   \
@@ -353,20 +331,6 @@
353 331
       #define DEFAULT_LCD_CONTRAST 32
354 332
     #endif
355 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 334
 #endif
371 335
 
372 336
 // Boot screens

+ 22
- 31
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp ファイルの表示

@@ -290,11 +290,11 @@ void MarlinUI::set_custom_characters(
290 290
     else
291 291
   #endif
292 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 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 299
       #if ENABLED(LCD_PROGRESS_BAR)
300 300
         if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen
@@ -304,7 +304,7 @@ void MarlinUI::set_custom_characters(
304 304
         else
305 305
       #endif
306 306
         {
307
-          createChar_P(LCD_UPLEVEL_CHAR, uplevel);
307
+          createChar_P(LCD_STR_UPLEVEL[0], uplevel);
308 308
           #if ENABLED(SDSUPPORT)
309 309
             // SD Card sub-menu special characters
310 310
             createChar_P(LCD_STR_REFRESH[0], refresh);
@@ -553,7 +553,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
553 553
       lcd_put_u8str(itostr3left(t2 + 0.5));
554 554
 
555 555
   if (prefix >= 0) {
556
-    lcd_put_wchar(LCD_DEGREE_CHAR);
556
+    lcd_put_wchar(LCD_STR_DEGREE[0]);
557 557
     lcd_put_wchar(' ');
558 558
     if (t2 < 10) lcd_put_wchar(' ');
559 559
   }
@@ -564,7 +564,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
564 564
     #if HAS_LEVELING
565 565
       planner.leveling_active && blink ? '_' :
566 566
     #endif
567
-    LCD_BEDTEMP_CHAR
567
+    LCD_STR_BEDTEMP[0]
568 568
   ), blink);
569 569
 }
570 570
 
@@ -769,11 +769,11 @@ void MarlinUI::draw_status_screen() {
769 769
       //
770 770
       #if HOTENDS > 1
771 771
         lcd_moveto(8, 0);
772
-        lcd_put_wchar((char)LCD_STR_THERMOMETER[0]);
772
+        lcd_put_wchar(LCD_STR_THERMOMETER[0]);
773 773
         _draw_heater_status(1, -1, blink);
774 774
       #elif HAS_HEATED_BED
775 775
         lcd_moveto(8, 0);
776
-        lcd_put_wchar((char)LCD_BEDTEMP_CHAR);
776
+        lcd_put_wchar(LCD_STR_BEDTEMP[0]);
777 777
         _draw_heater_status(-1, -1, blink);
778 778
       #endif
779 779
 
@@ -850,7 +850,7 @@ void MarlinUI::draw_status_screen() {
850 850
     #if LCD_HEIGHT > 3
851 851
 
852 852
       lcd_moveto(0, 2);
853
-      lcd_put_wchar(LCD_FEEDRATE_CHAR);
853
+      lcd_put_wchar(LCD_STR_FEEDRATE[0]);
854 854
       lcd_put_u8str(itostr3(feedrate_percentage));
855 855
       lcd_put_wchar('%');
856 856
 
@@ -859,7 +859,7 @@ void MarlinUI::draw_status_screen() {
859 859
       const uint8_t len = elapsed.toDigital(buffer),
860 860
                     timepos = LCD_WIDTH - len - 1;
861 861
       lcd_moveto(timepos, 2);
862
-      lcd_put_wchar(LCD_CLOCK_CHAR);
862
+      lcd_put_wchar(LCD_STR_CLOCK[0]);
863 863
       lcd_put_u8str(buffer);
864 864
 
865 865
       #if LCD_WIDTH >= 20
@@ -921,7 +921,7 @@ void MarlinUI::draw_status_screen() {
921 921
     #endif
922 922
 
923 923
     lcd_moveto(LCD_WIDTH - 9, 1);
924
-    lcd_put_wchar(LCD_FEEDRATE_CHAR);
924
+    lcd_put_wchar(LCD_STR_FEEDRATE[0]);
925 925
     lcd_put_u8str(itostr3(feedrate_percentage));
926 926
     lcd_put_wchar('%');
927 927
 
@@ -950,7 +950,7 @@ void MarlinUI::draw_status_screen() {
950 950
       duration_t elapsed = print_job_timer.duration();
951 951
       char buffer[14];
952 952
       (void)elapsed.toDigital(buffer);
953
-      lcd_put_wchar(LCD_CLOCK_CHAR);
953
+      lcd_put_wchar(LCD_STR_CLOCK[0]);
954 954
       lcd_put_u8str(buffer);
955 955
     #endif
956 956
 
@@ -990,32 +990,23 @@ void MarlinUI::draw_status_screen() {
990 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 994
     uint8_t n = LCD_WIDTH - 2;
995 995
     lcd_moveto(0, row);
996
-    lcd_put_wchar(isSelected ? pre_char : ' ');
996
+    lcd_put_wchar(sel ? pre_char : ' ');
997 997
     n -= lcd_put_u8str_max_P(pstr, n);
998 998
     while (n--) lcd_put_wchar(' ');
999 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 1004
     lcd_moveto(0, row);
1005
-    lcd_put_wchar(isSelected ? pre_char : ' ');
1005
+    lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
1006 1006
     n -= lcd_put_u8str_max_P(pstr, n);
1007 1007
     lcd_put_wchar(':');
1008 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 1012
   void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) {
@@ -1033,9 +1024,9 @@ void MarlinUI::draw_status_screen() {
1033 1024
 
1034 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 1028
       const char post_char = isDir ? LCD_STR_FOLDER[0] : ' ',
1038
-                 sel_char = isSelected ? '>' : ' ';
1029
+                 sel_char = sel ? LCD_STR_ARROW_RIGHT[0] : ' ';
1039 1030
       UNUSED(pstr);
1040 1031
       lcd_moveto(0, row);
1041 1032
       lcd_put_wchar(sel_char);
@@ -1045,7 +1036,7 @@ void MarlinUI::draw_status_screen() {
1045 1036
       if (theCard.longFilename[0]) {
1046 1037
         #if ENABLED(SCROLL_LONG_FILENAMES)
1047 1038
           static uint8_t filename_scroll_hash;
1048
-          if (isSelected) {
1039
+          if (sel) {
1049 1040
             uint8_t name_hash = row;
1050 1041
             for (uint8_t l = FILENAME_LENGTH; l--;)
1051 1042
               name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l];  // rotate, xor

+ 9
- 9
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp ファイルの表示

@@ -265,13 +265,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
265 265
   #endif // ADVANCED_PAUSE_FEATURE
266 266
 
267 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 269
     row_y1 = row * (MENU_FONT_HEIGHT) + 1;
270 270
     row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
271 271
 
272 272
     if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false;
273 273
 
274
-    if (isSelected) {
274
+    if (sel) {
275 275
       #if ENABLED(MENU_HOLLOW_FRAME)
276 276
         u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH);
277 277
         u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH);
@@ -314,10 +314,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
314 314
   }
315 315
 
316 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 318
     UNUSED(pre_char);
319 319
 
320
-    if (mark_as_selected(row, isSelected)) {
320
+    if (mark_as_selected(row, sel)) {
321 321
       uint8_t n = LCD_WIDTH - 2;
322 322
       n *= MENU_FONT_WIDTH;
323 323
       n -= lcd_put_u8str_max_P(pstr, n);
@@ -329,8 +329,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
329 329
   }
330 330
 
331 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 334
       const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
335 335
       uint8_t n = LCD_WIDTH - 2 - vallen;
336 336
       n *= MENU_FONT_WIDTH;
@@ -396,10 +396,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
396 396
 
397 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 400
       UNUSED(pstr);
401 401
 
402
-      mark_as_selected(row, isSelected);
402
+      mark_as_selected(row, sel);
403 403
 
404 404
       if (!PAGE_CONTAINS(row_y1, row_y2)) return;
405 405
 
@@ -408,7 +408,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
408 408
       if (theCard.longFilename[0]) {
409 409
         #if ENABLED(SCROLL_LONG_FILENAMES)
410 410
           static uint8_t filename_scroll_hash;
411
-          if (isSelected) {
411
+          if (sel) {
412 412
             uint8_t name_hash = row;
413 413
             for (uint8_t l = FILENAME_LENGTH; l--;)
414 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,13 +27,13 @@
27 27
 
28 28
 // To implement a new UI, complete the functions below and
29 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 32
 // Although it may be possible to access other state
33 33
 // variables from Marlin, using the API here possibly
34 34
 // helps ensure future compatibility.
35 35
 
36
-namespace UI {
36
+namespace ExtUI {
37 37
   void onStartup() {
38 38
     /* Initialize the display module here. The following
39 39
      * routines are available for access to the GPIO pins:

+ 15
- 15
Marlin/src/lcd/extensible_ui/ui_api.cpp ファイルの表示

@@ -93,7 +93,7 @@ static struct {
93 93
   uint8_t manual_motion : 1;
94 94
 } flags;
95 95
 
96
-namespace UI {
96
+namespace ExtUI {
97 97
   #ifdef __SAM3X8E__
98 98
     /**
99 99
      * Implement a special millis() to allow time measurement
@@ -593,7 +593,7 @@ namespace UI {
593 593
       #if ENABLED(PARK_HEAD_ON_PAUSE)
594 594
         enqueue_and_echo_commands_P(PSTR("M125"));
595 595
       #endif
596
-      UI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
596
+      ExtUI::onStatusChanged(PSTR(MSG_PRINT_PAUSED));
597 597
     #endif
598 598
   }
599 599
 
@@ -605,7 +605,7 @@ namespace UI {
605 605
         card.startFileprint();
606 606
         print_job_timer.start();
607 607
       #endif
608
-      UI::onStatusChanged(PSTR(MSG_PRINTING));
608
+      ExtUI::onStatusChanged(PSTR(MSG_PRINTING));
609 609
     #endif
610 610
   }
611 611
 
@@ -613,7 +613,7 @@ namespace UI {
613 613
     #if ENABLED(SDSUPPORT)
614 614
       wait_for_heatup = wait_for_user = false;
615 615
       card.abort_sd_printing = true;
616
-      UI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
616
+      ExtUI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
617 617
     #endif
618 618
   }
619 619
 
@@ -678,7 +678,7 @@ namespace UI {
678 678
     #endif
679 679
   }
680 680
 
681
-} // namespace UI
681
+} // namespace ExtUI
682 682
 
683 683
 // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
684 684
 
@@ -686,7 +686,7 @@ void MarlinUI::init() {
686 686
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
687 687
     SET_INPUT_PULLUP(SD_DETECT_PIN);
688 688
   #endif
689
-  UI::onStartup();
689
+  ExtUI::onStartup();
690 690
 }
691 691
 
692 692
 void MarlinUI::update() {
@@ -698,23 +698,23 @@ void MarlinUI::update() {
698 698
       if (sd_status) {
699 699
         card.initsd();
700 700
         if (card.cardOK)
701
-          UI::onMediaInserted();
701
+          ExtUI::onMediaInserted();
702 702
         else
703
-          UI::onMediaError();
703
+          ExtUI::onMediaError();
704 704
       }
705 705
       else {
706 706
         const bool ok = card.cardOK;
707 707
         card.release();
708
-        if (ok) UI::onMediaRemoved();
708
+        if (ok) ExtUI::onMediaRemoved();
709 709
       }
710 710
     }
711 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 718
 void MarlinUI::setalertstatusPGM(PGM_P const message)                               { setstatusPGM(message, 0); }
719 719
 
720 720
 void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...) {
@@ -724,13 +724,13 @@ void MarlinUI::status_printf_P(const uint8_t level, const char * const fmt, ...)
724 724
   vsnprintf_P(buff, sizeof(buff), fmt, args);
725 725
   va_end(args);
726 726
   buff[63] = '\0';
727
-  UI::onStatusChanged(buff);
727
+  ExtUI::onStatusChanged(buff);
728 728
 }
729 729
 
730 730
 void MarlinUI::kill_screen(PGM_P const msg) {
731 731
   if (!flags.printer_killed) {
732 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,7 +47,7 @@
47 47
 
48 48
 typedef const __FlashStringHelper *progmem_str;
49 49
 
50
-namespace UI {
50
+namespace ExtUI {
51 51
 
52 52
   enum axis_t     : uint8_t { X, Y, Z };
53 53
   enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 };
@@ -257,8 +257,8 @@ namespace UI {
257 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 263
 #define UI_INCREMENT(method, ...) UI_INCREMENT_BY(method, increment, ##__VA_ARGS__)
264 264
 #define UI_DECREMENT(method, ...) UI_DECREMENT_BY(method, increment, ##__VA_ARGS__)

+ 8
- 8
Marlin/src/lcd/menu/menu.cpp ファイルの表示

@@ -102,7 +102,7 @@ void MarlinUI::goto_previous_screen() {
102 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 108
 /////////// Menu Editing Actions ///////////
@@ -119,18 +119,18 @@ void menu_item_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode)
119 119
  *
120 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 126
  * You can then use one of the menu macros to present the edit interface:
127 127
  *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
128 128
  *
129 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 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 135
 void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
136 136
   ui.encoder_direction_normal();
@@ -158,7 +158,7 @@ void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, con
158 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 163
 DEFINE_MENU_EDIT_ITEM(int3);
164 164
 DEFINE_MENU_EDIT_ITEM(int4);
@@ -172,7 +172,7 @@ DEFINE_MENU_EDIT_ITEM(float52sign);
172 172
 DEFINE_MENU_EDIT_ITEM(float62);
173 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 176
   UNUSED(pstr); *ptr ^= true; ui.refresh();
177 177
   if (callback) (*callback)();
178 178
 }

+ 73
- 79
Marlin/src/lcd/menu/menu.h ファイルの表示

@@ -37,109 +37,103 @@ bool printer_busy();
37 37
 ////////////////////////////////////////////
38 38
 
39 39
 #define DECLARE_MENU_EDIT_TYPE(TYPE, NAME, STRFUNC, SCALE) \
40
-  struct NAME ## _item_info { \
40
+  struct MenuItemInfo_##NAME { \
41 41
     typedef TYPE type_t; \
42 42
     static constexpr float scale = SCALE; \
43 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 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 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 75
 #if ENABLED(SDSUPPORT)
66 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 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 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 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 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 96
     UNUSED(pstr2); UNUSED(pset); \
103
-    DRAWMENU_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
97
+    DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
104 98
   } \
105 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 118
 /////////////// Menu Actions ///////////////
125 119
 ////////////////////////////////////////////
126 120
 
127
-class menu_item_back {
121
+class MenuItem_back {
128 122
   public:
129 123
     static inline void action() { ui.goto_previous_screen(); }
130 124
 };
131 125
 
132
-class menu_item_submenu {
126
+class MenuItem_submenu {
133 127
   public:
134 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 132
   public:
139 133
     static void action(const char * const pgcode);
140 134
 };
141 135
 
142
-class menu_item_function {
136
+class MenuItem_function {
143 137
   public:
144 138
     static inline void action(const menuAction_t func) { (*func)(); };
145 139
 };
@@ -160,19 +154,19 @@ template<typename NAME>
160 154
 class TMenuItem : MenuItemBase {
161 155
   private:
162 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 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 163
       const int32_t minv = scale(minValue);
170 164
       init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live);
171 165
     }
172 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 171
 DECLARE_MENU_EDIT_ITEM(int3);
178 172
 DECLARE_MENU_EDIT_ITEM(int4);
@@ -186,9 +180,9 @@ DECLARE_MENU_EDIT_ITEM(float52sign);
186 180
 DECLARE_MENU_EDIT_ITEM(float62);
187 181
 DECLARE_MENU_EDIT_ITEM(long5);
188 182
 
189
-class menu_item_bool {
183
+class MenuItem_bool {
190 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,22 +241,22 @@ class menu_item_bool {
247 241
  * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
248 242
  *
249 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 246
  * Examples:
253 247
  *   MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] )
254 248
  *   or
255 249
  *   MENU_BACK(MSG_WATCH)
256 250
  *     draw_menu_item_back(sel, row, PSTR(MSG_WATCH))
257
- *     menu_item_back::action()
251
+ *     MenuItem_back::action()
258 252
  *
259 253
  *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
260 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 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 262
 #define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, ...) do { \
@@ -270,7 +264,7 @@ class menu_item_bool {
270 264
     if (_menuLineNr == _thisItemNr) { \
271 265
       if (encoderLine == _thisItemNr && ui.use_click()) { \
272 266
         _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \
273
-        menu_item_ ## TYPE ::action ## VARIANT(__VA_ARGS__); \
267
+        MenuItem_##TYPE ::action ## VARIANT(__VA_ARGS__); \
274 268
         if (screen_changed) return; \
275 269
       } \
276 270
       if (ui.should_draw()) \
@@ -305,10 +299,10 @@ class menu_item_bool {
305 299
 #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
306 300
 #define MENU_ITEM_P(TYPE, PLABEL, ...)                       _MENU_ITEM_VARIANT_P(TYPE,              , false, PLABEL,                   ## __VA_ARGS__)
307 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 308
 /////////////// Menu Screens ///////////////

+ 2
- 2
Marlin/src/lcd/menu/menu_sdcard.cpp ファイルの表示

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

+ 1
- 1
Marlin/src/lcd/ultralcd.cpp ファイルの表示

@@ -269,7 +269,7 @@ bool MarlinUI::get_blink() {
269 269
             #if HAS_LCD_MENU
270 270
               if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
271 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 273
               else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { return_to_status(); quick_feedback(); }
274 274
             #endif
275 275
           }

+ 1
- 1
Marlin/src/libs/buzzer.cpp ファイルの表示

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

+ 13
- 13
Marlin/src/module/temperature.cpp ファイルの表示

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

+ 4
- 4
Marlin/src/module/temperature.h ファイルの表示

@@ -311,13 +311,13 @@ class Temperature {
311 311
     /**
312 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 316
     #if HAS_HEATED_BED
317
-      static float analog2tempBed(const int raw);
317
+      static float analog_to_celsius_bed(const int raw);
318 318
     #endif
319 319
     #if HAS_TEMP_CHAMBER
320
-      static float analog2tempChamber(const int raw);
320
+      static float analog_to_celsiusChamber(const int raw);
321 321
     #endif
322 322
 
323 323
     /**
@@ -358,7 +358,7 @@ class Temperature {
358 358
     #endif
359 359
 
360 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 362
       static int8_t widthFil_to_size_ratio(); // Convert Filament Width (mm) to an extrusion ratio
363 363
     #endif
364 364
 

読み込み中…
キャンセル
保存