Some more fixes on RDS
This commit is contained in:
+32
-10
@@ -407,6 +407,7 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
rds.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F
|
||||
}
|
||||
}
|
||||
rds.picodetext = rds.picode;
|
||||
}
|
||||
|
||||
if (!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) errorfreepi = true;
|
||||
@@ -444,9 +445,33 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
// USA Station callsign decoder
|
||||
if (ps_process && rds.correctPI != 0 && rds.region == 1 && correctPIold != rds.correctPI) {
|
||||
bool foundMatch = false;
|
||||
File file;
|
||||
|
||||
if (SPIFFS.begin(true)) {
|
||||
File file = SPIFFS.open("/USA_callsigns.csv");
|
||||
delay(5);
|
||||
if (currentfreq < 9000) {
|
||||
file = SPIFFS.open("/USA_87-90.csv");
|
||||
} else if (currentfreq > 9000 && currentfreq < 9200) {
|
||||
file = SPIFFS.open("/USA_90-92.csv");
|
||||
} else if (currentfreq > 9200 && currentfreq < 9400) {
|
||||
file = SPIFFS.open("/USA_92-94.csv");
|
||||
} else if (currentfreq > 9400 && currentfreq < 9600) {
|
||||
file = SPIFFS.open("/USA_94-96.csv");
|
||||
} else if (currentfreq > 9600 && currentfreq < 9800) {
|
||||
file = SPIFFS.open("/USA_96-98.csv");
|
||||
} else if (currentfreq > 9800 && currentfreq < 10000) {
|
||||
file = SPIFFS.open("/USA_98-100.csv");
|
||||
} else if (currentfreq > 10000 && currentfreq < 10200) {
|
||||
file = SPIFFS.open("/USA_100-102.csv");
|
||||
} else if (currentfreq > 10200 && currentfreq < 10400) {
|
||||
file = SPIFFS.open("/USA_102-104.csv");
|
||||
} else if (currentfreq > 10400 && currentfreq < 10600) {
|
||||
file = SPIFFS.open("/USA_104-106.csv");
|
||||
} else if (currentfreq > 10600) {
|
||||
file = SPIFFS.open("/USA_106-108.csv");
|
||||
}
|
||||
|
||||
delay(5);
|
||||
if (file) {
|
||||
int i = 0;
|
||||
while (file.available() && !isprint(file.peek())) {
|
||||
@@ -454,7 +479,7 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
i++;
|
||||
}
|
||||
|
||||
char buffer[64];
|
||||
char buffer[25];
|
||||
while (file.available()) {
|
||||
int bytesRead = file.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
|
||||
buffer[bytesRead] = '\0';
|
||||
@@ -487,14 +512,6 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* for (int i = 0; i < sizeof(callsign_USA) / sizeof(callsign_USA[0]); i++) {
|
||||
if (callsign_USA[i][0].csusa_pi == rds.correctPI && callsign_USA[i][0].csusa_freq == currentfreq / 10) {
|
||||
strncpy(rds.stationID, callsign_USA[i][0].csusa_callsign, 7);
|
||||
foundMatch = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (!foundMatch) {
|
||||
uint16_t stationID = rds.rdsA;
|
||||
@@ -524,6 +541,8 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
rds.stationID[8] = '\0';
|
||||
}
|
||||
correctPIold = rds.correctPI;
|
||||
rds.stationIDtext = rds.stationID;
|
||||
rds.stationStatetext = rds.stationState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1379,6 +1398,9 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
||||
rds.PTYN = "";
|
||||
rds.ECCtext = "";
|
||||
rds.LICtext = "";
|
||||
rds.picodetext = "";
|
||||
rds.stationIDtext = "";
|
||||
rds.stationStatetext = "";
|
||||
|
||||
ps_buffer[8] = 0;
|
||||
ptyn_buffer[8] = 0;
|
||||
|
||||
+4
-1
@@ -536,6 +536,9 @@ typedef struct _rds_ {
|
||||
String PTYN;
|
||||
String ECCtext;
|
||||
String LICtext;
|
||||
String picodetext;
|
||||
String stationIDtext;
|
||||
String stationStatetext;
|
||||
char stationType[18];
|
||||
char picode[7];
|
||||
char stationID[8];
|
||||
@@ -714,6 +717,6 @@ class TEF6686 {
|
||||
uint8_t af_counterb;
|
||||
uint8_t af_counterbcheck;
|
||||
bool afmethodBtrigger;
|
||||
uint16_t correctPIold;
|
||||
uint16_t correctPIold;
|
||||
};
|
||||
#endif
|
||||
-21545
File diff suppressed because it is too large
Load Diff
+10
-6
@@ -347,9 +347,9 @@ void BuildAFScreen() {
|
||||
batteryVold = 0;
|
||||
vPerold = 0;
|
||||
af_counterold = 254;
|
||||
strcpy(radioIdPrevious, "");
|
||||
programServicePrevious = "";
|
||||
afmethodBold = false;
|
||||
PIold = " ";
|
||||
PSold = " ";
|
||||
for (byte i = 0; i < 20; i++) eonpsold[i] = "";
|
||||
for (byte i = 0; i < 20; i++) mappedfreqold[i] = 0;
|
||||
for (byte i = 0; i < 20; i++) eonpicodeold[0][i] = '\0';
|
||||
@@ -691,9 +691,11 @@ void BuildAdvancedRDS() {
|
||||
vPerold = 0;
|
||||
ECCold = 253;
|
||||
strcpy(programTypePrevious, "");
|
||||
strcpy(radioIdPrevious, "");
|
||||
programServicePrevious = "";
|
||||
ptynold = " ";
|
||||
PIold = " ";
|
||||
PSold = " ";
|
||||
stationIDold = " ";
|
||||
stationStateold = " ";
|
||||
MSold = 0;
|
||||
licold = 254;
|
||||
af_counterold = 254;
|
||||
@@ -837,8 +839,10 @@ void BuildDisplay() {
|
||||
vPerold = 0;
|
||||
rds_clockold = "";
|
||||
strcpy(programTypePrevious, "");
|
||||
strcpy(radioIdPrevious, "");
|
||||
programServicePrevious = "";
|
||||
PIold = " ";
|
||||
PSold = " ";
|
||||
stationIDold = " ";
|
||||
stationStateold = " ";
|
||||
BWreset = true;
|
||||
if (band < BAND_GAP) tftPrint(-1, "MHz", 258, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 28); else tftPrint(-1, "kHz", 258, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 28);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ extern byte spispeed;
|
||||
extern byte spispeedold;
|
||||
extern char eonpicodeold[20][6];
|
||||
extern char programTypePrevious[18];
|
||||
extern char radioIdPrevious[7];
|
||||
extern float batteryVold;
|
||||
extern float vPerold;
|
||||
extern int ActiveColor;
|
||||
@@ -150,11 +149,14 @@ extern String afstringold;
|
||||
extern String CurrentThemeString;
|
||||
extern String eonpsold[20];
|
||||
extern String eonstringold;
|
||||
extern String PIold;
|
||||
extern String pinstringold;
|
||||
extern String programServicePrevious;
|
||||
extern String PSold;
|
||||
extern String ptynold;
|
||||
extern String rds_clockold;
|
||||
extern String rtplusstringold;
|
||||
extern String stationIDold;
|
||||
extern String stationStateold;
|
||||
extern String XDRGTK_key;
|
||||
extern unsigned int ConverterSet;
|
||||
extern unsigned int HighEdgeSet;
|
||||
|
||||
+2
-6
@@ -394,7 +394,7 @@ void readRds() {
|
||||
}
|
||||
|
||||
void showPI() {
|
||||
if (strcmp(radio.rds.picode, radioIdPrevious) && strcmp(radio.rds.stationID, stationIDPrevious) && strcmp(radio.rds.stationState, stationStatePrevious)) {
|
||||
if ((region == REGION_US && (radio.rds.picodetext != PIold || radio.rds.stationIDtext != stationIDold || radio.rds.stationStatetext != stationStateold)) || (region != REGION_US && radio.rds.picodetext != PIold)) {
|
||||
if (!afscreen && !radio.rds.rdsAerror && !radio.rds.rdsBerror && !radio.rds.rdsCerror && !radio.rds.rdsDerror && radio.rds.rdsA != radio.rds.correctPI && PIold.length() > 1) radio.clearRDS(fullsearchrds);
|
||||
if (!screenmute) {
|
||||
if (advancedRDS) {
|
||||
@@ -422,9 +422,6 @@ void showPI() {
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4));
|
||||
Udp.endPacket();
|
||||
}
|
||||
strcpy(radioIdPrevious, radio.rds.picode);
|
||||
strcpy(stationIDPrevious, radio.rds.stationID);
|
||||
strcpy(stationStatePrevious, radio.rds.stationState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,7 +443,7 @@ void showPTY() {
|
||||
}
|
||||
|
||||
void showPS() {
|
||||
if (radio.rds.stationName != programServicePrevious) {
|
||||
if (radio.rds.stationName != PSold) {
|
||||
if (!screenmute) {
|
||||
if (advancedRDS) {
|
||||
tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
@@ -470,7 +467,6 @@ void showPS() {
|
||||
}
|
||||
Udp.endPacket();
|
||||
}
|
||||
programServicePrevious = radio.rds.stationName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,6 @@ extern byte region;
|
||||
extern byte stationlistid;
|
||||
extern char eonpicodeold[20][6];
|
||||
extern char programTypePrevious[18];
|
||||
extern char stationIDPrevious[8];
|
||||
extern char stationStatePrevious[3];
|
||||
extern char radioIdPrevious[7];
|
||||
extern int ActiveColor;
|
||||
extern int ActiveColorSmooth;
|
||||
extern int BackgroundColor;
|
||||
@@ -82,7 +79,6 @@ extern String eonstringold;
|
||||
extern String LIColdString;
|
||||
extern String pinstringold;
|
||||
extern String PIold;
|
||||
extern String programServicePrevious;
|
||||
extern String PSold;
|
||||
extern String ptynold;
|
||||
extern String PTYold;
|
||||
|
||||
Reference in New Issue
Block a user