Added RDS quality bar

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-02-11 22:16:51 +01:00
parent 791eea7ff9
commit f03328b842
3 changed files with 98 additions and 2 deletions
+5 -2
View File
@@ -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();
+87
View File
@@ -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) {
+6
View File
@@ -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);