From 9482a9dde20487126bebb927c80712000f719e76 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Wed, 7 May 2025 18:44:23 -0400 Subject: [PATCH] Fix touch screen menu buttons on non touch screen --- esp32_marauder/MenuFunctions.cpp | 56 +++++++++++++++++--------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index bac4ad7..28d2264 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -654,37 +654,39 @@ void MenuFunctions::buttonSelected(int b, int x) { } void MenuFunctions::displayMenuButtons() { - // Draw lines to show each menu button - for (int i = 0; i < 3; i++) { + #ifdef HAS_ILI9341 + // Draw lines to show each menu button + for (int i = 0; i < 3; i++) { - // Draw horizontal line on left - display_obj.tft.drawLine(0, - TFT_HEIGHT / 3 * (i), - (TFT_WIDTH / 12) / 2, - TFT_HEIGHT / 3 * (i), - TFT_FARTGRAY); + // Draw horizontal line on left + display_obj.tft.drawLine(0, + TFT_HEIGHT / 3 * (i), + (TFT_WIDTH / 12) / 2, + TFT_HEIGHT / 3 * (i), + TFT_FARTGRAY); - // Draw horizontal line on right - display_obj.tft.drawLine(TFT_WIDTH - 1 - ((TFT_WIDTH / 12) / 2), - TFT_HEIGHT / 3 * (i), - TFT_WIDTH, - TFT_HEIGHT / 3 * (i), - TFT_FARTGRAY); + // Draw horizontal line on right + display_obj.tft.drawLine(TFT_WIDTH - 1 - ((TFT_WIDTH / 12) / 2), + TFT_HEIGHT / 3 * (i), + TFT_WIDTH, + TFT_HEIGHT / 3 * (i), + TFT_FARTGRAY); - // Draw vertical line on left - display_obj.tft.drawLine(0, - (TFT_HEIGHT / 3 * (i)) - ((TFT_WIDTH / 12) / 2), - 0, - (TFT_HEIGHT / 3 * (i)) + ((TFT_WIDTH / 12) / 2), - TFT_FARTGRAY); + // Draw vertical line on left + display_obj.tft.drawLine(0, + (TFT_HEIGHT / 3 * (i)) - ((TFT_WIDTH / 12) / 2), + 0, + (TFT_HEIGHT / 3 * (i)) + ((TFT_WIDTH / 12) / 2), + TFT_FARTGRAY); - // Draw vertical line on right - display_obj.tft.drawLine(TFT_WIDTH - 1, - (TFT_HEIGHT / 3 * (i)) - ((TFT_WIDTH / 12) / 2), - TFT_WIDTH - 1, - (TFT_HEIGHT / 3 * (i)) + ((TFT_WIDTH / 12) / 2), - TFT_FARTGRAY); - } + // Draw vertical line on right + display_obj.tft.drawLine(TFT_WIDTH - 1, + (TFT_HEIGHT / 3 * (i)) - ((TFT_WIDTH / 12) / 2), + TFT_WIDTH - 1, + (TFT_HEIGHT / 3 * (i)) + ((TFT_WIDTH / 12) / 2), + TFT_FARTGRAY); + } + #endif } // Function to check menu input