|
@@ -401,9 +401,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
401
|
401
|
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
|
402
|
402
|
uint8_t slen = utf8_strlen_P(text);
|
403
|
403
|
if (slen < len) {
|
404
|
|
- // Fits into,
|
405
|
|
- lcd_moveto(col, line);
|
406
|
|
- lcd_put_u8str_max_P(text, len);
|
|
404
|
+ lcd_put_u8str_max_P(col, line, text, len);
|
407
|
405
|
for (; slen < len; ++slen) lcd_put_wchar(' ');
|
408
|
406
|
safe_delay(time);
|
409
|
407
|
}
|
|
@@ -412,11 +410,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
412
|
410
|
int dly = time / _MAX(slen, 1);
|
413
|
411
|
for (uint8_t i = 0; i <= slen; i++) {
|
414
|
412
|
|
415
|
|
- // Go to the correct place
|
416
|
|
- lcd_moveto(col, line);
|
417
|
|
-
|
418
|
|
- // Print the text
|
419
|
|
- lcd_put_u8str_max_P(p, len);
|
|
413
|
+ // Print the text at the correct place
|
|
414
|
+ lcd_put_u8str_max_P(col, line, p, len);
|
420
|
415
|
|
421
|
416
|
// Fill with spaces
|
422
|
417
|
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
|
|
@@ -433,9 +428,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
433
|
428
|
|
434
|
429
|
static void logo_lines(PGM_P const extra) {
|
435
|
430
|
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
|
436
|
|
- lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
437
|
|
- lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
438
|
|
- lcd_moveto(indent, 2); lcd_put_wchar('\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
|
431
|
+ lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
|
432
|
+ lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
|
433
|
+ lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
439
|
434
|
}
|
440
|
435
|
|
441
|
436
|
void MarlinUI::show_bootscreen() {
|
|
@@ -447,8 +442,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
447
|
442
|
#define CENTER_OR_SCROLL(STRING,DELAY) \
|
448
|
443
|
lcd_erase_line(3); \
|
449
|
444
|
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
|
450
|
|
- lcd_moveto((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3); \
|
451
|
|
- lcd_put_u8str_P(PSTR(STRING)); \
|
|
445
|
+ lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
|
452
|
446
|
safe_delay(DELAY); \
|
453
|
447
|
} \
|
454
|
448
|
else { \
|
|
@@ -518,16 +512,12 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
518
|
512
|
#endif // SHOW_BOOTSCREEN
|
519
|
513
|
|
520
|
514
|
void MarlinUI::draw_kill_screen() {
|
521
|
|
- lcd_moveto(0, 0);
|
522
|
|
- lcd_put_u8str(status_message);
|
523
|
|
- #if LCD_HEIGHT < 4
|
524
|
|
- lcd_moveto(0, 2);
|
525
|
|
- #else
|
526
|
|
- lcd_moveto(0, 2);
|
527
|
|
- lcd_put_u8str_P(PSTR(MSG_HALTED));
|
528
|
|
- lcd_moveto(0, 3);
|
|
515
|
+ lcd_put_u8str(0, 0, status_message);
|
|
516
|
+ lcd_uint_t y = 2;
|
|
517
|
+ #if LCD_HEIGHT >= 4
|
|
518
|
+ lcd_put_u8str_P(0, y++, PSTR(MSG_HALTED));
|
529
|
519
|
#endif
|
530
|
|
- lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
|
|
520
|
+ lcd_put_u8str_P(0, y, PSTR(MSG_PLEASE_RESET));
|
531
|
521
|
}
|
532
|
522
|
|
533
|
523
|
//
|
|
@@ -886,8 +876,7 @@ void MarlinUI::draw_status_screen() {
|
886
|
876
|
|
887
|
877
|
#if LCD_HEIGHT > 3
|
888
|
878
|
|
889
|
|
- lcd_moveto(0, 2);
|
890
|
|
- lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
|
879
|
+ lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
|
891
|
880
|
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
892
|
881
|
lcd_put_wchar('%');
|
893
|
882
|
|
|
@@ -895,8 +884,7 @@ void MarlinUI::draw_status_screen() {
|
895
|
884
|
duration_t elapsed = print_job_timer.duration();
|
896
|
885
|
const uint8_t len = elapsed.toDigital(buffer),
|
897
|
886
|
timepos = LCD_WIDTH - len - 1;
|
898
|
|
- lcd_moveto(timepos, 2);
|
899
|
|
- lcd_put_wchar(LCD_STR_CLOCK[0]);
|
|
887
|
+ lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
900
|
888
|
lcd_put_u8str(buffer);
|
901
|
889
|
|
902
|
890
|
#if LCD_WIDTH >= 20
|
|
@@ -945,8 +933,7 @@ void MarlinUI::draw_status_screen() {
|
945
|
933
|
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
|
946
|
934
|
|
947
|
935
|
#if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED)
|
948
|
|
- lcd_moveto(LCD_WIDTH - 1, 0);
|
949
|
|
- lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
|
|
936
|
+ lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
|
950
|
937
|
#endif
|
951
|
938
|
|
952
|
939
|
// ========== Line 2 ==========
|
|
@@ -961,8 +948,7 @@ void MarlinUI::draw_status_screen() {
|
961
|
948
|
_draw_bed_status(blink);
|
962
|
949
|
#endif
|
963
|
950
|
|
964
|
|
- lcd_moveto(LCD_WIDTH - 9, 1);
|
965
|
|
- lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
|
951
|
+ lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
966
|
952
|
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
967
|
953
|
lcd_put_wchar('%');
|
968
|
954
|
|
|
@@ -1033,8 +1019,7 @@ void MarlinUI::draw_status_screen() {
|
1033
|
1019
|
|
1034
|
1020
|
void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
|
1035
|
1021
|
uint8_t n = LCD_WIDTH - 2;
|
1036
|
|
- lcd_moveto(0, row);
|
1037
|
|
- lcd_put_wchar(sel ? pre_char : ' ');
|
|
1022
|
+ lcd_put_wchar(0, row, sel ? pre_char : ' ');
|
1038
|
1023
|
n -= lcd_put_u8str_max_P(pstr, n);
|
1039
|
1024
|
for (; n; --n) lcd_put_wchar(' ');
|
1040
|
1025
|
lcd_put_wchar(post_char);
|
|
@@ -1042,8 +1027,7 @@ void MarlinUI::draw_status_screen() {
|
1042
|
1027
|
|
1043
|
1028
|
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
|
1044
|
1029
|
uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data));
|
1045
|
|
- lcd_moveto(0, row);
|
1046
|
|
- lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
|
1030
|
+ lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
1047
|
1031
|
n -= lcd_put_u8str_max_P(pstr, n);
|
1048
|
1032
|
lcd_put_wchar(':');
|
1049
|
1033
|
for (; n; --n) lcd_put_wchar(' ');
|
|
@@ -1053,14 +1037,12 @@ void MarlinUI::draw_status_screen() {
|
1053
|
1037
|
void draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
|
1054
|
1038
|
ui.encoder_direction_normal();
|
1055
|
1039
|
|
1056
|
|
- lcd_moveto(0, 1);
|
1057
|
|
- lcd_put_u8str_P(pstr);
|
|
1040
|
+ lcd_put_u8str_P(0, 1, pstr);
|
1058
|
1041
|
if (value != nullptr) {
|
1059
|
1042
|
lcd_put_wchar(':');
|
1060
|
1043
|
int len = utf8_strlen(value);
|
1061
|
1044
|
const lcd_uint_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
1062
|
|
- lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
|
1063
|
|
- lcd_put_wchar(' '); // Overwrite char if value gets shorter
|
|
1045
|
+ lcd_put_wchar((LCD_WIDTH - 1) - (len + 1), valrow, ' '); // Right-justified, padded, add a leading space
|
1064
|
1046
|
lcd_put_u8str(value);
|
1065
|
1047
|
}
|
1066
|
1048
|
}
|
|
@@ -1078,8 +1060,7 @@ void MarlinUI::draw_status_screen() {
|
1078
|
1060
|
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
|
1079
|
1061
|
UNUSED(pstr);
|
1080
|
1062
|
|
1081
|
|
- lcd_moveto(0, row);
|
1082
|
|
- lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
|
1063
|
+ lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
1083
|
1064
|
constexpr uint8_t maxlen = LCD_WIDTH - 2;
|
1084
|
1065
|
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
1085
|
1066
|
for (; n; --n) lcd_put_wchar(' ');
|
|
@@ -1206,8 +1187,7 @@ void MarlinUI::draw_status_screen() {
|
1206
|
1187
|
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
|
1207
|
1188
|
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
1208
|
1189
|
lcd.createChar(c, (uint8_t*)&chrdata);
|
1209
|
|
- lcd_moveto(x, y);
|
1210
|
|
- lcd_put_wchar(c);
|
|
1190
|
+ lcd_put_wchar(x, y, c);
|
1211
|
1191
|
}
|
1212
|
1192
|
|
1213
|
1193
|
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
|
@@ -1216,7 +1196,7 @@ void MarlinUI::draw_status_screen() {
|
1216
|
1196
|
#define _LCD_W_POS 12
|
1217
|
1197
|
#define _PLOT_X 1
|
1218
|
1198
|
#define _MAP_X 3
|
1219
|
|
- #define _LABEL(C,X,Y) lcd_moveto(X, Y); lcd_put_u8str(C)
|
|
1199
|
+ #define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
|
1220
|
1200
|
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
1221
|
1201
|
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
1222
|
1202
|
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
|
@@ -1224,7 +1204,7 @@ void MarlinUI::draw_status_screen() {
|
1224
|
1204
|
#define _LCD_W_POS 8
|
1225
|
1205
|
#define _PLOT_X 0
|
1226
|
1206
|
#define _MAP_X 1
|
1227
|
|
- #define _LABEL(X,Y,C) lcd_moveto(X, Y); lcd_put_wchar(C)
|
|
1207
|
+ #define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
|
1228
|
1208
|
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
1229
|
1209
|
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
1230
|
1210
|
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
|
@@ -1288,17 +1268,13 @@ void MarlinUI::draw_status_screen() {
|
1288
|
1268
|
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
1289
|
1269
|
|
1290
|
1270
|
for (i = 0; i < n_cols; i++) {
|
1291
|
|
- lcd_moveto(i, 0);
|
1292
|
|
- lcd_put_wchar(CHAR_LINE_TOP); // Box Top line
|
1293
|
|
- lcd_moveto(i, n_rows - 1);
|
1294
|
|
- lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line
|
|
1271
|
+ lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line
|
|
1272
|
+ lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
|
1295
|
1273
|
}
|
1296
|
1274
|
|
1297
|
1275
|
for (j = 0; j < n_rows; j++) {
|
1298
|
|
- lcd_moveto(0, j);
|
1299
|
|
- lcd_put_wchar(CHAR_EDGE_L); // Box Left edge
|
1300
|
|
- lcd_moveto(n_cols - 1, j);
|
1301
|
|
- lcd_put_wchar(CHAR_EDGE_R); // Box Right edge
|
|
1276
|
+ lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge
|
|
1277
|
+ lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
|
1302
|
1278
|
}
|
1303
|
1279
|
|
1304
|
1280
|
/**
|
|
@@ -1308,10 +1284,8 @@ void MarlinUI::draw_status_screen() {
|
1308
|
1284
|
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
1309
|
1285
|
l = (HD44780_CHAR_HEIGHT) * n_rows;
|
1310
|
1286
|
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
1311
|
|
- lcd_moveto(0, n_rows - 1); // Box Left edge
|
1312
|
|
- lcd_put_wchar(' ');
|
1313
|
|
- lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge
|
1314
|
|
- lcd_put_wchar(' ');
|
|
1287
|
+ lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge
|
|
1288
|
+ lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
|
1315
|
1289
|
}
|
1316
|
1290
|
|
1317
|
1291
|
clear_custom_char(&new_char);
|
|
@@ -1425,8 +1399,7 @@ void MarlinUI::draw_status_screen() {
|
1425
|
1399
|
/**
|
1426
|
1400
|
* Print plot position
|
1427
|
1401
|
*/
|
1428
|
|
- lcd_moveto(_LCD_W_POS, 0);
|
1429
|
|
- lcd_put_wchar('(');
|
|
1402
|
+ lcd_put_wchar(_LCD_W_POS, 0, '(');
|
1430
|
1403
|
lcd_put_u8str(ui8tostr3(x_plot));
|
1431
|
1404
|
lcd_put_wchar(',');
|
1432
|
1405
|
lcd_put_u8str(ui8tostr3(y_plot));
|