Fix getTouch() return status upon bounds overflow

- When the post-remapped coordinates exceed screen bounds, `getTouch()` was returning a "valid" status without updating the coordinates. This would result in spurious touch detection events at the screen boundaries.
- The fix ensures that the return value is set to "invalid" in this boundary condition.
This commit is contained in:
Calvin Hass 2019-05-21 07:13:19 -07:00 committed by GitHub
parent da2239f4c1
commit a627c51118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){
convertRawXY(&x_tmp, &y_tmp); convertRawXY(&x_tmp, &y_tmp);
if (x_tmp >= _width || y_tmp >= _height) return valid; if (x_tmp >= _width || y_tmp >= _height) return false;
_pressX = x_tmp; _pressX = x_tmp;
_pressY = y_tmp; _pressY = y_tmp;