From 1383d806261f90f4f57213f688109370fdba601c Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Tue, 7 Jan 2025 13:30:28 +0100 Subject: [PATCH] Update touch events --- src/touch.cpp | 29 ++++++++++++++++++++++++++--- src/touch.h | 4 ++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/touch.cpp b/src/touch.cpp index eff8371..c8281ec 100644 --- a/src/touch.cpp +++ b/src/touch.cpp @@ -154,9 +154,16 @@ void doTouchEvent(uint16_t x, uint16_t y) { bwtouchtune = true; BWset = BWtemp; doBW(); - BuildDisplay(); - SelectBand(); + BWtune = false; bwtouchtune = false; + if (advancedRDS) { + BuildAdvancedRDS(); + } else if (afscreen) { + BuildAFScreen(); + } else { + BuildDisplay(); + SelectBand(); + } } else { bwtouchtune = true; BWset = BWtemp; @@ -184,12 +191,28 @@ void doTouchEvent(uint16_t x, uint16_t y) { } if (!BWtune && !menu && advancedRDS && !seek && !afscreen) { // Advanced RDS mode - if (x > 0 && x < 320 && y > 180 && y < 240) { // ----------------- + if (x > 0 && x < 320 && y > 120 && y < 170) { // ----------------- leave = true; BuildDisplay(); SelectBand(); ScreensaverTimerReopen(); // Switch to normal radio view return; + } else if (x > 0 && x < 320 && y > 180 && y < 240) { + BuildAFScreen(); + return; + } + } + + if (!BWtune && !menu && !advancedRDS && !seek && afscreen) { + if (x > 0 && x < 320 && y > 100 && y < 170) { + if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2 && afpage) afpagenr = 3; else afpagenr = 1; + BuildAFScreen(); + return; + } + if (x > 0 && x < 320 && y > 180 && y < 240) { + leave = true; + BuildAdvancedRDS(); + return; } } } diff --git a/src/touch.h b/src/touch.h index 1c3024f..ca82208 100644 --- a/src/touch.h +++ b/src/touch.h @@ -9,6 +9,7 @@ extern TFT_eSPI tft; extern TEF6686 radio; extern bool advancedRDS; +extern bool afpage; extern bool afscreen; extern bool bwtouchtune; extern bool BWtune; @@ -19,6 +20,7 @@ extern bool scandxmode; extern bool seek; extern bool XDRGTKTCP; extern bool XDRGTKUSB; +extern byte afpagenr; extern byte band; extern byte BWset; extern byte BWtemp; @@ -53,4 +55,6 @@ extern void showBWSelector(); extern void updateiMS(); extern void updateEQ(); extern void DataPrint(String string); +extern void BuildAFScreen(); + #endif \ No newline at end of file