Fix touch test

This commit is contained in:
Scott Lahteine 2020-08-13 21:17:48 -05:00
parent 1801eb6393
commit 77ab354a5a

View File

@ -138,7 +138,9 @@ uint8_t XPT2046::read_buttons() {
: WITHIN(x, 242, 305) ? EN_C
: 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
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)
#include <SPI.h>
static void touch_spi_init(uint8_t spiRate) {