|
@@ -68,26 +68,31 @@ uint8_t TouchButtons::read_buttons() {
|
68
|
68
|
#ifdef HAS_WIRED_LCD
|
69
|
69
|
int16_t x, y;
|
70
|
70
|
|
71
|
|
- const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y));
|
72
|
|
- #if HAS_TOUCH_SLEEP
|
73
|
|
- if (is_touched)
|
74
|
|
- wakeUp();
|
75
|
|
- else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen())
|
76
|
|
- sleepTimeout();
|
77
|
|
- #endif
|
78
|
|
- if (!is_touched) return 0;
|
79
|
|
-
|
80
|
|
- #if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
81
|
|
- const calibrationState state = touch_calibration.get_calibration_state();
|
82
|
|
- if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) {
|
83
|
|
- if (touch_calibration.handleTouch(x, y)) ui.refresh();
|
84
|
|
- return 0;
|
85
|
|
- }
|
86
|
|
- x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x;
|
87
|
|
- y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y;
|
88
|
|
- #else
|
89
|
|
- x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X;
|
90
|
|
- y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y;
|
|
71
|
+ #if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
|
|
72
|
+ const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y));
|
|
73
|
+ #if HAS_TOUCH_SLEEP
|
|
74
|
+ if (is_touched)
|
|
75
|
+ wakeUp();
|
|
76
|
+ else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen())
|
|
77
|
+ sleepTimeout();
|
|
78
|
+ #endif
|
|
79
|
+ if (!is_touched) return 0;
|
|
80
|
+
|
|
81
|
+ #if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
|
82
|
+ const calibrationState state = touch_calibration.get_calibration_state();
|
|
83
|
+ if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) {
|
|
84
|
+ if (touch_calibration.handleTouch(x, y)) ui.refresh();
|
|
85
|
+ return 0;
|
|
86
|
+ }
|
|
87
|
+ x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x;
|
|
88
|
+ y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y;
|
|
89
|
+ #else
|
|
90
|
+ x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X;
|
|
91
|
+ y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y;
|
|
92
|
+ #endif
|
|
93
|
+ #elif ENABLED(TFT_TOUCH_DEVICE_GT911)
|
|
94
|
+ bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? touchIO.getPoint(&y, &x) : touchIO.getPoint(&x, &y));
|
|
95
|
+ if (!is_touched) return 0;
|
91
|
96
|
#endif
|
92
|
97
|
|
93
|
98
|
// Touch within the button area simulates an encoder button
|