Skip to content

Commit

Permalink
Fix Move Screen with disabled Touch (#19558)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and thinkyhead committed Oct 16, 2020
1 parent 1ba2548 commit ca853fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ static void do_home() {
drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
queue.inject_P(G28_STR);
// Disable touch until home is done
touch.disable();
TERN_(HAS_TFT_XPT2046, touch.disable());
drawAxisValue(E_AXIS);
drawAxisValue(X_AXIS);
drawAxisValue(Y_AXIS);
Expand Down Expand Up @@ -972,14 +972,14 @@ static void drawBtn(int x, int y, const char* label, int32_t data, MarlinImage i
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
}

if (enabled) touch.add_control(BUTTON, x, y, width, height, data);
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);
motionAxisState.blocked = false;
touch.enable();
TERN_(HAS_TFT_XPT2046, touch.enable());

ui.clear_lcd();

Expand Down Expand Up @@ -1016,13 +1016,13 @@ void MarlinUI::move_axis_screen() {
motionAxisState.eNamePos.x = x;
motionAxisState.eNamePos.y = y;
drawCurESelection();
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (int32_t)e_select);
TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (int32_t)e_select));

x += BTN_WIDTH + spacing;
drawBtn(x, y, "X-", (int32_t)x_minus, imgLeft, X_BTN_COLOR, !busy);

x += BTN_WIDTH + spacing; //imgHome is 64x64
add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (int32_t)do_home, imgHome, !busy);
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (int32_t)do_home, imgHome, !busy));

x += BTN_WIDTH + spacing;
uint16_t xplus_x = x;
Expand Down Expand Up @@ -1071,13 +1071,13 @@ void MarlinUI::move_axis_screen() {
motionAxisState.stepValuePos.y = y;
if (!busy) {
drawCurStepValue();
touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (int32_t)step_size);
TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (int32_t)step_size));
}

// alinged with x+
drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (int32_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);

add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack);
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
}

#undef BTN_WIDTH
Expand Down

0 comments on commit ca853fb

Please sign in to comment.