|
@@ -49,9 +49,11 @@ void MarlinUI::tft_idle() {
|
|
|
#if ENABLED(TOUCH_SCREEN)
|
|
|
if (TERN0(HAS_TOUCH_SLEEP, lcd_sleep_task())) return;
|
|
|
if (draw_menu_navigation) {
|
|
|
- add_control(48, 206, PAGE_UP, imgPageUp, encoderTopLine > 0);
|
|
|
- add_control(240, 206, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
|
|
|
- add_control(144, 206, BACK, imgBack);
|
|
|
+ constexpr uint16_t cx = TERN(TFT_COLOR_UI_PORTRAIT, 16, 48),
|
|
|
+ cy = TERN(TFT_COLOR_UI_PORTRAIT, 286, 206);
|
|
|
+ add_control(cx, cy, PAGE_UP, imgPageUp, encoderTopLine > 0);
|
|
|
+ add_control(cx + 192, cy, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
|
|
|
+ add_control(cx + 96, cy, BACK, imgBack);
|
|
|
draw_menu_navigation = false;
|
|
|
}
|
|
|
#endif
|
|
@@ -97,19 +99,19 @@ void MarlinUI::draw_kill_screen() {
|
|
|
tft.queue.reset();
|
|
|
tft.fill(0, 0, TFT_WIDTH, TFT_HEIGHT, COLOR_KILL_SCREEN_BG);
|
|
|
|
|
|
- tft.canvas(0, 60, TFT_WIDTH, 24);
|
|
|
+ tft.canvas(0, 60, TFT_WIDTH, FONT_LINE_HEIGHT);
|
|
|
tft.set_background(COLOR_KILL_SCREEN_BG);
|
|
|
tft_string.set(status_message);
|
|
|
tft_string.trim();
|
|
|
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_KILL_SCREEN_TEXT, tft_string);
|
|
|
|
|
|
- tft.canvas(0, 120, TFT_WIDTH, 24);
|
|
|
+ tft.canvas(0, 120, TFT_WIDTH, FONT_LINE_HEIGHT);
|
|
|
tft.set_background(COLOR_KILL_SCREEN_BG);
|
|
|
tft_string.set(GET_TEXT(MSG_HALTED));
|
|
|
tft_string.trim();
|
|
|
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_KILL_SCREEN_TEXT, tft_string);
|
|
|
|
|
|
- tft.canvas(0, 160, TFT_WIDTH, 24);
|
|
|
+ tft.canvas(0, 160, TFT_WIDTH, FONT_LINE_HEIGHT);
|
|
|
tft.set_background(COLOR_KILL_SCREEN_BG);
|
|
|
tft_string.set(GET_TEXT(MSG_PLEASE_RESET));
|
|
|
tft_string.trim();
|
|
@@ -185,13 +187,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|
|
tft_string.set(i16tostr3rj(currentTemperature));
|
|
|
tft_string.add(LCD_STR_DEGREE);
|
|
|
tft_string.trim();
|
|
|
- tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(24), Color, tft_string);
|
|
|
+ tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
|
|
|
|
|
|
if (targetTemperature >= 0) {
|
|
|
tft_string.set(i16tostr3rj(targetTemperature));
|
|
|
tft_string.add(LCD_STR_DEGREE);
|
|
|
tft_string.trim();
|
|
|
- tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(24), Color, tft_string);
|
|
|
+ tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -214,7 +216,7 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink) {
|
|
|
|
|
|
tft_string.set(ui8tostr4pctrj(thermalManager.fan_speed[0]));
|
|
|
tft_string.trim();
|
|
|
- tft.add_text(tft_string.center(64) + 6, 69 + tft_string.vcenter(24), COLOR_FAN, tft_string);
|
|
|
+ tft.add_text(tft_string.center(64) + 6, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_FAN, tft_string);
|
|
|
}
|
|
|
|
|
|
void MarlinUI::draw_status_screen() {
|
|
@@ -226,7 +228,7 @@ void MarlinUI::draw_status_screen() {
|
|
|
uint16_t i, x, y = TFT_STATUS_TOP_Y;
|
|
|
|
|
|
for (i = 0 ; i < ITEMS_COUNT; i++) {
|
|
|
- x = (320 / ITEMS_COUNT - 64) / 2 + (320 * i / ITEMS_COUNT);
|
|
|
+ x = (TFT_WIDTH / ITEMS_COUNT - 64) / 2 + (TFT_WIDTH * i / ITEMS_COUNT);
|
|
|
switch (i) {
|
|
|
#ifdef ITEM_E0
|
|
|
case ITEM_E0: draw_heater_status(x, y, H_E0); break;
|
|
@@ -253,33 +255,60 @@ void MarlinUI::draw_status_screen() {
|
|
|
}
|
|
|
|
|
|
// coordinates
|
|
|
- tft.canvas(4, 103, 312, 24);
|
|
|
+ tft.canvas(4, 103,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 232, FONT_LINE_HEIGHT * 2
|
|
|
+ #else
|
|
|
+ 312, FONT_LINE_HEIGHT
|
|
|
+ #endif
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
- tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED);
|
|
|
+ tft.add_rectangle(0, 0,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 232, FONT_LINE_HEIGHT * 2
|
|
|
+ #else
|
|
|
+ 312, FONT_LINE_HEIGHT
|
|
|
+ #endif
|
|
|
+ , COLOR_AXIS_HOMED
|
|
|
+ );
|
|
|
|
|
|
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
|
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
|
|
- tft.add_text( 10, tft_string.vcenter(24), COLOR_AXIS_HOMED , "E");
|
|
|
+ tft.add_text( 10, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "E");
|
|
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
|
|
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
|
|
tft_string.add(escale == 10 ? 'c' : 'm');
|
|
|
tft_string.add('m');
|
|
|
- tft.add_text(127 - tft_string.width(), tft_string.vcenter(24), COLOR_AXIS_HOMED, tft_string);
|
|
|
+ tft.add_text(127 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
|
|
#endif
|
|
|
}
|
|
|
else {
|
|
|
- tft.add_text( 10, tft_string.vcenter(24), COLOR_AXIS_HOMED , "X");
|
|
|
+ tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X");
|
|
|
const bool nhx = axis_should_home(X_AXIS);
|
|
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
|
|
- tft.add_text( 68 - tft_string.width(), tft_string.vcenter(24), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
|
+ tft.add_text(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #else
|
|
|
+ 68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #endif
|
|
|
+ nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
|
|
+ );
|
|
|
|
|
|
- tft.add_text(127, tft_string.vcenter(24), COLOR_AXIS_HOMED , "Y");
|
|
|
+ tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Y");
|
|
|
const bool nhy = axis_should_home(Y_AXIS);
|
|
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
|
|
- tft.add_text(185 - tft_string.width(), tft_string.vcenter(24), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
|
+ tft.add_text(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #else
|
|
|
+ 185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #endif
|
|
|
+ nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- tft.add_text(219, tft_string.vcenter(24), COLOR_AXIS_HOMED , "Z");
|
|
|
+ tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z");
|
|
|
const bool nhz = axis_should_home(Z_AXIS);
|
|
|
uint16_t offset = 25;
|
|
|
if (blink && nhz)
|
|
@@ -293,61 +322,138 @@ void MarlinUI::draw_status_screen() {
|
|
|
tft_string.set(ftostr52sp(z));
|
|
|
offset -= tft_string.width();
|
|
|
}
|
|
|
- tft.add_text(301 - tft_string.width() - offset, tft_string.vcenter(24), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
|
- TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
|
|
|
+ tft.add_text(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #else
|
|
|
+ 301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
|
+ #endif
|
|
|
+ nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
|
+ TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 232, FONT_LINE_HEIGHT * 2
|
|
|
+ #else
|
|
|
+ 312, FONT_LINE_HEIGHT
|
|
|
+ #endif
|
|
|
+ ));
|
|
|
|
|
|
// feed rate
|
|
|
- tft.canvas(70, 136, 84, 32);
|
|
|
+ tft.canvas(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 30, 172, 80
|
|
|
+ #else
|
|
|
+ 70, 136, 84
|
|
|
+ #endif
|
|
|
+ , 32
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
|
|
tft.add_image(0, 0, imgFeedRate, color);
|
|
|
tft_string.set(i16tostr3rj(feedrate_percentage));
|
|
|
tft_string.add('%');
|
|
|
tft.add_text(32, tft_string.vcenter(30), color , tft_string);
|
|
|
- TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 70, 136, 84, 32));
|
|
|
+ TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 30, 172, 80
|
|
|
+ #else
|
|
|
+ 70, 136, 84
|
|
|
+ #endif
|
|
|
+ , 32
|
|
|
+ ));
|
|
|
|
|
|
// flow rate
|
|
|
- tft.canvas(170, 136, 84, 32);
|
|
|
+ tft.canvas(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 140, 172, 80
|
|
|
+ #else
|
|
|
+ 170, 136, 84
|
|
|
+ #endif
|
|
|
+ , 32
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
|
|
tft.add_image(0, 0, imgFlowRate, color);
|
|
|
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
|
|
tft_string.add('%');
|
|
|
tft.add_text(32, tft_string.vcenter(30), color , tft_string);
|
|
|
- TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 170, 136, 84, 32, active_extruder));
|
|
|
+ TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 140, 172, 80
|
|
|
+ #else
|
|
|
+ 170, 136, 84
|
|
|
+ #endif
|
|
|
+ , 32, active_extruder
|
|
|
+ ));
|
|
|
|
|
|
// print duration
|
|
|
char buffer[14];
|
|
|
duration_t elapsed = print_job_timer.duration();
|
|
|
elapsed.toDigital(buffer);
|
|
|
|
|
|
- tft.canvas(96, 173, 128, 24);
|
|
|
+ tft.canvas(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 56, 256, 128
|
|
|
+ #else
|
|
|
+ 96, 173, 128
|
|
|
+ #endif
|
|
|
+ , FONT_LINE_HEIGHT
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
tft_string.set(buffer);
|
|
|
- tft.add_text(tft_string.center(128), tft_string.vcenter(24), COLOR_PRINT_TIME, tft_string);
|
|
|
+ tft.add_text(tft_string.center(128), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_PRINT_TIME, tft_string);
|
|
|
|
|
|
// progress bar
|
|
|
const uint8_t progress = ui.get_progress_percent();
|
|
|
- tft.canvas(4, 198, 312, 9);
|
|
|
+ tft.canvas(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 4, 278, 232
|
|
|
+ #else
|
|
|
+ 4, 198, 312
|
|
|
+ #endif
|
|
|
+ , 9
|
|
|
+ );
|
|
|
tft.set_background(COLOR_PROGRESS_BG);
|
|
|
- tft.add_rectangle(0, 0, 312, 9, COLOR_PROGRESS_FRAME);
|
|
|
+ tft.add_rectangle(0, 0,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 232, 9
|
|
|
+ #else
|
|
|
+ 312, 9
|
|
|
+ #endif
|
|
|
+ , COLOR_PROGRESS_FRAME
|
|
|
+ );
|
|
|
if (progress)
|
|
|
- tft.add_bar(1, 1, (310 * progress) / 100, 7, COLOR_PROGRESS_BAR);
|
|
|
+ tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);
|
|
|
|
|
|
// status message
|
|
|
- tft.canvas(0, 212, 320, 24);
|
|
|
+ tft.canvas(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 0, 296, 240
|
|
|
+ #else
|
|
|
+ 0, 212, 320
|
|
|
+ #endif
|
|
|
+ , FONT_LINE_HEIGHT
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
tft_string.set(status_message);
|
|
|
tft_string.trim();
|
|
|
- tft.add_text(tft_string.center(TFT_WIDTH), tft_string.vcenter(24), COLOR_STATUS_MESSAGE, tft_string);
|
|
|
+ tft.add_text(tft_string.center(TFT_WIDTH), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_STATUS_MESSAGE, tft_string);
|
|
|
|
|
|
#if ENABLED(TOUCH_SCREEN)
|
|
|
- add_control(256, 130, menu_main, imgSettings);
|
|
|
+ {
|
|
|
+ add_control(
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ 176, 210
|
|
|
+ #else
|
|
|
+ 256, 130
|
|
|
+ #endif
|
|
|
+ , menu_main, imgSettings
|
|
|
+ );
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
const bool cm = card.isMounted(), pa = printingIsActive();
|
|
|
- add_control(0, 130, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
|
|
|
+ add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
|
|
|
#endif
|
|
|
- #endif
|
|
|
+ } // (sublime)
|
|
|
+ #endif // TOUCH_SCREEN
|
|
|
}
|
|
|
|
|
|
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
|
|
@@ -412,9 +518,9 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va
|
|
|
|
|
|
void TFT::draw_edit_screen_buttons() {
|
|
|
#if ENABLED(TOUCH_SCREEN)
|
|
|
- add_control(32, TFT_HEIGHT - 64, DECREASE, imgDecrease);
|
|
|
- add_control(224, TFT_HEIGHT - 64, INCREASE, imgIncrease);
|
|
|
- add_control(128, TFT_HEIGHT - 64, CLICK, imgConfirm);
|
|
|
+ add_control(TERN(TFT_COLOR_UI_PORTRAIT, 16, 32), TFT_HEIGHT - 64, DECREASE, imgDecrease);
|
|
|
+ add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 224), TFT_HEIGHT - 64, INCREASE, imgIncrease);
|
|
|
+ add_control(TERN(TFT_COLOR_UI_PORTRAIT, 96, 128), TFT_HEIGHT - 64, CLICK, imgConfirm);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -443,8 +549,8 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|
|
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
|
}
|
|
|
#if ENABLED(TOUCH_SCREEN)
|
|
|
- if (no) add_control( 48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
|
|
- if (yes) add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
|
|
+ if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 32, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
|
|
+ if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -625,9 +731,16 @@ static void drawCurESelection() {
|
|
|
}
|
|
|
|
|
|
static void drawMessage(PGM_P const msg) {
|
|
|
- tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20);
|
|
|
+ tft.canvas(X_MARGIN,
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
+ TFT_HEIGHT - 2 * BTN_HEIGHT, TFT_WIDTH - X_MARGIN
|
|
|
+ #else
|
|
|
+ TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN
|
|
|
+ #endif
|
|
|
+ , FONT_LINE_HEIGHT
|
|
|
+ );
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
- tft.add_text(0, 0, COLOR_YELLOW, msg);
|
|
|
+ tft.add_text(0, 0, COLOR_STATUS_MESSAGE, msg);
|
|
|
}
|
|
|
|
|
|
static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); }
|
|
@@ -646,7 +759,7 @@ static void drawAxisValue(const AxisEnum axis) {
|
|
|
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
|
|
default: return;
|
|
|
}
|
|
|
- tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, 20);
|
|
|
+ tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, FONT_LINE_HEIGHT);
|
|
|
tft.set_background(COLOR_BACKGROUND);
|
|
|
tft_string.set(ftostr52sp(value));
|
|
|
tft.add_text(0, 0, color, tft_string);
|
|
@@ -745,10 +858,8 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|
|
|
|
|
#if ENABLED(TOUCH_SCREEN)
|
|
|
static void e_select() {
|
|
|
- motionAxisState.e_selection++;
|
|
|
- if (motionAxisState.e_selection >= EXTRUDERS) {
|
|
|
+ if (++motionAxisState.e_selection >= EXTRUDERS)
|
|
|
motionAxisState.e_selection = 0;
|
|
|
- }
|
|
|
|
|
|
quick_feedback();
|
|
|
drawCurESelection();
|
|
@@ -773,16 +884,17 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|
|
quick_feedback();
|
|
|
drawCurStepValue();
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
-#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
|
|
- static void z_select() {
|
|
|
- motionAxisState.z_selection *= -1;
|
|
|
- quick_feedback();
|
|
|
- drawCurZSelection();
|
|
|
- drawAxisValue(Z_AXIS);
|
|
|
- }
|
|
|
-#endif
|
|
|
+ #if HAS_BED_PROBE
|
|
|
+ static void z_select() {
|
|
|
+ motionAxisState.z_selection *= -1;
|
|
|
+ quick_feedback();
|
|
|
+ drawCurZSelection();
|
|
|
+ drawAxisValue(Z_AXIS);
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
+#endif // TOUCH_SCREEN
|
|
|
|
|
|
static void disable_steppers() {
|
|
|
quick_feedback();
|
|
@@ -805,12 +917,12 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage
|
|
|
tft_string.trim();
|
|
|
tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string);
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
|
|
- }
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
|
|
|
}
|
|
|
+
|
|
|
void MarlinUI::move_axis_screen() {
|
|
|
// Reset
|
|
|
defer_status_screen(true);
|
|
@@ -827,93 +939,187 @@ void MarlinUI::move_axis_screen() {
|
|
|
if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
|
|
|
motionAxisState.z_selection = Z_SELECTION_Z_PROBE;
|
|
|
|
|
|
- // ROW 1 -> E- Y- CurY Z+
|
|
|
- int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
|
|
+ #if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
|
|
|
|
- drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
|
|
+ // ROW 1 -> E+ Y+ Z+
|
|
|
+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
|
|
|
|
|
- spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- uint16_t yplus_x = x;
|
|
|
- drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
|
|
|
+ drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
|
|
|
|
|
- // Cur Y
|
|
|
- x += BTN_WIDTH;
|
|
|
- motionAxisState.yValuePos.x = x + 2;
|
|
|
- motionAxisState.yValuePos.y = y;
|
|
|
- drawAxisValue(Y_AXIS);
|
|
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ uint16_t yplus_x = x;
|
|
|
+ drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
|
|
|
|
|
|
- x += spacing;
|
|
|
- drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ uint16_t zplus_x = x;
|
|
|
+ drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
|
|
|
- // ROW 2 -> "Ex" X- HOME X+ "Z"
|
|
|
- y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
|
- x = X_MARGIN;
|
|
|
- spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4;
|
|
|
+ // ROW 2 -> "Ex" CurY "Z"
|
|
|
+ x = X_MARGIN;
|
|
|
+ y += BTN_HEIGHT + 2;
|
|
|
|
|
|
- motionAxisState.eNamePos.x = x;
|
|
|
- motionAxisState.eNamePos.y = y;
|
|
|
- drawCurESelection();
|
|
|
- TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
|
|
+ motionAxisState.eNamePos.x = x;
|
|
|
+ motionAxisState.eNamePos.y = y;
|
|
|
+ drawCurESelection();
|
|
|
+ TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
|
|
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
|
|
+ motionAxisState.yValuePos.x = yplus_x;
|
|
|
+ motionAxisState.yValuePos.y = y;
|
|
|
+ drawAxisValue(Y_AXIS);
|
|
|
|
|
|
- x += BTN_WIDTH + spacing; //imgHome is 64x64
|
|
|
- TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
|
|
+ motionAxisState.zTypePos.x = zplus_x;
|
|
|
+ motionAxisState.zTypePos.y = y;
|
|
|
+ drawCurZSelection();
|
|
|
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- uint16_t xplus_x = x;
|
|
|
- drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
|
|
+ // ROW 3 -> X- HOME X+
|
|
|
+ y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
|
|
+ x = X_MARGIN;
|
|
|
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- motionAxisState.zTypePos.x = x;
|
|
|
- motionAxisState.zTypePos.y = y;
|
|
|
- drawCurZSelection();
|
|
|
- #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
|
|
- if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
|
|
- #endif
|
|
|
+ drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
|
|
|
|
|
- // ROW 3 -> E- CurX Y- Z-
|
|
|
- y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
|
- x = X_MARGIN;
|
|
|
- spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
|
+ TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
|
|
|
|
|
- drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
|
|
+ drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
|
|
|
|
|
- // Cur E
|
|
|
- motionAxisState.eValuePos.x = x;
|
|
|
- motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
- drawAxisValue(E_AXIS);
|
|
|
+ #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
|
|
+ if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
|
|
+ #endif
|
|
|
|
|
|
- // Cur X
|
|
|
- motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
|
|
- motionAxisState.xValuePos.y = y - 10;
|
|
|
- drawAxisValue(X_AXIS);
|
|
|
+ // ROW 4 -> Cur X
|
|
|
+ y += BTN_HEIGHT + 2;
|
|
|
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
|
|
+ motionAxisState.xValuePos.x = x;
|
|
|
+ motionAxisState.xValuePos.y = y;
|
|
|
+ drawAxisValue(X_AXIS);
|
|
|
|
|
|
- x += BTN_WIDTH + spacing;
|
|
|
- drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
+ // ROW 5 -> E- CurX Y- Z-
|
|
|
+ y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
|
|
+ x = X_MARGIN;
|
|
|
|
|
|
- // Cur Z
|
|
|
- motionAxisState.zValuePos.x = x;
|
|
|
- motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
- drawAxisValue(Z_AXIS);
|
|
|
+ drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
|
|
|
|
|
- // ROW 4 -> step_size disable steppers back
|
|
|
- y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
|
|
- x = xplus_x - CUR_STEP_VALUE_WIDTH - 10;
|
|
|
- motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH;
|
|
|
- motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
|
|
- if (!busy) {
|
|
|
- drawCurStepValue();
|
|
|
- TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
|
|
- }
|
|
|
+ // Cur E
|
|
|
+ motionAxisState.eValuePos.x = x;
|
|
|
+ motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
+ drawAxisValue(E_AXIS);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
+
|
|
|
+ // Cur Z
|
|
|
+ motionAxisState.zValuePos.x = x;
|
|
|
+ motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
+ drawAxisValue(Z_AXIS);
|
|
|
+
|
|
|
+ // ROW 6 -> step_size disable steppers back
|
|
|
+ y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
|
|
+ x = zplus_x - CUR_STEP_VALUE_WIDTH - 10;
|
|
|
+ motionAxisState.stepValuePos.x = X_MARGIN + BTN_WIDTH - CUR_STEP_VALUE_WIDTH;
|
|
|
+ motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
|
|
+
|
|
|
+ if (!busy) {
|
|
|
+ drawCurStepValue();
|
|
|
+ TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
|
|
+ }
|
|
|
+
|
|
|
+ // aligned with x+
|
|
|
+ drawBtn(yplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
|
|
+
|
|
|
+ #else // !TFT_COLOR_UI_PORTRAIT
|
|
|
+
|
|
|
+ // ROW 1 -> E+ Y+ CurY Z+
|
|
|
+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
|
|
+
|
|
|
+ drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ uint16_t yplus_x = x;
|
|
|
+ drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ // Cur Y
|
|
|
+ x += BTN_WIDTH;
|
|
|
+ motionAxisState.yValuePos.x = x + 2;
|
|
|
+ motionAxisState.yValuePos.y = y;
|
|
|
+ drawAxisValue(Y_AXIS);
|
|
|
+
|
|
|
+ x += spacing;
|
|
|
+ drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
+
|
|
|
+ // ROW 2 -> "Ex" X- HOME X+ "Z"
|
|
|
+ y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
|
+ x = X_MARGIN;
|
|
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4;
|
|
|
+
|
|
|
+ motionAxisState.eNamePos.x = x;
|
|
|
+ motionAxisState.eNamePos.y = y;
|
|
|
+ drawCurESelection();
|
|
|
+ TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing; //imgHome is 64x64
|
|
|
+ TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ uint16_t xplus_x = x;
|
|
|
+ drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ motionAxisState.zTypePos.x = x;
|
|
|
+ motionAxisState.zTypePos.y = y;
|
|
|
+ drawCurZSelection();
|
|
|
+ #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
|
|
+ if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
|
|
+ #endif
|
|
|
+
|
|
|
+ // ROW 3 -> E- CurX Y- Z-
|
|
|
+ y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
|
+ x = X_MARGIN;
|
|
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
|
+
|
|
|
+ drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ // Cur E
|
|
|
+ motionAxisState.eValuePos.x = x;
|
|
|
+ motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
+ drawAxisValue(E_AXIS);
|
|
|
+
|
|
|
+ // Cur X
|
|
|
+ motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
|
|
+ motionAxisState.xValuePos.y = y - 10;
|
|
|
+ drawAxisValue(X_AXIS);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
|
|
+
|
|
|
+ x += BTN_WIDTH + spacing;
|
|
|
+ drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
|
+
|
|
|
+ // Cur Z
|
|
|
+ motionAxisState.zValuePos.x = x;
|
|
|
+ motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
|
|
+ drawAxisValue(Z_AXIS);
|
|
|
+
|
|
|
+ // ROW 4 -> step_size disable steppers back
|
|
|
+ y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
|
|
+ x = xplus_x - CUR_STEP_VALUE_WIDTH - 10;
|
|
|
+ motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH;
|
|
|
+ motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
|
|
+ if (!busy) {
|
|
|
+ drawCurStepValue();
|
|
|
+ TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
|
|
+ }
|
|
|
+
|
|
|
+ // aligned with x+
|
|
|
+ drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
|
|
|
|
|
- // aligned with x+
|
|
|
- drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
|
|
+ #endif // !TFT_COLOR_UI_PORTRAIT
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
|
|
}
|