|
@@ -22,7 +22,7 @@
|
22
|
22
|
|
23
|
23
|
#include "../../inc/MarlinConfigPre.h"
|
24
|
24
|
|
25
|
|
-#if HAS_UI_480x320
|
|
25
|
+#if HAS_UI_480x320 || HAS_UI_480x272
|
26
|
26
|
|
27
|
27
|
#include "ui_480x320.h"
|
28
|
28
|
|
|
@@ -56,9 +56,9 @@
|
56
|
56
|
void MarlinUI::tft_idle() {
|
57
|
57
|
#if ENABLED(TOUCH_SCREEN)
|
58
|
58
|
if (draw_menu_navigation) {
|
59
|
|
- add_control(104, 286, PAGE_UP, imgPageUp, encoderTopLine > 0);
|
60
|
|
- add_control(344, 286, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
|
61
|
|
- add_control(224, 286, BACK, imgBack);
|
|
59
|
+ add_control(104, TFT_HEIGHT - 34, PAGE_UP, imgPageUp, encoderTopLine > 0);
|
|
60
|
+ add_control(344, TFT_HEIGHT - 34, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
|
|
61
|
+ add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
|
62
|
62
|
draw_menu_navigation = false;
|
63
|
63
|
}
|
64
|
64
|
#endif
|
|
@@ -259,10 +259,12 @@ void MarlinUI::draw_status_screen() {
|
259
|
259
|
}
|
260
|
260
|
}
|
261
|
261
|
|
|
262
|
+ y += TERN(HAS_UI_480x272, 118, 128);
|
|
263
|
+
|
262
|
264
|
// coordinates
|
263
|
|
- tft.canvas(4, 132, TFT_WIDTH - 8, 34);
|
|
265
|
+ tft.canvas(4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT);
|
264
|
266
|
tft.set_background(COLOR_BACKGROUND);
|
265
|
|
- tft.add_rectangle(0, 0, TFT_WIDTH - 8, 34, COLOR_AXIS_HOMED);
|
|
267
|
+ tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
266
|
268
|
|
267
|
269
|
tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
|
268
|
270
|
tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
|
|
@@ -290,10 +292,11 @@ void MarlinUI::draw_status_screen() {
|
290
|
292
|
offset -= tft_string.width();
|
291
|
293
|
}
|
292
|
294
|
tft.add_text(455 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
293
|
|
- TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, 132, TFT_WIDTH - 8, 34));
|
|
295
|
+ TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
294
|
296
|
|
|
297
|
+ y += TERN(HAS_UI_480x272, 38, 48);
|
295
|
298
|
// feed rate
|
296
|
|
- tft.canvas(96, 180, 100, 32);
|
|
299
|
+ tft.canvas(96, y, 100, 32);
|
297
|
300
|
tft.set_background(COLOR_BACKGROUND);
|
298
|
301
|
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
299
|
302
|
tft.add_image(0, 0, imgFeedRate, color);
|
|
@@ -303,7 +306,7 @@ void MarlinUI::draw_status_screen() {
|
303
|
306
|
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 96, 176, 100, 32));
|
304
|
307
|
|
305
|
308
|
// flow rate
|
306
|
|
- tft.canvas(284, 180, 100, 32);
|
|
309
|
+ tft.canvas(284, y, 100, 32);
|
307
|
310
|
tft.set_background(COLOR_BACKGROUND);
|
308
|
311
|
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
309
|
312
|
tft.add_image(0, 0, imgFlowRate, color);
|
|
@@ -312,36 +315,38 @@ void MarlinUI::draw_status_screen() {
|
312
|
315
|
tft.add_text(36, 1, color , tft_string);
|
313
|
316
|
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 284, 176, 100, 32, active_extruder));
|
314
|
317
|
|
|
318
|
+ #if ENABLED(TOUCH_SCREEN)
|
|
319
|
+ add_control(404, y, menu_main, imgSettings);
|
|
320
|
+ TERN_(SDSUPPORT, add_control(12, y, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
|
|
321
|
+ #endif
|
|
322
|
+
|
|
323
|
+ y += TERN(HAS_UI_480x272, 36, 44);
|
315
|
324
|
// print duration
|
316
|
325
|
char buffer[14];
|
317
|
326
|
duration_t elapsed = print_job_timer.duration();
|
318
|
327
|
elapsed.toDigital(buffer);
|
319
|
328
|
|
320
|
|
- tft.canvas((TFT_WIDTH - 128) / 2, 224, 128, 29);
|
|
329
|
+ tft.canvas((TFT_WIDTH - 128) / 2, y, 128, 29);
|
321
|
330
|
tft.set_background(COLOR_BACKGROUND);
|
322
|
331
|
tft_string.set(buffer);
|
323
|
332
|
tft.add_text(tft_string.center(128), 0, COLOR_PRINT_TIME, tft_string);
|
324
|
333
|
|
|
334
|
+ y += TERN(HAS_UI_480x272, 28, 36);
|
325
|
335
|
// progress bar
|
326
|
336
|
const uint8_t progress = ui.get_progress_percent();
|
327
|
|
- tft.canvas(4, 260, TFT_WIDTH - 8, 9);
|
|
337
|
+ tft.canvas(4, y, TFT_WIDTH - 8, 9);
|
328
|
338
|
tft.set_background(COLOR_PROGRESS_BG);
|
329
|
339
|
tft.add_rectangle(0, 0, TFT_WIDTH - 8, 9, COLOR_PROGRESS_FRAME);
|
330
|
340
|
if (progress)
|
331
|
341
|
tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);
|
332
|
342
|
|
|
343
|
+ y += 20;
|
333
|
344
|
// status message
|
334
|
|
- tft.canvas(0, 280, TFT_WIDTH, 29);
|
|
345
|
+ tft.canvas(0, y, TFT_WIDTH, FONT_LINE_HEIGHT - 5);
|
335
|
346
|
tft.set_background(COLOR_BACKGROUND);
|
336
|
347
|
tft_string.set(status_message);
|
337
|
348
|
tft_string.trim();
|
338
|
349
|
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_STATUS_MESSAGE, tft_string);
|
339
|
|
-
|
340
|
|
-
|
341
|
|
- #if ENABLED(TOUCH_SCREEN)
|
342
|
|
- add_control(404, 180, menu_main, imgSettings);
|
343
|
|
- TERN_(SDSUPPORT, add_control(12, 180, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
|
344
|
|
- #endif
|
345
|
350
|
}
|
346
|
351
|
|
347
|
352
|
// Draw a static item with no left-right margin required. Centered by default.
|
|
@@ -450,9 +455,9 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
|
450
|
455
|
|
451
|
456
|
void TFT::draw_edit_screen_buttons() {
|
452
|
457
|
#if ENABLED(TOUCH_SCREEN)
|
453
|
|
- add_control(64, 256, DECREASE, imgDecrease);
|
454
|
|
- add_control(352, 256, INCREASE, imgIncrease);
|
455
|
|
- add_control(208, 256, CLICK, imgConfirm);
|
|
458
|
+ add_control(64, TFT_HEIGHT - 64, DECREASE, imgDecrease);
|
|
459
|
+ add_control(352, TFT_HEIGHT - 64, INCREASE, imgIncrease);
|
|
460
|
+ add_control(208, TFT_HEIGHT - 64, CLICK, imgConfirm);
|
456
|
461
|
#endif
|
457
|
462
|
}
|
458
|
463
|
|
|
@@ -481,8 +486,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
481
|
486
|
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
|
482
|
487
|
}
|
483
|
488
|
#if ENABLED(TOUCH_SCREEN)
|
484
|
|
- add_control(88, 256, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
485
|
|
- add_control(328, 256, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
|
489
|
+ add_control(88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
|
490
|
+ add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
486
|
491
|
#endif
|
487
|
492
|
}
|
488
|
493
|
|
|
@@ -541,7 +546,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
541
|
546
|
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
|
542
|
547
|
lpos = pos.asLogical();
|
543
|
548
|
|
544
|
|
- tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2 - 43, 120, 43);
|
|
549
|
+ tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
|
545
|
550
|
tft.set_background(COLOR_BACKGROUND);
|
546
|
551
|
tft_string.set(X_LBL);
|
547
|
552
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -549,7 +554,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
549
|
554
|
tft_string.trim();
|
550
|
555
|
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
551
|
556
|
|
552
|
|
- tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2, 120, 43);
|
|
557
|
+ tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 120, MENU_ITEM_HEIGHT);
|
553
|
558
|
tft.set_background(COLOR_BACKGROUND);
|
554
|
559
|
tft_string.set(Y_LBL);
|
555
|
560
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -557,7 +562,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
557
|
562
|
tft_string.trim();
|
558
|
563
|
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
559
|
564
|
|
560
|
|
- tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2 + 43, 120, 43);
|
|
565
|
+ tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
|
561
|
566
|
tft.set_background(COLOR_BACKGROUND);
|
562
|
567
|
tft_string.set(Z_LBL);
|
563
|
568
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -566,13 +571,13 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
566
|
571
|
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
567
|
572
|
|
568
|
573
|
|
569
|
|
- tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - 48) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 5, 48, 43);
|
|
574
|
+ tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - 48) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 5, 48, MENU_ITEM_HEIGHT);
|
570
|
575
|
tft.set_background(COLOR_BACKGROUND);
|
571
|
576
|
tft_string.set(ui8tostr3rj(x_plot));
|
572
|
577
|
tft_string.trim();
|
573
|
578
|
tft.add_text(tft_string.center(48), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
574
|
579
|
|
575
|
|
- tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET + 16 - 24, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2, 48, 43);
|
|
580
|
+ tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET + 16 - 24, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 48, MENU_ITEM_HEIGHT);
|
576
|
581
|
tft.set_background(COLOR_BACKGROUND);
|
577
|
582
|
tft_string.set(ui8tostr3rj(y_plot));
|
578
|
583
|
tft_string.trim();
|
|
@@ -586,7 +591,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
586
|
591
|
add_control(GRID_OFFSET_X + CONTROL_OFFSET, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, UBL, - ENCODER_STEPS_PER_MENU_ITEM, imgLeft);
|
587
|
592
|
add_control(GRID_OFFSET_X + GRID_WIDTH - CONTROL_OFFSET - 32, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, UBL, ENCODER_STEPS_PER_MENU_ITEM, imgRight);
|
588
|
593
|
add_control(320, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, CLICK, imgLeveling);
|
589
|
|
- add_control(224, 286, BACK, imgBack);
|
|
594
|
+ add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
|
590
|
595
|
#endif
|
591
|
596
|
}
|
592
|
597
|
#endif // AUTO_BED_LEVELING_UBL
|
|
@@ -644,7 +649,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
644
|
649
|
#endif // TOUCH_SCREEN_CALIBRATION
|
645
|
650
|
|
646
|
651
|
void menu_line(const uint8_t row, uint16_t color) {
|
647
|
|
- tft.canvas(0, 4 + 45 * row, TFT_WIDTH, 43);
|
|
652
|
+ tft.canvas(0, 4 + (MENU_ITEM_HEIGHT + 2) * row, TFT_WIDTH, MENU_ITEM_HEIGHT);
|
648
|
653
|
tft.set_background(color);
|
649
|
654
|
}
|
650
|
655
|
|
|
@@ -661,7 +666,7 @@ void menu_item(const uint8_t row, bool sel ) {
|
661
|
666
|
menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
|
662
|
667
|
#if ENABLED(TOUCH_SCREEN)
|
663
|
668
|
const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? MENU_CLICK : MENU_ITEM;
|
664
|
|
- touch.add_control(tct, 0, 4 + 45 * row, TFT_WIDTH, 43, encoderTopLine + row);
|
|
669
|
+ touch.add_control(tct, 0, 4 + (MENU_ITEM_HEIGHT + 2) * row, TFT_WIDTH, MENU_ITEM_HEIGHT, encoderTopLine + row);
|
665
|
670
|
#endif
|
666
|
671
|
}
|
667
|
672
|
|