Sfoglia il codice sorgente

Fix Move Screen with disabled Touch (#19558)

Victor Oliveira 3 anni fa
parent
commit
ca853fbe19
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 7
    7
      Marlin/src/lcd/tft/ui_480x320.cpp

+ 7
- 7
Marlin/src/lcd/tft/ui_480x320.cpp Vedi File

924
   drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
924
   drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
925
   queue.inject_P(G28_STR);
925
   queue.inject_P(G28_STR);
926
   // Disable touch until home is done
926
   // Disable touch until home is done
927
-  touch.disable();
927
+  TERN_(HAS_TFT_XPT2046, touch.disable());
928
   drawAxisValue(E_AXIS);
928
   drawAxisValue(E_AXIS);
929
   drawAxisValue(X_AXIS);
929
   drawAxisValue(X_AXIS);
930
   drawAxisValue(Y_AXIS);
930
   drawAxisValue(Y_AXIS);
972
     tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
972
     tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
973
   }
973
   }
974
 
974
 
975
-  if (enabled) touch.add_control(BUTTON, x, y, width, height, data);
975
+  TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
976
 }
976
 }
977
 
977
 
978
 void MarlinUI::move_axis_screen() {
978
 void MarlinUI::move_axis_screen() {
979
   // Reset
979
   // Reset
980
   defer_status_screen(true);
980
   defer_status_screen(true);
981
   motionAxisState.blocked = false;
981
   motionAxisState.blocked = false;
982
-  touch.enable();
982
+  TERN_(HAS_TFT_XPT2046, touch.enable());
983
 
983
 
984
   ui.clear_lcd();
984
   ui.clear_lcd();
985
 
985
 
1016
   motionAxisState.eNamePos.x = x;
1016
   motionAxisState.eNamePos.x = x;
1017
   motionAxisState.eNamePos.y = y;
1017
   motionAxisState.eNamePos.y = y;
1018
   drawCurESelection();
1018
   drawCurESelection();
1019
-  if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (int32_t)e_select);
1019
+  TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (int32_t)e_select));
1020
 
1020
 
1021
   x += BTN_WIDTH + spacing;
1021
   x += BTN_WIDTH + spacing;
1022
   drawBtn(x, y, "X-", (int32_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
1022
   drawBtn(x, y, "X-", (int32_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
1023
 
1023
 
1024
   x += BTN_WIDTH + spacing; //imgHome is 64x64
1024
   x += BTN_WIDTH + spacing; //imgHome is 64x64
1025
-  add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (int32_t)do_home, imgHome, !busy);
1025
+  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));
1026
 
1026
 
1027
   x += BTN_WIDTH + spacing;
1027
   x += BTN_WIDTH + spacing;
1028
   uint16_t xplus_x = x;
1028
   uint16_t xplus_x = x;
1071
   motionAxisState.stepValuePos.y = y;
1071
   motionAxisState.stepValuePos.y = y;
1072
   if (!busy) {
1072
   if (!busy) {
1073
     drawCurStepValue();
1073
     drawCurStepValue();
1074
-    touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (int32_t)step_size);
1074
+    TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (int32_t)step_size));
1075
   }
1075
   }
1076
 
1076
 
1077
   // alinged with x+
1077
   // alinged with x+
1078
   drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (int32_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
1078
   drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (int32_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
1079
 
1079
 
1080
-  add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack);
1080
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
1081
 }
1081
 }
1082
 
1082
 
1083
 #undef BTN_WIDTH
1083
 #undef BTN_WIDTH

Loading…
Annulla
Salva