Fix touch test
This commit is contained in:
parent
1801eb6393
commit
77ab354a5a
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue