1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

🚸 Fix TFT menu positioning (#25942)

Co-authored-by: Ed <751406+helakejr@users.noreply.github.com>
This commit is contained in:
Scott Lahteine 2023-06-07 20:58:55 -05:00 committed by GitHub
parent d1e995670d
commit 54a82b4337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,6 +623,7 @@ struct {
#define BTN_HEIGHT 52 #define BTN_HEIGHT 52
#define X_MARGIN 20 #define X_MARGIN 20
#define Y_MARGIN 15 #define Y_MARGIN 15
#define Y_OFFSET TERN(HAS_UI_480x272, 28, 34)
static void quick_feedback() { static void quick_feedback() {
#if HAS_CHIRP #if HAS_CHIRP
@ -652,7 +653,7 @@ static void drawCurStepValue() {
tft.add_text(0, 0, Z_BTN_COLOR, tft_string); tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
tft.queue.sync(); tft.queue.sync();
tft_string.set(F("Offset")); tft_string.set(F("Offset"));
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + Y_OFFSET, tft_string.width(), Y_OFFSET TERN_(HAS_UI_480x272, - 10));
tft.set_background(COLOR_BACKGROUND); tft.set_background(COLOR_BACKGROUND);
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE)
tft.add_text(0, 0, Z_BTN_COLOR, tft_string); tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
@ -670,7 +671,7 @@ static void drawCurStepValue() {
#endif #endif
static void drawMessage(PGM_P const msg) { static void drawMessage(PGM_P const msg) {
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - Y_OFFSET, TFT_HEIGHT / 2, Y_OFFSET);
tft.set_background(COLOR_BACKGROUND); tft.set_background(COLOR_BACKGROUND);
tft.add_text(0, 0, COLOR_YELLOW, msg); tft.add_text(0, 0, COLOR_YELLOW, msg);
} }
@ -699,7 +700,7 @@ static void drawAxisValue(const AxisEnum axis) {
#endif #endif
default: return; default: return;
} }
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT); tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT TERN_(HAS_UI_480x272, / 2));
tft.set_background(COLOR_BACKGROUND); tft.set_background(COLOR_BACKGROUND);
tft_string.set(ftostr52sp(value)); tft_string.set(ftostr52sp(value));
tft.add_text(0, 0, color, tft_string); tft.add_text(0, 0, color, tft_string);
@ -891,7 +892,7 @@ void MarlinUI::move_axis_screen() {
TERN_(HAS_Z_AXIS, motionAxisState.z_selection = Z_SELECTION_Z_PROBE); TERN_(HAS_Z_AXIS, motionAxisState.z_selection = Z_SELECTION_Z_PROBE);
// ROW 1 -> E- Y- CurY Z+ // ROW 1 -> E+ Y+ CurY Z+
int x = X_MARGIN, y = Y_MARGIN, spacing = 0; int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy));
@ -941,7 +942,7 @@ void MarlinUI::move_axis_screen() {
motionAxisState.zTypePos.y = y; motionAxisState.zTypePos.y = y;
TERN_(HAS_Z_AXIS, drawCurZSelection()); TERN_(HAS_Z_AXIS, drawCurZSelection());
#if ALL(HAS_BED_PROBE, TOUCH_SCREEN) #if ALL(HAS_BED_PROBE, TOUCH_SCREEN)
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, Y_OFFSET * 2, (intptr_t)z_select);
#endif #endif
// ROW 3 -> E- CurX Y- Z- // ROW 3 -> E- CurX Y- Z-
@ -975,7 +976,7 @@ void MarlinUI::move_axis_screen() {
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
// ROW 4 -> step_size disable steppers back // ROW 4 -> step_size disable steppers back
y = TFT_HEIGHT - Y_MARGIN - 32; y = TFT_HEIGHT - Y_MARGIN - TERN(HAS_UI_480x272, BTN_WIDTH / 2, 32);
x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2; x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2;
motionAxisState.stepValuePos.x = x; motionAxisState.stepValuePos.x = x;
motionAxisState.stepValuePos.y = y; motionAxisState.stepValuePos.y = y;
@ -990,4 +991,4 @@ void MarlinUI::move_axis_screen() {
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
} }
#endif // HAS_UI_480x320 #endif // HAS_UI_480x320 || HAS_UI_480x272