Parcourir la source

Add "Bed" / "Chamber" substitutions (#18255)

Scott Lahteine il y a 5 ans
Parent
révision
67305f7976
Aucun compte lié à l'adresse e-mail de l'auteur

+ 11
- 9
Marlin/src/lcd/lcdprint.cpp Voir le fichier

35
  * lcd_put_u8str_ind_P
35
  * lcd_put_u8str_ind_P
36
  * Print a string with an index substituted within it
36
  * Print a string with an index substituted within it
37
  */
37
  */
38
-lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
38
+lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
39
   uint8_t *p = (uint8_t*)pstr;
39
   uint8_t *p = (uint8_t*)pstr;
40
   lcd_uint_t n = maxlen;
40
   lcd_uint_t n = maxlen;
41
   for (; n; n--) {
41
   for (; n; n--) {
43
     p = get_utf8_value_cb(p, read_byte_rom, &ch);
43
     p = get_utf8_value_cb(p, read_byte_rom, &ch);
44
     if (!ch) break;
44
     if (!ch) break;
45
     if (ch == '=' || ch == '~' || ch == '*') {
45
     if (ch == '=' || ch == '~' || ch == '*') {
46
-      if (ch == '*') { lcd_put_wchar('E'); n--; }
47
       // lcd_put_int(ind); n--; if (ind >= 10) n--;
46
       // lcd_put_int(ind); n--; if (ind >= 10) n--;
48
-      // if (ind >= 0)
49
-        {
50
-          lcd_put_wchar(ind + ((ch == '=') ? '0' : LCD_FIRST_TOOL));
51
-          n--;
52
-        }
53
-      // else if (ind == -1) { PGM_P const b = GET_TEXT(MSG_BED); lcd_put_u8str_P(b); n -= utf8_strlen_P(b); }
54
-      // else if (ind == -2) { PGM_P const c = GET_TEXT(MSG_CHAMBER); lcd_put_u8str_P(c); n -= utf8_strlen_P(c); }
47
+      if (ind >= 0) {
48
+        if (ch == '*') { lcd_put_wchar('E'); n--; }
49
+        lcd_put_wchar(ind + ((ch == '=') ? '0' : LCD_FIRST_TOOL));
50
+        n--;
51
+      }
52
+      else {
53
+        PGM_P const b = ind == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED);
54
+        lcd_put_u8str_P(b);
55
+        n -= utf8_strlen_P(b);
56
+      }
55
       if (n) n -= lcd_put_u8str_max_P((PGM_P)p, n);
57
       if (n) n -= lcd_put_u8str_max_P((PGM_P)p, n);
56
       break;
58
       break;
57
     }
59
     }

+ 2
- 2
Marlin/src/lcd/lcdprint.h Voir le fichier

71
   return lcd_put_u8str_P(pstr);
71
   return lcd_put_u8str_P(pstr);
72
 }
72
 }
73
 
73
 
74
-lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen=LCD_WIDTH);
75
-inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen=LCD_WIDTH) {
74
+lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, const lcd_uint_t maxlen=LCD_WIDTH);
75
+inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const int8_t ind, const lcd_uint_t maxlen=LCD_WIDTH) {
76
   lcd_moveto(col, row);
76
   lcd_moveto(col, row);
77
   return lcd_put_u8str_ind_P(pstr, ind, maxlen);
77
   return lcd_put_u8str_ind_P(pstr, ind, maxlen);
78
 }
78
 }

+ 1
- 1
Marlin/src/lcd/menu/menu.cpp Voir le fichier

61
 menuPosition screen_history[6];
61
 menuPosition screen_history[6];
62
 uint8_t screen_history_depth = 0;
62
 uint8_t screen_history_depth = 0;
63
 
63
 
64
-uint8_t MenuItemBase::itemIndex;  // Index number for draw and action
64
+int8_t MenuItemBase::itemIndex;   // Index number for draw and action
65
 chimera_t editable;               // Value Editing
65
 chimera_t editable;               // Value Editing
66
 
66
 
67
 // Menu Edit Items
67
 // Menu Edit Items

+ 2
- 2
Marlin/src/lcd/menu/menu.h Voir le fichier

65
   public:
65
   public:
66
     // An index to interject in the item label and for
66
     // An index to interject in the item label and for
67
     // use by the action
67
     // use by the action
68
-    static uint8_t itemIndex;
68
+    static int8_t itemIndex;
69
 
69
 
70
     // Store the index of the item ahead of use by indexed items
70
     // Store the index of the item ahead of use by indexed items
71
-    FORCE_INLINE static void init(const uint8_t ind) { itemIndex = ind; }
71
+    FORCE_INLINE static void init(const int8_t ind) { itemIndex = ind; }
72
 
72
 
73
     // Draw an item either selected (pre_char) or not (space) with post_char
73
     // Draw an item either selected (pre_char) or not (space) with post_char
74
     static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
74
     static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);

Chargement…
Annuler
Enregistrer