Fix touch test

This commit is contained in:
Scott Lahteine 2020-08-13 21:17:48 -05:00
parent 506deedfdd
commit 16cb4303a4

View file

@ -138,7 +138,9 @@ uint8_t XPT2046::read_buttons() {
: WITHIN(x, 242, 305) ? EN_C : WITHIN(x, 242, 305) ? EN_C
: 0; : 0;
if (x > TOUCH_SENSOR_WIDTH || !WITHIN(y, SCREEN_START_TOP, SCREEN_START_TOP + SCREEN_HEIGHT)) return 0; if ( !WITHIN(x, SCREEN_START_LEFT, SCREEN_START_LEFT + SCREEN_WIDTH)
|| !WITHIN(y, SCREEN_START_TOP, SCREEN_START_TOP + SCREEN_HEIGHT)
) return 0;
// Column and row above BUTTON_AREA_TOP // Column and row above BUTTON_AREA_TOP
int8_t col = (x - (SCREEN_START_LEFT)) * (LCD_WIDTH) / (TOUCHABLE_X_WIDTH), int8_t col = (x - (SCREEN_START_LEFT)) * (LCD_WIDTH) / (TOUCHABLE_X_WIDTH),
@ -161,6 +163,7 @@ bool XPT2046::isTouched() {
} }
#if ENABLED(TOUCH_BUTTONS_HW_SPI) #if ENABLED(TOUCH_BUTTONS_HW_SPI)
#include <SPI.h> #include <SPI.h>
static void touch_spi_init(uint8_t spiRate) { static void touch_spi_init(uint8_t spiRate) {