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

This commit is contained in:
Scott Lahteine
2021-10-04 00:24:41 -05:00
committed by GitHub
parent eb784d6e55
commit 54d400608d
26 changed files with 100 additions and 106 deletions

View File

@@ -36,9 +36,11 @@
*
* Print a string with an index substituted within it:
*
* $ displays the clipped C-string given by the inStr argument
* = displays '0'....'10' for indexes 0 - 10
* ~ displays '1'....'11' for indexes 0 - 10
* * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
* @ displays an axis name such as XYZUVW, or E for an extruder
*/
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*/) {
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
else if (ch == '$' && inStr) {
n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
}
else if (ch == '@') {
lcd_put_wchar(axis_codes[ind]);
n--;
}
else {
lcd_put_wchar(ch);
n -= ch > 255 ? prop : 1;