diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 6b8dd80..52d8ce8 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -170,6 +170,7 @@ byte optenc; byte poweroptions; byte poweroptionsold; byte rdsblockold; +byte rdsqualityold; byte region; byte rotarymode; byte touchrotating; @@ -258,6 +259,7 @@ int xPos4; int16_t OStatus; int16_t SAvg; int16_t SAvg2; +int16_t SAvg3; int16_t SStatus; int8_t LevelOffset; int8_t LowLevelSet; @@ -989,11 +991,12 @@ void loop() { void GetData() { if (!afscreen) showCT(); - if (band < BAND_GAP) ShowStereoStatus(); if (band < BAND_GAP && !menu) { if (advancedRDS && !afscreen && !screenmute) ShowAdvancedRDS(); if (afscreen && !screenmute) ShowAFEON(); - if (!afscreen && !menu) { + if (!afscreen) { + ShowErrors(); + ShowStereoStatus(); showPTY(); showECC(); showRadioText(); diff --git a/src/rds.cpp b/src/rds.cpp index b25a7cb..04a3491 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -446,6 +446,93 @@ void readRds() { } } +void ShowErrors() { + uint8_t calc = 4; + if (!radio.rds.rdsAerror) calc--; + if (!radio.rds.rdsBerror) calc--; + if (!radio.rds.rdsCerror) calc--; + if (!radio.rds.rdsDerror) calc--; + + SAvg3 = (((SAvg3 * 9) + 5) / 10) + calc; + calc = SAvg3 / 10; + if (!RDSstatus) calc = 4; + if (calc != rdsqualityold || BWreset) { + switch (calc) { + case 0: + tft.drawRect(205, (advancedRDS ? 78 : 190), 4, 18, SecondaryColor); + tft.fillRect(206, (advancedRDS ? 79 : 191), 2, 16, BarInsignificantColor); + + tft.drawRect(199, (advancedRDS ? 82 : 194), 4, 14, SecondaryColor); + tft.fillRect(200, (advancedRDS ? 83 : 195), 2, 12, BarInsignificantColor); + + tft.drawRect(193, (advancedRDS ? 86 : 198), 4, 10, SecondaryColor); + tft.fillRect(194, (advancedRDS ? 87 : 199), 2, 8, BarInsignificantColor); + + tft.drawRect(187, (advancedRDS ? 90 : 202), 4, 6, SecondaryColor); + tft.fillRect(188, (advancedRDS ? 91 : 203), 2, 4, BarInsignificantColor); + break; + + case 1: + tft.drawRect(205, (advancedRDS ? 78 : 190), 4, 18, GreyoutColor); + tft.fillRect(206, (advancedRDS ? 79 : 191), 2, 16, BackgroundColor); + + tft.drawRect(199, (advancedRDS ? 82 : 194), 4, 14, SecondaryColor); + tft.fillRect(200, (advancedRDS ? 83 : 195), 2, 12, BarInsignificantColor); + + tft.drawRect(193, (advancedRDS ? 86 : 198), 4, 10, SecondaryColor); + tft.fillRect(194, (advancedRDS ? 87 : 199), 2, 8, BarInsignificantColor); + + tft.drawRect(187, (advancedRDS ? 90 : 202), 4, 6, SecondaryColor); + tft.fillRect(188, (advancedRDS ? 91 : 203), 2, 4, BarInsignificantColor); + break; + + case 2: + tft.drawRect(205, (advancedRDS ? 78 : 190), 4, 18, GreyoutColor); + tft.fillRect(206, (advancedRDS ? 79 : 191), 2, 16, BackgroundColor); + + tft.drawRect(199, (advancedRDS ? 82 : 194), 4, 14, GreyoutColor); + tft.fillRect(200, (advancedRDS ? 83 : 195), 2, 12, BackgroundColor); + + tft.drawRect(193, (advancedRDS ? 86 : 198), 4, 10, SecondaryColor); + tft.fillRect(194, (advancedRDS ? 87 : 199), 2, 8, BarSignificantColor); + + tft.drawRect(187, (advancedRDS ? 90 : 202), 4, 6, SecondaryColor); + tft.fillRect(188, (advancedRDS ? 91 : 203), 2, 4, BarSignificantColor); + break; + + case 3: + tft.drawRect(205, (advancedRDS ? 78 : 190), 4, 18, GreyoutColor); + tft.fillRect(206, (advancedRDS ? 79 : 191), 2, 16, BackgroundColor); + + tft.drawRect(199, (advancedRDS ? 82 : 194), 4, 14, GreyoutColor); + tft.fillRect(200, (advancedRDS ? 83 : 195), 2, 12, BackgroundColor); + + tft.drawRect(193, (advancedRDS ? 86 : 198), 4, 10, GreyoutColor); + tft.fillRect(194, (advancedRDS ? 87 : 199), 2, 8, BackgroundColor); + + tft.drawRect(187, (advancedRDS ? 90 : 202), 4, 6, SecondaryColor); + tft.fillRect(188, (advancedRDS ? 91 : 203), 2, 4, BarSignificantColor); + break; + + case 4: + tft.drawRect(205, (advancedRDS ? 78 : 190), 4, 18, GreyoutColor); + tft.fillRect(206, (advancedRDS ? 79 : 191), 2, 16, BackgroundColor); + + tft.drawRect(199, (advancedRDS ? 82 : 194), 4, 14, GreyoutColor); + tft.fillRect(200, (advancedRDS ? 83 : 195), 2, 12, BackgroundColor); + + tft.drawRect(193, (advancedRDS ? 86 : 198), 4, 10, GreyoutColor); + tft.fillRect(194, (advancedRDS ? 87 : 199), 2, 8, BackgroundColor); + + tft.drawRect(187, (advancedRDS ? 90 : 202), 4, 6, GreyoutColor); + tft.fillRect(188, (advancedRDS ? 91 : 203), 2, 4, BackgroundColor); + break; + } + rdsqualityold = calc; + } +} + + void showPI() { if ((region == REGION_US && (String(radio.rds.picode) != PIold || radio.rds.stationIDtext != stationIDold || radio.rds.stationStatetext != stationStateold)) || (region != REGION_US && String(radio.rds.picode) != PIold)) { if (!afscreen && !radio.rds.rdsAerror && !radio.rds.rdsBerror && !radio.rds.rdsCerror && !radio.rds.rdsDerror && radio.rds.rdsA != radio.rds.correctPI && PIold.length() > 1) { diff --git a/src/rds.h b/src/rds.h index c2dadb6..aa6ff3c 100644 --- a/src/rds.h +++ b/src/rds.h @@ -14,6 +14,7 @@ extern bool afpage; extern bool afscreen; extern bool aftest; extern bool artheadold; +extern bool BWreset; extern bool compressedold; extern bool clearrds; extern bool dropout; @@ -49,6 +50,7 @@ extern byte licold; extern byte MSold; extern byte eonptyold[20]; extern byte rdsblockold; +extern byte rdsqualityold; extern byte region; extern byte stationlistid; extern char eonpicodeold[20][6]; @@ -56,6 +58,8 @@ extern char programTypePrevious[18]; extern int ActiveColor; extern int ActiveColorSmooth; extern int BackgroundColor; +extern int BarSignificantColor; +extern int BarInsignificantColor; extern int BWAutoColor; extern int BWAutoColorSmooth; extern int GreyoutColor; @@ -75,6 +79,7 @@ extern int xPos; extern int xPos2; extern int xPos3; extern int xPos4; +extern int16_t SAvg3; extern IPAddress remoteip; extern String AIDString; extern String ECColdtxt; @@ -126,6 +131,7 @@ void showPS(); void showRadioText(); void ShowAFEON(); void showCT(); +void ShowErrors(); extern void ShowRDSLogo(bool RDSstatus); extern void DataPrint(String string);