Skip to content

Commit

Permalink
Fixed a bug in touch pen range check
Browse files Browse the repository at this point in the history
  • Loading branch information
nopnop2002 committed Jan 10, 2025
1 parent 079343f commit 36e7c2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,14 +1598,14 @@ esp_err_t ConvertCoordinate(TFT_t * dev, int xp, int yp, int *xpos, int *ypos) {

// Determine if within range
if (dev->_max_xp > dev->_min_xp) {
if (xp < dev->_min_xp && xp > dev->_max_xp) return ESP_FAIL;
if (xp < dev->_min_xp || xp > dev->_max_xp) return ESP_FAIL;
} else {
if (xp < dev->_max_xp && xp > dev->_min_xp) return ESP_FAIL;
if (xp < dev->_max_xp || xp > dev->_min_xp) return ESP_FAIL;
}
if (dev->_max_yp > dev->_min_yp) {
if (yp < dev->_min_yp && yp > dev->_max_yp) return ESP_FAIL;
if (yp < dev->_min_yp || yp > dev->_max_yp) return ESP_FAIL;
} else {
if (yp < dev->_max_yp && yp > dev->_min_yp) return ESP_FAIL;
if (yp < dev->_max_yp || yp > dev->_min_yp) return ESP_FAIL;
}

// Convert from position to coordinate
Expand Down

0 comments on commit 36e7c2f

Please sign in to comment.