From b8b1c8ae9d31776a0505091047c9ac7b8fc80609 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Sun, 15 Oct 2023 00:43:43 +0200 Subject: [PATCH] Added clock to default screen --- TEF6686_ESP32.ino | 3 +++ src/gui.cpp | 17 +++++++++-------- src/rds.cpp | 15 +++++++++++++++ src/rds.h | 1 + 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 87ce5d3..7ec5612 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -948,6 +948,7 @@ void GetData() { showPTY(); showECC(); showRadioText(); + if (!advancedRDS) showCT(); if (millis() >= tuningtimer + 200) doAF(); } showPI(); @@ -2134,6 +2135,7 @@ void KeyUp() { if (XDRGTKUSB || XDRGTKTCP) { if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10)); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10)); else DataPrint("M1\nT" + String(frequency_AM)); } + if (radio.rds.hasCT) tftPrint(1, rds_clock, 205, 163, BackgroundColor, BackgroundColor, 16); radio.clearRDS(fullsearchrds); change = 0; ShowFreq(0); @@ -2180,6 +2182,7 @@ void KeyDown() { if (XDRGTKUSB || XDRGTKTCP) { if (band == BAND_FM) DataPrint("M0\nT" + String(frequency * 10)); else if (band == BAND_OIRT) DataPrint("M0\nT" + String(frequency_OIRT * 10)); else DataPrint("M1\nT" + String(frequency_AM)); } + if (radio.rds.hasCT) tftPrint(1, rds_clock, 38, 109, BackgroundColor, BackgroundColor, 16); radio.clearRDS(fullsearchrds); change = 0; ShowFreq(0); diff --git a/src/gui.cpp b/src/gui.cpp index c621a74..68c6c9d 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -350,7 +350,7 @@ void BuildAFScreen() { af_counterold = 254; strcpy(radioIdPrevious, ""); programServicePrevious = ""; - afmethodBold = false; + afmethodBold = false; for (byte i = 0; i < 11; i++) eonpsold[i] = ""; } } @@ -644,11 +644,10 @@ void BuildAdvancedRDS() { tft.drawCircle(71, 15, 9, SecondaryColor); } - if (radio.rds.hasCT) tftPrint(1, rds_clockold, 205, 109, SecondaryColor, SecondaryColorSmooth, 16); tftPrint(-1, "TP", 2, 51, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "TA", 21, 51, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "AF", 42, 51, GreyoutColor, BackgroundColor, 16); - tftPrint(-1, "-B", 60, 51, GreyoutColor, BackgroundColor, 16); + tftPrint(-1, "-B", 60, 51, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "CT", 78, 51, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "TMC", 95, 51, GreyoutColor, BackgroundColor, 16); tftPrint(-1, "RT+", 130, 51, GreyoutColor, BackgroundColor, 16); @@ -695,6 +694,7 @@ void BuildAdvancedRDS() { afstringold = ""; rtplusstringold = ""; afmethodBold = false; + rds_clockold = ""; ShowMemoryPos(); } @@ -813,6 +813,7 @@ void BuildDisplay() { batteryold = 6; batteryVold = 0; vPerold = 0; + rds_clockold = ""; strcpy(programTypePrevious, ""); strcpy(radioIdPrevious, ""); programServicePrevious = ""; @@ -1935,11 +1936,11 @@ void DoMenu() { tftPrint(1, "NoobishSVK", 145, 143, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(-1, "yo2ldk", 155, 128, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(-1, "Justin_Peng(Portable)", 155, 143, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "mx4zxc", 145, 158, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "elektronik232", 155, 158, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "KOTYA8", 145, 173, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, "mrwish7", 155, 173, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(1, "lxsxl", 145, 188, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "mx4zxc", 145, 158, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(-1, "elektronik232", 155, 158, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "KOTYA8", 145, 173, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(-1, "mrwish7", 155, 173, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, "lxsxl", 145, 188, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(0, "github.com/PE5PVB/TEF6686_ESP32", 155, 208, ActiveColor, ActiveColorSmooth, 16); break; } diff --git a/src/rds.cpp b/src/rds.cpp index 5b35408..eecf6a8 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -725,6 +725,21 @@ void showPS() { } } +void showCT() { + if (!screenmute && !afscreen && !advancedRDS) { + rds_clock = ((radio.rds.hour < 10 ? "0" : "") + String(radio.rds.hour) + ":" + (radio.rds.minute < 10 ? "0" : "") + String(radio.rds.minute)); + if (rds_clock != rds_clockold) { + if (radio.rds.hasCT) { + tftReplace(1, rds_clockold, rds_clock, 205, 163, PrimaryColor, PrimaryColorSmooth, 16); + Serial.println(rds_clock); + } else { + tftPrint(1, rds_clock, 205, 163, BackgroundColor, BackgroundColor, 16); + } + } + rds_clockold = rds_clock; + } +} + void showRadioText() { if (radio.rds.hasRT && radio.rds.stationText.length() > 0) { if (advancedRDS && radio.rds.stationText.length() < 20) { diff --git a/src/rds.h b/src/rds.h index a7083e1..2574d01 100644 --- a/src/rds.h +++ b/src/rds.h @@ -120,6 +120,7 @@ void showPTY(); void showPS(); void showRadioText(); void ShowAFEON(); +void showCT(); extern void ShowRDSLogo(bool RDSstatus); extern void DataPrint(String string);