Touch screen now has menu buttons

This commit is contained in:
Just Call Me Koko
2025-05-06 23:47:23 -04:00
parent 526b01e343
commit c2fdb56200
5 changed files with 192 additions and 37 deletions

View File

@@ -11,6 +11,27 @@ Display::Display()
{
}
int8_t Display::menuButton(uint16_t *x, uint16_t *y, bool pressed) {
#ifdef HAS_ILI9341
for (uint8_t b = BUTTON_ARRAY_LEN; b < BUTTON_ARRAY_LEN + 3; b++) {
if (pressed && this->key[b].contains(*x, *y)) {
this->key[b].press(true); // tell the button it is pressed
} else {
this->key[b].press(false); // tell the button it is NOT pressed
}
}
for (uint8_t b = BUTTON_ARRAY_LEN; b < BUTTON_ARRAY_LEN + 3; b++) {
if ((this->key[b].justReleased()) && (!pressed)) {
return b - BUTTON_ARRAY_LEN;
}
}
#endif
return -1;
}
uint8_t Display::updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold) {
#ifdef HAS_ILI9341
if (!this->headless_mode)