From ca853fbe19eff2f73e5f953b25e1b567bb363c96 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Wed, 30 Sep 2020 22:06:32 -0300 Subject: [PATCH] Fix Move Screen with disabled Touch (#19558) --- Marlin/src/lcd/tft/ui_480x320.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index ffc619e8d..549cbc4d9 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -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); @@ -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(); @@ -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; @@ -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