Kaynağa Gözat

🎨 Axis name string interpolation, with examples (#22879)

Scott Lahteine 2 yıl önce
ebeveyn
işleme
54d400608d
No account linked to committer's email address

+ 8
- 8
Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp Dosyayı Görüntüle

@@ -43,9 +43,11 @@ uint8_t read_byte(uint8_t *byte) { return *byte; }
43 43
 /**
44 44
  * Add a string, applying substitutions for the following characters:
45 45
  *
46
+ *   $ displays the clipped C-string given by the itemString argument
46 47
  *   = displays  '0'....'10' for indexes 0 - 10
47 48
  *   ~ displays  '1'....'11' for indexes 0 - 10
48 49
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
50
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
49 51
  */
50 52
 void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*=nullptr*/) {
51 53
   wchar_t wchar;
@@ -62,17 +64,15 @@ void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*
62 64
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
63 65
         add_character('0' + inum);
64 66
       }
65
-      else {
67
+      else
66 68
         add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED));
67
-      }
68
-      continue;
69 69
     }
70
-    else if (ch == '$' && itemString) {
70
+    else if (ch == '$' && itemString)
71 71
       add(itemString);
72
-      continue;
73
-    }
74
-
75
-    add_character(ch);
72
+    else if (ch == '@')
73
+      add_character(axis_codes[index]);
74
+    else
75
+      add_character(ch);
76 76
   }
77 77
   eol();
78 78
 }

+ 1
- 2
Marlin/src/lcd/language/language_cz.h Dosyayı Görüntüle

@@ -129,9 +129,8 @@ namespace Language_cz {
129 129
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikace");
130 130
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Zrcadlení");
131 131
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Plná kontrola");
132
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2. tryska X");
133
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2. tryska Y");
134 132
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. tryska Z");
133
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. tryska @");
135 134
 
136 135
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Provádím G29");
137 136
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL nástroje");

+ 1
- 2
Marlin/src/lcd/language/language_de.h Dosyayı Görüntüle

@@ -121,9 +121,8 @@ namespace Language_de {
121 121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplizieren");
122 122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Spiegelkopie");
123 123
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("vollstä. Kontrolle");
124
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2. Düse X");
125
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2. Düse Y");
126 124
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. Düse Z");
125
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. Düse @");
127 126
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 ausführen");
128 127
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL-Werkzeuge");
129 128
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 6
- 9
Marlin/src/lcd/language/language_en.h Dosyayı Görüntüle

@@ -30,9 +30,11 @@
30 30
  * Substitutions are applied for the following characters when used
31 31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32 32
  *
33
+ *   $ displays an inserted C-string
33 34
  *   = displays  '0'....'10' for indexes 0 - 10
34 35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35 36
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
37
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
36 38
  */
37 39
 
38 40
 #define en 1234
@@ -72,12 +74,7 @@ namespace Language_en {
72 74
   LSTR MSG_PROGRESS_BAR_TEST              = _UxGT("Progress Bar Test");
73 75
   LSTR MSG_HOMING                         = _UxGT("Homing");
74 76
   LSTR MSG_AUTO_HOME                      = _UxGT("Auto Home");
75
-  LSTR MSG_AUTO_HOME_X                    = _UxGT("Home X");
76
-  LSTR MSG_AUTO_HOME_Y                    = _UxGT("Home Y");
77
-  LSTR MSG_AUTO_HOME_Z                    = _UxGT("Home Z");
78
-  LSTR MSG_AUTO_HOME_I                    = _UxGT("Home ") LCD_STR_I;
79
-  LSTR MSG_AUTO_HOME_J                    = _UxGT("Home ") LCD_STR_J;
80
-  LSTR MSG_AUTO_HOME_K                    = _UxGT("Home ") LCD_STR_K;
77
+  LSTR MSG_AUTO_HOME_A                    = _UxGT("Home @");
81 78
   LSTR MSG_FILAMENT_SET                   = _UxGT("Filament Settings");
82 79
   LSTR MSG_FILAMENT_MAN                   = _UxGT("Filament Management");
83 80
   LSTR MSG_LEVBED_FL                      = _UxGT("Front Left");
@@ -175,9 +172,8 @@ namespace Language_en {
175 172
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
176 173
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
177 174
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("Duplicate X-Gap");
178
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2nd Nozzle X");
179
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2nd Nozzle Y");
180 175
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
176
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
181 177
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
182 178
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
183 179
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
@@ -279,7 +275,7 @@ namespace Language_en {
279 275
 
280 276
   LSTR MSG_MOVING                         = _UxGT("Moving...");
281 277
   LSTR MSG_FREE_XY                        = _UxGT("Free XY");
282
-  LSTR MSG_MOVE_X                         = _UxGT("Move X");
278
+  LSTR MSG_MOVE_X                         = _UxGT("Move X"); // Used by draw_edit_screen
283 279
   LSTR MSG_MOVE_Y                         = _UxGT("Move Y");
284 280
   LSTR MSG_MOVE_Z                         = _UxGT("Move Z");
285 281
   LSTR MSG_MOVE_I                         = _UxGT("Move ") LCD_STR_I;
@@ -303,6 +299,7 @@ namespace Language_en {
303 299
   LSTR MSG_MAXSPEED_Y                     = _UxGT("Max ") LCD_STR_B _UxGT(" Speed");
304 300
   LSTR MSG_MAXSPEED_Z                     = _UxGT("Max ") LCD_STR_C _UxGT(" Speed");
305 301
   LSTR MSG_MAXSPEED_E                     = _UxGT("Max ") LCD_STR_E _UxGT(" Speed");
302
+  LSTR MSG_MAXSPEED_A                     = _UxGT("Max @ Speed");
306 303
   LSTR MSG_BED_Z                          = _UxGT("Bed Z");
307 304
   LSTR MSG_NOZZLE                         = _UxGT("Nozzle");
308 305
   LSTR MSG_NOZZLE_N                       = _UxGT("Nozzle ~");

+ 1
- 2
Marlin/src/lcd/language/language_es.h Dosyayı Görüntüle

@@ -124,9 +124,8 @@ namespace Language_es {
124 124
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicar");
125 125
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Reflejada");
126 126
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Control Total");
127
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2ª Fusor X");
128
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2ª Fusor Y");
129 127
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ª Fusor Z");
128
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2ª Fusor @");
130 129
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Hacer G29");
131 130
   LSTR MSG_UBL_TOOLS                      = _UxGT("Herramientas UBL");
132 131
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivelado UBL");

+ 1
- 2
Marlin/src/lcd/language/language_fr.h Dosyayı Görüntüle

@@ -134,9 +134,8 @@ namespace Language_fr {
134 134
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copie miroir");
135 135
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Contrôle complet");
136 136
   LSTR MSG_OFFSETS_MENU                   = _UxGT("Offsets Outil");
137
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("Buse 2 X");
138
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("Buse 2 Y");
139 137
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("Buse 2 Z");
138
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("Buse 2 @");
140 139
   LSTR MSG_G26_HEATING_BED                = _UxGT("G26: Chauffage du lit");
141 140
   LSTR MSG_G26_HEATING_NOZZLE             = _UxGT("Buse en chauffe...");
142 141
   LSTR MSG_G26_MANUAL_PRIME               = _UxGT("Amorce manuelle...");

+ 1
- 2
Marlin/src/lcd/language/language_gl.h Dosyayı Görüntüle

@@ -121,9 +121,8 @@ namespace Language_gl {
121 121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicación");
122 122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Espello");
123 123
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Control Total");
124
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2º Bico X");
125
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2º Bico Y");
126 124
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2º Bico Z");
125
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2º Bico @");
127 126
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
128 127
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
129 128
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 1
- 2
Marlin/src/lcd/language/language_hu.h Dosyayı Görüntüle

@@ -156,9 +156,8 @@ namespace Language_hu {
156 156
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Tükrözött másolás");
157 157
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Teljes felügyelet");
158 158
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("X-hézag másolása");
159
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2. fej X");
160
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2. fej Y");
161 159
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. fej Z");
160
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. fej @");
162 161
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Szintezz! G29");
163 162
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL eszköz");
164 163
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Egységes ágy szint");

+ 3
- 2
Marlin/src/lcd/language/language_it.h Dosyayı Görüntüle

@@ -30,9 +30,11 @@
30 30
  * Substitutions are applied for the following characters when used
31 31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32 32
  *
33
+ *   $ displays an inserted C-string
33 34
  *   = displays  '0'....'10' for indexes 0 - 10
34 35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35 36
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
37
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
36 38
  */
37 39
 
38 40
 #define DISPLAY_CHARSET_ISO10646_1
@@ -160,9 +162,8 @@ namespace Language_it {
160 162
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia speculare");
161 163
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Pieno controllo");
162 164
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("X-Gap-X duplicato");
163
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2° ugello X");
164
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2° ugello Y");
165 165
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2° ugello Z");
166
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2° ugello @");
166 167
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 in corso");
167 168
   LSTR MSG_UBL_TOOLS                      = _UxGT("Strumenti UBL");
168 169
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Livel.letto unificato");

+ 3
- 2
Marlin/src/lcd/language/language_pl.h Dosyayı Görüntüle

@@ -30,9 +30,11 @@
30 30
  * Substitutions are applied for the following characters when used
31 31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32 32
  *
33
+ *   $ displays an inserted C-string
33 34
  *   = displays  '0'....'10' for indexes 0 - 10
34 35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35 36
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
37
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
36 38
  */
37 39
 
38 40
 #define DISPLAY_CHARSET_ISO10646_PL
@@ -133,9 +135,8 @@ namespace Language_pl {
133 135
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikowanie");
134 136
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Kopia lustrzana");
135 137
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Pełne sterowanie");
136
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2ga dysza X");
137
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2ga dysza Y");
138 138
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ga dysza Z");
139
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2ga dysza @");
139 140
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Wykonywanie G29");
140 141
   LSTR MSG_UBL_TOOLS                      = _UxGT("Narzędzia UBL");
141 142
   LSTR MSG_LCD_TILTING_MESH               = _UxGT("Punkt pochylenia");

+ 1
- 2
Marlin/src/lcd/language/language_pt_br.h Dosyayı Görüntüle

@@ -111,9 +111,8 @@ namespace Language_pt_br {
111 111
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicação");
112 112
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Cópia espelhada");
113 113
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Controle Total");
114
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2o bico X");
115
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2o bico Y");
116 114
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2o bico Z");
115
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2o bico @");
117 116
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
118 117
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
119 118
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivel. Mesa Unif.");

+ 1
- 2
Marlin/src/lcd/language/language_ro.h Dosyayı Görüntüle

@@ -120,9 +120,8 @@ namespace Language_ro {
120 120
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
121 121
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
122 122
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
123
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2nd Nozzle X");
124
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2nd Nozzle Y");
125 123
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
124
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
126 125
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
127 126
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
128 127
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 1
- 2
Marlin/src/lcd/language/language_ru.h Dosyayı Görüntüle

@@ -197,9 +197,8 @@ namespace Language_ru {
197 197
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Полный контроль");
198 198
   LSTR MSG_IDEX_DUPE_GAP                    = _UxGT("Дублировать X-зазор");
199 199
 
200
-  LSTR MSG_HOTEND_OFFSET_X                  = _UxGT("2-е сопло X");
201
-  LSTR MSG_HOTEND_OFFSET_Y                  = _UxGT("2-е сопло Y");
202 200
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("2-е сопло Z");
201
+  LSTR MSG_HOTEND_OFFSET_A                  = _UxGT("2-е сопло @");
203 202
 
204 203
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Выполняем G29");
205 204
   LSTR MSG_UBL_TOOLS                        = _UxGT("Инструменты UBL");

+ 4
- 2
Marlin/src/lcd/language/language_sk.h Dosyayı Görüntüle

@@ -34,9 +34,11 @@
34 34
  * Substitutions are applied for the following characters when used
35 35
  * in menu items that call lcd_put_u8str_ind_P with an index:
36 36
  *
37
+ *   $ displays an inserted C-string
37 38
  *   = displays  '0'....'10' for indexes 0 - 10
38 39
  *   ~ displays  '1'....'11' for indexes 0 - 10
39 40
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
41
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
40 42
  */
41 43
 #define DISPLAY_CHARSET_ISO10646_SK
42 44
 
@@ -172,9 +174,8 @@ namespace Language_sk {
172 174
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Zrkadlená kópia");
173 175
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Plná kontrola");
174 176
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("Duplik. medz.-X");
175
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2. tryska X");
176
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2. tryska Y");
177 177
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. tryska Z");
178
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. tryska @");
178 179
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Vykonávam G29");
179 180
   LSTR MSG_UBL_TOOLS                      = _UxGT("Nástroje UBL");
180 181
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("UBL rovnanie");
@@ -300,6 +301,7 @@ namespace Language_sk {
300 301
   LSTR MSG_MAXSPEED_Y                     = _UxGT("Max rýchl. ") LCD_STR_B;
301 302
   LSTR MSG_MAXSPEED_Z                     = _UxGT("Max rýchl. ") LCD_STR_C;
302 303
   LSTR MSG_MAXSPEED_E                     = _UxGT("Max rýchl. ") LCD_STR_E;
304
+  LSTR MSG_MAXSPEED_A                     = _UxGT("Max rýchl. @");
303 305
   LSTR MSG_BED_Z                          = _UxGT("Výška podl.");
304 306
   LSTR MSG_NOZZLE                         = _UxGT("Tryska");
305 307
   LSTR MSG_NOZZLE_N                       = _UxGT("Tryska ~");

+ 1
- 2
Marlin/src/lcd/language/language_sv.h Dosyayı Görüntüle

@@ -145,9 +145,8 @@ namespace Language_sv {
145 145
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Speglad Kopia");
146 146
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Kontroll");
147 147
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("Duplicera X-Avstånd");
148
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2:a Munstycke X");
149
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2:a Munstycke Y");
150 148
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2:a Munstycke Z");
149
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2:a Munstycke @");
151 150
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Utför G29");
152 151
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Verktyg");
153 152
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Enad Bädd Nivellering (UBL)");

+ 1
- 2
Marlin/src/lcd/language/language_tr.h Dosyayı Görüntüle

@@ -123,9 +123,8 @@ namespace Language_tr {
123 123
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Kopyala");
124 124
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Yansıtılmış kopya");
125 125
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Tam Kontrol");
126
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2. nozul X");
127
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2. nozul Y");
128 126
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. nozul Z");
127
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. nozul @");
129 128
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 Çalışıyor");
130 129
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Araçları");
131 130
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("UBL Yatak Hizalama");

+ 1
- 2
Marlin/src/lcd/language/language_uk.h Dosyayı Görüntüle

@@ -198,9 +198,8 @@ namespace Language_uk {
198 198
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Повний контроль");
199 199
   LSTR MSG_IDEX_DUPE_GAP                    = _UxGT("Дублюв. X-проміжок");
200 200
 
201
-  LSTR MSG_HOTEND_OFFSET_X                  = _UxGT("Друге сопло X");
202
-  LSTR MSG_HOTEND_OFFSET_Y                  = _UxGT("Друге сопло Y");
203 201
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("Друге сопло Z");
202
+  LSTR MSG_HOTEND_OFFSET_A                  = _UxGT("Друге сопло @");
204 203
 
205 204
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Виконується G29");
206 205
   LSTR MSG_UBL_TOOLS                        = _UxGT("Інструменти UBL");

+ 1
- 2
Marlin/src/lcd/language/language_zh_CN.h Dosyayı Görüntüle

@@ -119,9 +119,8 @@ namespace Language_zh_CN {
119 119
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("复制");
120 120
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("镜像复制");
121 121
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("完全控制");
122
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("第二喷头是X");
123
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("第二喷头是Y");
124 122
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("第二喷头是Z");
123
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("第二喷头是@");
125 124
   LSTR MSG_UBL_DOING_G29                  = _UxGT("执行G29");     // "Doing G29"
126 125
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
127 126
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("统一热床调平(UBL)");     // "Unified Bed Leveling"

+ 1
- 2
Marlin/src/lcd/language/language_zh_TW.h Dosyayı Görüntüle

@@ -116,9 +116,8 @@ namespace Language_zh_TW {
116 116
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
117 117
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
118 118
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
119
-  LSTR MSG_HOTEND_OFFSET_X                = _UxGT("2nd Nozzle X");
120
-  LSTR MSG_HOTEND_OFFSET_Y                = _UxGT("2nd Nozzle Y");
121 119
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
120
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
122 121
   LSTR MSG_UBL_DOING_G29                  = _UxGT("執行G29");     // "Doing G29"
123 122
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
124 123
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("統一熱床調平(UBL)");     // "Unified Bed Leveling"

+ 6
- 0
Marlin/src/lcd/lcdprint.cpp Dosyayı Görüntüle

@@ -36,9 +36,11 @@
36 36
  *
37 37
  * Print a string with an index substituted within it:
38 38
  *
39
+ *   $ displays the clipped C-string given by the inStr argument
39 40
  *   = displays  '0'....'10' for indexes 0 - 10
40 41
  *   ~ displays  '1'....'11' for indexes 0 - 10
41 42
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
43
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
42 44
  */
43 45
 lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
44 46
   const uint8_t prop = USE_WIDE_GLYPH ? 2 : 1;
@@ -72,6 +74,10 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i
72 74
     else if (ch == '$' && inStr) {
73 75
       n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
74 76
     }
77
+    else if (ch == '@') {
78
+      lcd_put_wchar(axis_codes[ind]);
79
+      n--;
80
+    }
75 81
     else {
76 82
       lcd_put_wchar(ch);
77 83
       n -= ch > 255 ? prop : 1;

+ 9
- 23
Marlin/src/lcd/menu/menu.cpp Dosyayı Görüntüle

@@ -103,42 +103,28 @@ void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_b
103 103
 /////////// Menu Editing Actions ///////////
104 104
 ////////////////////////////////////////////
105 105
 
106
-/**
107
- * Functions for editing single values
108
- *
109
- * The "DEFINE_MENU_EDIT_ITEM" macro generates the classes needed to edit a numerical value.
110
- *
111
- * The prerequisite is that in the header the type was already declared:
112
- *
113
- *   DEFINE_MENU_EDIT_ITEM_TYPE(int3, int16_t, i16tostr3rj, 1)
114
- *
115
- * For example, DEFINE_MENU_EDIT_ITEM(int3) expands into:
116
- *
117
- *   template class TMenuEditItem<MenuEditItemInfo_int3>
118
- *
119
- * You can then use one of the menu macros to present the edit interface:
120
- *   EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
121
- *
122
- * This expands into a more primitive menu item:
123
- *  _MENU_ITEM_P(int3, false, GET_TEXT(MSG_SPEED), &feedrate_percentage, 10, 999)
124
- *
125
- * ...which calls:
126
- *       MenuItem_int3::action(plabel, &feedrate_percentage, 10, 999)
127
- *       MenuItem_int3::draw(encoderLine == _thisItemNr, _lcdLineNr, plabel, &feedrate_percentage, 10, 999)
128
- */
106
+// All Edit Screens run the same way, but `draw_edit_screen` is implementation-specific
129 107
 void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
108
+  // Reset repeat_delay for Touch Buttons
130 109
   TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
110
+  // Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
131 111
   if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
132 112
   if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
113
+  // If drawing is flagged then redraw the (whole) edit screen
133 114
   if (ui.should_draw())
134 115
     draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
116
+  // If there was a click or "live editing" and encoder moved...
135 117
   if (ui.lcd_clicked || (liveEdit && ui.should_draw())) {
118
+    // Pass the editValue pointer to the loadfunc along with the encoder plus min
136 119
     if (editValue) loadfunc(editValue, ui.encoderPosition + minEditValue);
120
+    // If a callbackFunc was set, call it for click or always for "live editing"
137 121
     if (callbackFunc && (liveEdit || ui.lcd_clicked)) (*callbackFunc)();
122
+    // Use up the click to finish editing and go to the previous screen
138 123
     if (ui.use_click()) ui.goto_previous_screen();
139 124
   }
140 125
 }
141 126
 
127
+// Going to an edit screen sets up some persistent values first
142 128
 void MenuEditItemBase::goto_edit_screen(
143 129
   PGM_P const el,         // Edit label
144 130
   void * const ev,        // Edit value pointer

+ 4
- 2
Marlin/src/lcd/menu/menu.h Dosyayı Görüntüle

@@ -60,7 +60,9 @@ class MenuItemBase {
60 60
     // Store the index of the item ahead of use by indexed items
61 61
     FORCE_INLINE static void init(const int8_t ind=0, PGM_P const pstr=nullptr) { itemIndex = ind; itemString = pstr; }
62 62
 
63
+    // Implementation-specific:
63 64
     // Draw an item either selected (pre_char) or not (space) with post_char
65
+    // Menus may set up itemIndex, itemString and pass them to string-building or string-emitting functions
64 66
     static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
65 67
 
66 68
     // Draw an item either selected ('>') or not (space) with post_char
@@ -167,11 +169,11 @@ class MenuEditItemBase : public MenuItemBase {
167 169
     );
168 170
     static void edit_screen(strfunc_t, loadfunc_t); // Edit value handler
169 171
   public:
170
-    // Implemented for HD44780 and DOGM
172
+    // Implementation-specific:
171 173
     // Draw the current item at specified row with edit data
172 174
     static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm=false);
173 175
 
174
-    // Implemented for HD44780 and DOGM
176
+    // Implementation-specific:
175 177
     // This low-level method is good to draw from anywhere
176 178
     static void draw_edit_screen(PGM_P const pstr, const char * const value);
177 179
 

+ 4
- 4
Marlin/src/lcd/menu/menu_configuration.cpp Dosyayı Görüntüle

@@ -174,12 +174,12 @@ void menu_advanced_settings();
174 174
     START_MENU();
175 175
     BACK_ITEM(MSG_CONFIGURATION);
176 176
     #if ENABLED(DUAL_X_CARRIAGE)
177
-      EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, float(X2_HOME_POS - 25), float(X2_HOME_POS + 25), _recalc_offsets);
177
+      EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_HOTEND_OFFSET_A, &hotend_offset[1].x, float(X2_HOME_POS - 25), float(X2_HOME_POS + 25), _recalc_offsets);
178 178
     #else
179
-      EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_X, &hotend_offset[1].x, -99.0, 99.0, _recalc_offsets);
179
+      EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_HOTEND_OFFSET_A, &hotend_offset[1].x, -99.0, 99.0, _recalc_offsets);
180 180
     #endif
181
-    EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Y, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
182
-    EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Z, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
181
+    EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_HOTEND_OFFSET_A, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
182
+    EDIT_ITEM_FAST_N(float42_52, Z_AXIS, MSG_HOTEND_OFFSET_A, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
183 183
     #if ENABLED(EEPROM_SETTINGS)
184 184
       ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
185 185
     #endif

+ 17
- 3
Marlin/src/lcd/menu/menu_item.h Dosyayı Görüntüle

@@ -106,9 +106,23 @@ class TMenuEditItem : MenuEditItemBase {
106 106
     }
107 107
 };
108 108
 
109
-// Provide a set of Edit Item Types which encompass a primitive
110
-// type, a string function, and a scale factor for edit and display.
111
-// These items call the Edit Item draw method passing the prepared string.
109
+/**
110
+ * DEFINE_MENU_EDIT_ITEM_TYPE(int3, int16_t, i16tostr3rj, 1)
111
+ *
112
+ * Define struct types for use by EDIT_ITEM(...) macros, which encompass
113
+ * a primitive storage type, a string function, and a scale factor for edit / display.
114
+ * The EDIT_ITEM macros take care of calling action and draw methods as needed.
115
+ *
116
+ * For example, DEFINE_MENU_EDIT_ITEM_TYPE(percent, uint8_t, ui8tostr4pctrj, 100.f/255.f, +0.5f) expands into:
117
+ *
118
+ *   struct MenuEditItemInfo_percent {
119
+ *     typedef uint8_t type_t;
120
+ *     static inline float scale(const_float_t value)   { return value * (100.f/255.f) +0.5f; }
121
+ *     static inline float unscale(const_float_t value) { return value / (100.f/255.f) +0.5f; }
122
+ *     static inline const char* strfunc(const_float_t value) { return ui8tostr4pctrj(_DOFIX(uint8_t,value)); }
123
+ *   };
124
+ *   typedef TMenuEditItem<MenuEditItemInfo_percent> MenuItem_percent
125
+ */
112 126
 #define __DOFIXfloat PROBE()
113 127
 #define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
114 128
 #define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \

+ 12
- 12
Marlin/src/lcd/menu/menu_motion.cpp Dosyayı Görüntüle

@@ -329,21 +329,21 @@ void menu_move() {
329 329
     BACK_ITEM(MSG_MOTION);
330 330
 
331 331
     GCODES_ITEM(MSG_AUTO_HOME, G28_STR);
332
-    GCODES_ITEM(MSG_AUTO_HOME_X, PSTR("G28X"));
332
+    GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, PSTR("G28X"));
333 333
     #if HAS_Y_AXIS
334
-      GCODES_ITEM(MSG_AUTO_HOME_Y, PSTR("G28Y"));
334
+      GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, PSTR("G28Y"));
335 335
     #endif
336 336
     #if HAS_Z_AXIS
337
-      GCODES_ITEM(MSG_AUTO_HOME_Z, PSTR("G28Z"));
337
+      GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, PSTR("G28Z"));
338 338
     #endif
339 339
     #if LINEAR_AXES >= 4
340
-      GCODES_ITEM(MSG_AUTO_HOME_I, PSTR("G28" AXIS4_STR));
340
+      GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS4_STR));
341 341
     #endif
342 342
     #if LINEAR_AXES >= 5
343
-      GCODES_ITEM(MSG_AUTO_HOME_J, PSTR("G28" AXIS5_STR));
343
+      GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS5_STR));
344 344
     #endif
345 345
     #if LINEAR_AXES >= 6
346
-      GCODES_ITEM(MSG_AUTO_HOME_K, PSTR("G28" AXIS6_STR));
346
+      GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS6_STR));
347 347
     #endif
348 348
 
349 349
     END_MENU();
@@ -382,21 +382,21 @@ void menu_motion() {
382 382
   #else
383 383
     GCODES_ITEM(MSG_AUTO_HOME, G28_STR);
384 384
     #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU)
385
-      GCODES_ITEM(MSG_AUTO_HOME_X, PSTR("G28X"));
385
+      GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, PSTR("G28X"));
386 386
       #if HAS_Y_AXIS
387
-        GCODES_ITEM(MSG_AUTO_HOME_Y, PSTR("G28Y"));
387
+        GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, PSTR("G28Y"));
388 388
       #endif
389 389
       #if HAS_Z_AXIS
390
-        GCODES_ITEM(MSG_AUTO_HOME_Z, PSTR("G28Z"));
390
+        GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, PSTR("G28Z"));
391 391
       #endif
392 392
       #if LINEAR_AXES >= 4
393
-        GCODES_ITEM(MSG_AUTO_HOME_I, PSTR("G28" AXIS4_STR));
393
+        GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS4_STR));
394 394
       #endif
395 395
       #if LINEAR_AXES >= 5
396
-        GCODES_ITEM(MSG_AUTO_HOME_J, PSTR("G28" AXIS5_STR));
396
+        GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS5_STR));
397 397
       #endif
398 398
       #if LINEAR_AXES >= 6
399
-        GCODES_ITEM(MSG_AUTO_HOME_K, PSTR("G28" AXIS6_STR));
399
+        GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, PSTR("G28" AXIS6_STR));
400 400
       #endif
401 401
     #endif
402 402
   #endif

+ 10
- 11
Marlin/src/lcd/tft/tft_string.cpp Dosyayı Görüntüle

@@ -89,11 +89,13 @@ uint8_t read_byte(uint8_t *byte) { return *byte; }
89 89
 /**
90 90
  * Add a string, applying substitutions for the following characters:
91 91
  *
92
+ *   $ displays an inserted C-string given by the itemString parameter
92 93
  *   = displays  '0'....'10' for indexes 0 - 10
93 94
  *   ~ displays  '1'....'11' for indexes 0 - 10
94 95
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
96
+ *   @ displays an axis name such as XYZUVW, or E for an extruder
95 97
  */
96
-void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString) {
98
+void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString/*=nullptr*/) {
97 99
   wchar_t wchar;
98 100
 
99 101
   while (*string) {
@@ -108,17 +110,15 @@ void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString) {
108 110
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
109 111
         add_character('0' + inum);
110 112
       }
111
-      else {
113
+      else
112 114
         add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED));
113
-      }
114
-      continue;
115 115
     }
116
-    else if (ch == '$' && itemString) {
116
+    else if (ch == '$' && itemString)
117 117
       add(itemString);
118
-      continue;
119
-    }
120
-
121
-    add_character(ch);
118
+    else if (ch == '@')
119
+      add_character(axis_codes[index]);
120
+    else
121
+      add_character(ch);
122 122
   }
123 123
   eol();
124 124
 }
@@ -150,9 +150,8 @@ void TFT_String::rtrim(uint8_t character) {
150 150
       span -= glyph(data[length])->DWidth;
151 151
       eol();
152 152
     }
153
-    else {
153
+    else
154 154
       break;
155
-    }
156 155
   }
157 156
 }
158 157
 

Loading…
İptal
Kaydet