Add Touch Calibration screen (#20049)

This commit is contained in:
Victor Oliveira
2020-11-15 19:39:58 -03:00
committed by GitHub
parent cab83ba840
commit ea371618da
45 changed files with 845 additions and 904 deletions

View File

@@ -1073,8 +1073,24 @@
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
#undef TOUCH_SCREEN
#undef TOUCH_SCREEN_CALIBRATION
#if !HAS_TFT_LVGL_UI
#define HAS_TOUCH_XPT2046 1
#define HAS_TOUCH_BUTTONS 1
#endif
#endif
// XPT2046_** Compatibility
#if !(defined(TOUCH_CALIBRATION_X) || defined(TOUCH_CALIBRATION_Y) || defined(TOUCH_OFFSET_X) || defined(TOUCH_OFFSET_Y) || defined(TOUCH_ORIENTATION))
#if defined(XPT2046_X_CALIBRATION) && defined(XPT2046_Y_CALIBRATION) && defined(XPT2046_X_OFFSET) && defined(XPT2046_Y_OFFSET)
#define TOUCH_CALIBRATION_X XPT2046_X_CALIBRATION
#define TOUCH_CALIBRATION_Y XPT2046_Y_CALIBRATION
#define TOUCH_OFFSET_X XPT2046_X_OFFSET
#define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#else
#define TOUCH_CALIBRATION_X 0
#define TOUCH_CALIBRATION_Y 0
#define TOUCH_OFFSET_X 0
#define TOUCH_OFFSET_Y 0
#define TOUCH_ORIENTATION TOUCH_ORIENTATION_NONE
#endif
#endif

View File

@@ -364,7 +364,7 @@
// Touch Screen or "Touch Buttons" need XPT2046 pins
// but they use different components
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_XPT2046)
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_BUTTONS)
#define NEED_TOUCH_PINS 1
#endif

View File

@@ -3172,17 +3172,17 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
* Touch Buttons
*/
#if ENABLED(TOUCH_SCREEN)
#ifndef XPT2046_X_CALIBRATION
#error "XPT2046_X_CALIBRATION must be defined with TOUCH_SCREEN."
#ifndef TOUCH_CALIBRATION_X
#error "TOUCH_CALIBRATION_X must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_Y_CALIBRATION
#error "XPT2046_Y_CALIBRATION must be defined with TOUCH_SCREEN."
#ifndef TOUCH_CALIBRATION_Y
#error "TOUCH_CALIBRATION_Y must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_X_OFFSET
#error "XPT2046_X_OFFSET must be defined with TOUCH_SCREEN."
#ifndef TOUCH_OFFSET_X
#error "TOUCH_OFFSET_X must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_Y_OFFSET
#error "XPT2046_Y_OFFSET must be defined with TOUCH_SCREEN."
#ifndef TOUCH_OFFSET_Y
#error "TOUCH_OFFSET_Y must be defined with TOUCH_SCREEN."
#endif
#endif