Browse Source

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

Scott Lahteine 3 years ago
parent
commit
54d400608d
No account linked to committer's email address

+ 8
- 8
Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp View File

43
 /**
43
 /**
44
  * Add a string, applying substitutions for the following characters:
44
  * Add a string, applying substitutions for the following characters:
45
  *
45
  *
46
+ *   $ displays the clipped C-string given by the itemString argument
46
  *   = displays  '0'....'10' for indexes 0 - 10
47
  *   = displays  '0'....'10' for indexes 0 - 10
47
  *   ~ displays  '1'....'11' for indexes 0 - 10
48
  *   ~ displays  '1'....'11' for indexes 0 - 10
48
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
 void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*=nullptr*/) {
52
 void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*=nullptr*/) {
51
   wchar_t wchar;
53
   wchar_t wchar;
62
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
64
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
63
         add_character('0' + inum);
65
         add_character('0' + inum);
64
       }
66
       }
65
-      else {
67
+      else
66
         add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED));
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
       add(itemString);
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
   eol();
77
   eol();
78
 }
78
 }

+ 1
- 2
Marlin/src/lcd/language/language_cz.h View File

129
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikace");
129
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikace");
130
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Zrcadlení");
130
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Zrcadlení");
131
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Plná kontrola");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. tryska Z");
132
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. tryska Z");
133
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. tryska @");
135
 
134
 
136
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Provádím G29");
135
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Provádím G29");
137
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL nástroje");
136
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL nástroje");

+ 1
- 2
Marlin/src/lcd/language/language_de.h View File

121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplizieren");
121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplizieren");
122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Spiegelkopie");
122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Spiegelkopie");
123
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("vollstä. Kontrolle");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. Düse Z");
124
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. Düse Z");
125
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. Düse @");
127
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 ausführen");
126
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 ausführen");
128
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL-Werkzeuge");
127
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL-Werkzeuge");
129
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
128
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 6
- 9
Marlin/src/lcd/language/language_en.h View File

30
  * Substitutions are applied for the following characters when used
30
  * Substitutions are applied for the following characters when used
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32
  *
32
  *
33
+ *   $ displays an inserted C-string
33
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
 #define en 1234
40
 #define en 1234
72
   LSTR MSG_PROGRESS_BAR_TEST              = _UxGT("Progress Bar Test");
74
   LSTR MSG_PROGRESS_BAR_TEST              = _UxGT("Progress Bar Test");
73
   LSTR MSG_HOMING                         = _UxGT("Homing");
75
   LSTR MSG_HOMING                         = _UxGT("Homing");
74
   LSTR MSG_AUTO_HOME                      = _UxGT("Auto Home");
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
   LSTR MSG_FILAMENT_SET                   = _UxGT("Filament Settings");
78
   LSTR MSG_FILAMENT_SET                   = _UxGT("Filament Settings");
82
   LSTR MSG_FILAMENT_MAN                   = _UxGT("Filament Management");
79
   LSTR MSG_FILAMENT_MAN                   = _UxGT("Filament Management");
83
   LSTR MSG_LEVBED_FL                      = _UxGT("Front Left");
80
   LSTR MSG_LEVBED_FL                      = _UxGT("Front Left");
175
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
172
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
176
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
173
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
177
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("Duplicate X-Gap");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
175
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
176
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
181
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
177
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
182
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
178
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
183
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
179
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
279
 
275
 
280
   LSTR MSG_MOVING                         = _UxGT("Moving...");
276
   LSTR MSG_MOVING                         = _UxGT("Moving...");
281
   LSTR MSG_FREE_XY                        = _UxGT("Free XY");
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
   LSTR MSG_MOVE_Y                         = _UxGT("Move Y");
279
   LSTR MSG_MOVE_Y                         = _UxGT("Move Y");
284
   LSTR MSG_MOVE_Z                         = _UxGT("Move Z");
280
   LSTR MSG_MOVE_Z                         = _UxGT("Move Z");
285
   LSTR MSG_MOVE_I                         = _UxGT("Move ") LCD_STR_I;
281
   LSTR MSG_MOVE_I                         = _UxGT("Move ") LCD_STR_I;
303
   LSTR MSG_MAXSPEED_Y                     = _UxGT("Max ") LCD_STR_B _UxGT(" Speed");
299
   LSTR MSG_MAXSPEED_Y                     = _UxGT("Max ") LCD_STR_B _UxGT(" Speed");
304
   LSTR MSG_MAXSPEED_Z                     = _UxGT("Max ") LCD_STR_C _UxGT(" Speed");
300
   LSTR MSG_MAXSPEED_Z                     = _UxGT("Max ") LCD_STR_C _UxGT(" Speed");
305
   LSTR MSG_MAXSPEED_E                     = _UxGT("Max ") LCD_STR_E _UxGT(" Speed");
301
   LSTR MSG_MAXSPEED_E                     = _UxGT("Max ") LCD_STR_E _UxGT(" Speed");
302
+  LSTR MSG_MAXSPEED_A                     = _UxGT("Max @ Speed");
306
   LSTR MSG_BED_Z                          = _UxGT("Bed Z");
303
   LSTR MSG_BED_Z                          = _UxGT("Bed Z");
307
   LSTR MSG_NOZZLE                         = _UxGT("Nozzle");
304
   LSTR MSG_NOZZLE                         = _UxGT("Nozzle");
308
   LSTR MSG_NOZZLE_N                       = _UxGT("Nozzle ~");
305
   LSTR MSG_NOZZLE_N                       = _UxGT("Nozzle ~");

+ 1
- 2
Marlin/src/lcd/language/language_es.h View File

124
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicar");
124
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicar");
125
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Reflejada");
125
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Reflejada");
126
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Control Total");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ª Fusor Z");
127
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ª Fusor Z");
128
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2ª Fusor @");
130
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Hacer G29");
129
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Hacer G29");
131
   LSTR MSG_UBL_TOOLS                      = _UxGT("Herramientas UBL");
130
   LSTR MSG_UBL_TOOLS                      = _UxGT("Herramientas UBL");
132
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivelado UBL");
131
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivelado UBL");

+ 1
- 2
Marlin/src/lcd/language/language_fr.h View File

134
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copie miroir");
134
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copie miroir");
135
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Contrôle complet");
135
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Contrôle complet");
136
   LSTR MSG_OFFSETS_MENU                   = _UxGT("Offsets Outil");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("Buse 2 Z");
137
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("Buse 2 Z");
138
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("Buse 2 @");
140
   LSTR MSG_G26_HEATING_BED                = _UxGT("G26: Chauffage du lit");
139
   LSTR MSG_G26_HEATING_BED                = _UxGT("G26: Chauffage du lit");
141
   LSTR MSG_G26_HEATING_NOZZLE             = _UxGT("Buse en chauffe...");
140
   LSTR MSG_G26_HEATING_NOZZLE             = _UxGT("Buse en chauffe...");
142
   LSTR MSG_G26_MANUAL_PRIME               = _UxGT("Amorce manuelle...");
141
   LSTR MSG_G26_MANUAL_PRIME               = _UxGT("Amorce manuelle...");

+ 1
- 2
Marlin/src/lcd/language/language_gl.h View File

121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicación");
121
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicación");
122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Espello");
122
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia Espello");
123
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Control Total");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2º Bico Z");
124
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2º Bico Z");
125
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2º Bico @");
127
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
126
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
128
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
127
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
129
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
128
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 1
- 2
Marlin/src/lcd/language/language_hu.h View File

156
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Tükrözött másolás");
156
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Tükrözött másolás");
157
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Teljes felügyelet");
157
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Teljes felügyelet");
158
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("X-hézag másolása");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. fej Z");
159
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. fej Z");
160
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. fej @");
162
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Szintezz! G29");
161
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Szintezz! G29");
163
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL eszköz");
162
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL eszköz");
164
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Egységes ágy szint");
163
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Egységes ágy szint");

+ 3
- 2
Marlin/src/lcd/language/language_it.h View File

30
  * Substitutions are applied for the following characters when used
30
  * Substitutions are applied for the following characters when used
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32
  *
32
  *
33
+ *   $ displays an inserted C-string
33
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
 #define DISPLAY_CHARSET_ISO10646_1
40
 #define DISPLAY_CHARSET_ISO10646_1
160
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia speculare");
162
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Copia speculare");
161
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Pieno controllo");
163
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Pieno controllo");
162
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("X-Gap-X duplicato");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2° ugello Z");
165
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2° ugello Z");
166
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2° ugello @");
166
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 in corso");
167
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 in corso");
167
   LSTR MSG_UBL_TOOLS                      = _UxGT("Strumenti UBL");
168
   LSTR MSG_UBL_TOOLS                      = _UxGT("Strumenti UBL");
168
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Livel.letto unificato");
169
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Livel.letto unificato");

+ 3
- 2
Marlin/src/lcd/language/language_pl.h View File

30
  * Substitutions are applied for the following characters when used
30
  * Substitutions are applied for the following characters when used
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
31
  * in menu items that call lcd_put_u8str_ind_P with an index:
32
  *
32
  *
33
+ *   $ displays an inserted C-string
33
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   = displays  '0'....'10' for indexes 0 - 10
34
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   ~ displays  '1'....'11' for indexes 0 - 10
35
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
 #define DISPLAY_CHARSET_ISO10646_PL
40
 #define DISPLAY_CHARSET_ISO10646_PL
133
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikowanie");
135
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplikowanie");
134
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Kopia lustrzana");
136
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Kopia lustrzana");
135
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Pełne sterowanie");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ga dysza Z");
138
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2ga dysza Z");
139
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2ga dysza @");
139
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Wykonywanie G29");
140
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Wykonywanie G29");
140
   LSTR MSG_UBL_TOOLS                      = _UxGT("Narzędzia UBL");
141
   LSTR MSG_UBL_TOOLS                      = _UxGT("Narzędzia UBL");
141
   LSTR MSG_LCD_TILTING_MESH               = _UxGT("Punkt pochylenia");
142
   LSTR MSG_LCD_TILTING_MESH               = _UxGT("Punkt pochylenia");

+ 1
- 2
Marlin/src/lcd/language/language_pt_br.h View File

111
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicação");
111
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplicação");
112
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Cópia espelhada");
112
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Cópia espelhada");
113
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Controle Total");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2o bico Z");
114
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2o bico Z");
115
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2o bico @");
117
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
116
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Executando G29");
118
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
117
   LSTR MSG_UBL_TOOLS                      = _UxGT("Ferramentas UBL");
119
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivel. Mesa Unif.");
118
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Nivel. Mesa Unif.");

+ 1
- 2
Marlin/src/lcd/language/language_ro.h View File

120
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
120
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
121
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
121
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
122
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
123
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
124
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
126
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
125
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Doing G29");
127
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
126
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Tools");
128
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");
127
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Unified Bed Leveling");

+ 1
- 2
Marlin/src/lcd/language/language_ru.h View File

197
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Полный контроль");
197
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Полный контроль");
198
   LSTR MSG_IDEX_DUPE_GAP                    = _UxGT("Дублировать X-зазор");
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
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("2-е сопло Z");
200
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("2-е сопло Z");
201
+  LSTR MSG_HOTEND_OFFSET_A                  = _UxGT("2-е сопло @");
203
 
202
 
204
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Выполняем G29");
203
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Выполняем G29");
205
   LSTR MSG_UBL_TOOLS                        = _UxGT("Инструменты UBL");
204
   LSTR MSG_UBL_TOOLS                        = _UxGT("Инструменты UBL");

+ 4
- 2
Marlin/src/lcd/language/language_sk.h View File

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

+ 1
- 2
Marlin/src/lcd/language/language_sv.h View File

145
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Speglad Kopia");
145
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Speglad Kopia");
146
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Kontroll");
146
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Kontroll");
147
   LSTR MSG_IDEX_DUPE_GAP                  = _UxGT("Duplicera X-Avstånd");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2:a Munstycke Z");
148
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2:a Munstycke Z");
149
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2:a Munstycke @");
151
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Utför G29");
150
   LSTR MSG_UBL_DOING_G29                  = _UxGT("Utför G29");
152
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Verktyg");
151
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Verktyg");
153
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Enad Bädd Nivellering (UBL)");
152
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("Enad Bädd Nivellering (UBL)");

+ 1
- 2
Marlin/src/lcd/language/language_tr.h View File

123
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Kopyala");
123
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Kopyala");
124
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Yansıtılmış kopya");
124
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Yansıtılmış kopya");
125
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Tam Kontrol");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. nozul Z");
126
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2. nozul Z");
127
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2. nozul @");
129
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 Çalışıyor");
128
   LSTR MSG_UBL_DOING_G29                  = _UxGT("G29 Çalışıyor");
130
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Araçları");
129
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL Araçları");
131
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("UBL Yatak Hizalama");
130
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("UBL Yatak Hizalama");

+ 1
- 2
Marlin/src/lcd/language/language_uk.h View File

198
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Повний контроль");
198
   LSTR MSG_IDEX_MODE_FULL_CTRL              = _UxGT("Повний контроль");
199
   LSTR MSG_IDEX_DUPE_GAP                    = _UxGT("Дублюв. X-проміжок");
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
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("Друге сопло Z");
201
   LSTR MSG_HOTEND_OFFSET_Z                  = _UxGT("Друге сопло Z");
202
+  LSTR MSG_HOTEND_OFFSET_A                  = _UxGT("Друге сопло @");
204
 
203
 
205
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Виконується G29");
204
   LSTR MSG_UBL_DOING_G29                    = _UxGT("Виконується G29");
206
   LSTR MSG_UBL_TOOLS                        = _UxGT("Інструменти UBL");
205
   LSTR MSG_UBL_TOOLS                        = _UxGT("Інструменти UBL");

+ 1
- 2
Marlin/src/lcd/language/language_zh_CN.h View File

119
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("复制");
119
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("复制");
120
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("镜像复制");
120
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("镜像复制");
121
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("完全控制");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("第二喷头是Z");
122
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("第二喷头是Z");
123
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("第二喷头是@");
125
   LSTR MSG_UBL_DOING_G29                  = _UxGT("执行G29");     // "Doing G29"
124
   LSTR MSG_UBL_DOING_G29                  = _UxGT("执行G29");     // "Doing G29"
126
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
125
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
127
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("统一热床调平(UBL)");     // "Unified Bed Leveling"
126
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("统一热床调平(UBL)");     // "Unified Bed Leveling"

+ 1
- 2
Marlin/src/lcd/language/language_zh_TW.h View File

116
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
116
   LSTR MSG_IDEX_MODE_DUPLICATE            = _UxGT("Duplication");
117
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
117
   LSTR MSG_IDEX_MODE_MIRRORED_COPY        = _UxGT("Mirrored Copy");
118
   LSTR MSG_IDEX_MODE_FULL_CTRL            = _UxGT("Full Control");
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
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
119
   LSTR MSG_HOTEND_OFFSET_Z                = _UxGT("2nd Nozzle Z");
120
+  LSTR MSG_HOTEND_OFFSET_A                = _UxGT("2nd Nozzle @");
122
   LSTR MSG_UBL_DOING_G29                  = _UxGT("執行G29");     // "Doing G29"
121
   LSTR MSG_UBL_DOING_G29                  = _UxGT("執行G29");     // "Doing G29"
123
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
122
   LSTR MSG_UBL_TOOLS                      = _UxGT("UBL工具");     // "UBL Tools"
124
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("統一熱床調平(UBL)");     // "Unified Bed Leveling"
123
   LSTR MSG_UBL_LEVEL_BED                  = _UxGT("統一熱床調平(UBL)");     // "Unified Bed Leveling"

+ 6
- 0
Marlin/src/lcd/lcdprint.cpp View File

36
  *
36
  *
37
  * Print a string with an index substituted within it:
37
  * Print a string with an index substituted within it:
38
  *
38
  *
39
+ *   $ displays the clipped C-string given by the inStr argument
39
  *   = displays  '0'....'10' for indexes 0 - 10
40
  *   = displays  '0'....'10' for indexes 0 - 10
40
  *   ~ displays  '1'....'11' for indexes 0 - 10
41
  *   ~ displays  '1'....'11' for indexes 0 - 10
41
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
 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*/) {
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
   const uint8_t prop = USE_WIDE_GLYPH ? 2 : 1;
46
   const uint8_t prop = USE_WIDE_GLYPH ? 2 : 1;
72
     else if (ch == '$' && inStr) {
74
     else if (ch == '$' && inStr) {
73
       n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
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
     else {
81
     else {
76
       lcd_put_wchar(ch);
82
       lcd_put_wchar(ch);
77
       n -= ch > 255 ? prop : 1;
83
       n -= ch > 255 ? prop : 1;

+ 9
- 23
Marlin/src/lcd/menu/menu.cpp View File

103
 /////////// Menu Editing Actions ///////////
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
 void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
107
 void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
108
+  // Reset repeat_delay for Touch Buttons
130
   TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
109
   TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
110
+  // Constrain ui.encoderPosition to 0 ... maxEditValue (calculated in encoder steps)
131
   if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
111
   if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
132
   if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
112
   if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
113
+  // If drawing is flagged then redraw the (whole) edit screen
133
   if (ui.should_draw())
114
   if (ui.should_draw())
134
     draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
115
     draw_edit_screen(strfunc(ui.encoderPosition + minEditValue));
116
+  // If there was a click or "live editing" and encoder moved...
135
   if (ui.lcd_clicked || (liveEdit && ui.should_draw())) {
117
   if (ui.lcd_clicked || (liveEdit && ui.should_draw())) {
118
+    // Pass the editValue pointer to the loadfunc along with the encoder plus min
136
     if (editValue) loadfunc(editValue, ui.encoderPosition + minEditValue);
119
     if (editValue) loadfunc(editValue, ui.encoderPosition + minEditValue);
120
+    // If a callbackFunc was set, call it for click or always for "live editing"
137
     if (callbackFunc && (liveEdit || ui.lcd_clicked)) (*callbackFunc)();
121
     if (callbackFunc && (liveEdit || ui.lcd_clicked)) (*callbackFunc)();
122
+    // Use up the click to finish editing and go to the previous screen
138
     if (ui.use_click()) ui.goto_previous_screen();
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
 void MenuEditItemBase::goto_edit_screen(
128
 void MenuEditItemBase::goto_edit_screen(
143
   PGM_P const el,         // Edit label
129
   PGM_P const el,         // Edit label
144
   void * const ev,        // Edit value pointer
130
   void * const ev,        // Edit value pointer

+ 4
- 2
Marlin/src/lcd/menu/menu.h View File

60
     // Store the index of the item ahead of use by indexed items
60
     // Store the index of the item ahead of use by indexed items
61
     FORCE_INLINE static void init(const int8_t ind=0, PGM_P const pstr=nullptr) { itemIndex = ind; itemString = pstr; }
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
     // Draw an item either selected (pre_char) or not (space) with post_char
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
     static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char);
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
     // Draw an item either selected ('>') or not (space) with post_char
68
     // Draw an item either selected ('>') or not (space) with post_char
167
     );
169
     );
168
     static void edit_screen(strfunc_t, loadfunc_t); // Edit value handler
170
     static void edit_screen(strfunc_t, loadfunc_t); // Edit value handler
169
   public:
171
   public:
170
-    // Implemented for HD44780 and DOGM
172
+    // Implementation-specific:
171
     // Draw the current item at specified row with edit data
173
     // Draw the current item at specified row with edit data
172
     static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm=false);
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
     // This low-level method is good to draw from anywhere
177
     // This low-level method is good to draw from anywhere
176
     static void draw_edit_screen(PGM_P const pstr, const char * const value);
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 View File

174
     START_MENU();
174
     START_MENU();
175
     BACK_ITEM(MSG_CONFIGURATION);
175
     BACK_ITEM(MSG_CONFIGURATION);
176
     #if ENABLED(DUAL_X_CARRIAGE)
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
     #else
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
     #endif
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
     #if ENABLED(EEPROM_SETTINGS)
183
     #if ENABLED(EEPROM_SETTINGS)
184
       ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
184
       ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
185
     #endif
185
     #endif

+ 17
- 3
Marlin/src/lcd/menu/menu_item.h View File

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
 #define __DOFIXfloat PROBE()
126
 #define __DOFIXfloat PROBE()
113
 #define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
127
 #define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
114
 #define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \
128
 #define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \

+ 12
- 12
Marlin/src/lcd/menu/menu_motion.cpp View File

329
     BACK_ITEM(MSG_MOTION);
329
     BACK_ITEM(MSG_MOTION);
330
 
330
 
331
     GCODES_ITEM(MSG_AUTO_HOME, G28_STR);
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
     #if HAS_Y_AXIS
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
     #endif
335
     #endif
336
     #if HAS_Z_AXIS
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
     #endif
338
     #endif
339
     #if LINEAR_AXES >= 4
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
     #endif
341
     #endif
342
     #if LINEAR_AXES >= 5
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
     #endif
344
     #endif
345
     #if LINEAR_AXES >= 6
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
     #endif
347
     #endif
348
 
348
 
349
     END_MENU();
349
     END_MENU();
382
   #else
382
   #else
383
     GCODES_ITEM(MSG_AUTO_HOME, G28_STR);
383
     GCODES_ITEM(MSG_AUTO_HOME, G28_STR);
384
     #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU)
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
       #if HAS_Y_AXIS
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
       #endif
388
       #endif
389
       #if HAS_Z_AXIS
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
       #endif
391
       #endif
392
       #if LINEAR_AXES >= 4
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
       #endif
394
       #endif
395
       #if LINEAR_AXES >= 5
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
       #endif
397
       #endif
398
       #if LINEAR_AXES >= 6
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
       #endif
400
       #endif
401
     #endif
401
     #endif
402
   #endif
402
   #endif

+ 10
- 11
Marlin/src/lcd/tft/tft_string.cpp View File

89
 /**
89
 /**
90
  * Add a string, applying substitutions for the following characters:
90
  * Add a string, applying substitutions for the following characters:
91
  *
91
  *
92
+ *   $ displays an inserted C-string given by the itemString parameter
92
  *   = displays  '0'....'10' for indexes 0 - 10
93
  *   = displays  '0'....'10' for indexes 0 - 10
93
  *   ~ displays  '1'....'11' for indexes 0 - 10
94
  *   ~ displays  '1'....'11' for indexes 0 - 10
94
  *   * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
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
   wchar_t wchar;
99
   wchar_t wchar;
98
 
100
 
99
   while (*string) {
101
   while (*string) {
108
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
110
         if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
109
         add_character('0' + inum);
111
         add_character('0' + inum);
110
       }
112
       }
111
-      else {
113
+      else
112
         add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED));
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
       add(itemString);
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
   eol();
123
   eol();
124
 }
124
 }
150
       span -= glyph(data[length])->DWidth;
150
       span -= glyph(data[length])->DWidth;
151
       eol();
151
       eol();
152
     }
152
     }
153
-    else {
153
+    else
154
       break;
154
       break;
155
-    }
156
   }
155
   }
157
 }
156
 }
158
 
157
 

Loading…
Cancel
Save