From c2d89bab245419871dbb8b7d6bc2646f033876b7 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Tue, 21 Nov 2023 14:42:13 +0100 Subject: [PATCH] Fix on color when RDS is lost. --- src/gui.cpp | 6 ++++-- src/gui.h | 1 + src/rds.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 0d8357d..3e7876b 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -597,7 +597,6 @@ void BuildMenu() { } void BuildAdvancedRDS() { - rdsreset = true; afscreen = false; afpage = false; afpagenr = 1; @@ -721,6 +720,8 @@ void BuildAdvancedRDS() { hasrtplusold = false; afmethodBold = false; rds_clockold = ""; + dropout = false; + rdsreset = true; ShowMemoryPos(); } @@ -849,6 +850,7 @@ void BuildDisplay() { stationIDold = " "; stationStateold = " "; BWreset = true; + dropout = false; if (band < BAND_GAP) tftPrint(-1, "MHz", 258, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 28); else tftPrint(-1, "kHz", 258, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 28); } @@ -2514,4 +2516,4 @@ void Infoboxprint(const char* input) { } else { tftPrint(0, input, 155, 78, ActiveColor, ActiveColorSmooth, 28); } -} +} \ No newline at end of file diff --git a/src/gui.h b/src/gui.h index 356fb3a..f6d2b76 100644 --- a/src/gui.h +++ b/src/gui.h @@ -35,6 +35,7 @@ extern bool artheadold; extern bool BWreset; extern bool change; extern bool compressedold; +extern bool dropout; extern bool dynamicPTYold; extern bool dynamicspi; extern bool edgebeep; diff --git a/src/rds.cpp b/src/rds.cpp index efc2662..afafbbb 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -404,19 +404,41 @@ void showPI() { } if (!screenmute) { if (advancedRDS) { - if (region == REGION_EU) tftReplace(0, PIold, radio.rds.picode, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); + if (region == REGION_EU) { + if (!RDSstatus) { + tftReplace(0, PIold, radio.rds.picode, 275, 75, SecondaryColor, SecondaryColorSmooth, 28); + } else { + tftReplace(0, PIold, radio.rds.picode, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); + } + } if (region == REGION_US) { - if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, PrimaryColor, PrimaryColorSmooth, 16); - tftReplace(-1, stationIDold, radio.rds.stationID, 240, 89, PrimaryColor, PrimaryColorSmooth, 16); + if (!RDSstatus) { + if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, SecondaryColor, SecondaryColorSmooth, 16); + tftReplace(-1, stationIDold, radio.rds.stationID, 240, 89, SecondaryColor, SecondaryColorSmooth, 16); + } else { + if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 72, PrimaryColor, PrimaryColorSmooth, 16); + tftReplace(-1, stationIDold, radio.rds.stationID, 240, 89, PrimaryColor, PrimaryColorSmooth, 16); + } tftReplace(1, stationStateold, radio.rds.stationState, 318, 89, SecondaryColor, SecondaryColorSmooth, 16); } } else if (afscreen) { tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, 16); } else { - if (region == REGION_EU) tftReplace(0, PIold, radio.rds.picode, 275, 187, PrimaryColor, PrimaryColorSmooth, 28); + if (region == REGION_EU) { + if (!RDSstatus) { + tftReplace(0, PIold, radio.rds.picode, 275, 187, SecondaryColor, SecondaryColorSmooth, 28); + } else { + tftReplace(0, PIold, radio.rds.picode, 275, 187, PrimaryColor, PrimaryColorSmooth, 28); + } + } if (region == REGION_US) { - if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 184, PrimaryColor, PrimaryColorSmooth, 16); - tftReplace(-1, stationIDold, radio.rds.stationID, 240, 201, PrimaryColor, PrimaryColorSmooth, 16); + if (RDSstatus) { + if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 184, SecondaryColor, SecondaryColorSmooth, 16); + tftReplace(-1, stationIDold, radio.rds.stationID, 240, 201, SecondaryColor, SecondaryColorSmooth, 16); + } else { + if (String(radio.rds.picode) != PIold) tftReplace(-1, PIold, radio.rds.picode, 240, 184, PrimaryColor, PrimaryColorSmooth, 16); + tftReplace(-1, stationIDold, radio.rds.stationID, 240, 201, PrimaryColor, PrimaryColorSmooth, 16); + } tftReplace(1, stationStateold, radio.rds.stationState, 318, 201, SecondaryColor, SecondaryColorSmooth, 16); } } @@ -435,7 +457,19 @@ void showPI() { void showPTY() { if (strcmp(radio.rds.stationType, programTypePrevious)) { if (!screenmute) { - if (advancedRDS) tftReplace(-1, PTYold, radio.rds.stationType, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftReplace(-1, PTYold, radio.rds.stationType, 38, 163, PrimaryColor, PrimaryColorSmooth, 16); + if (advancedRDS) { + if (!RDSstatus) { + tftReplace(-1, PTYold, radio.rds.stationType, 38, 109, SecondaryColor, SecondaryColorSmooth, 16); + } else { + tftReplace(-1, PTYold, radio.rds.stationType, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); + } + } else { + if (!RDSstatus) { + tftReplace(-1, PTYold, radio.rds.stationType, 38, 163, SecondaryColor, SecondaryColorSmooth, 16); + } else { + tftReplace(-1, PTYold, radio.rds.stationType, 38, 163, PrimaryColor, PrimaryColorSmooth, 16); + } + } } PTYold = radio.rds.stationType; if (wifi) { @@ -452,11 +486,19 @@ void showPS() { if (radio.rds.stationName != PSold) { if (!screenmute) { if (advancedRDS) { - tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); + if (!RDSstatus) { + tftReplace(-1, PSold, radio.rds.stationName, 38, 75, SecondaryColor, SecondaryColorSmooth, 28); + } else { + tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); + } } else if (afscreen) { tftReplace(0, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, 16); } else { - tftReplace(-1, PSold, radio.rds.stationName, 38, 187, PrimaryColor, PrimaryColorSmooth, 28); + if (!RDSstatus) { + tftReplace(-1, PSold, radio.rds.stationName, 38, 187, SecondaryColor, SecondaryColorSmooth, 28); + } else { + tftReplace(-1, PSold, radio.rds.stationName, 38, 187, PrimaryColor, PrimaryColorSmooth, 28); + } } } PSold = radio.rds.stationName; @@ -764,4 +806,4 @@ void ShowAFEON() { } } } -#pragma GCC diagnostic pop +#pragma GCC diagnostic pop \ No newline at end of file