Some more fixes on RDS

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-28 23:03:08 +02:00
parent 2a3a190ecc
commit 62a6a67fbc
19 changed files with 21992 additions and 43520 deletions
+2 -8
View File
@@ -179,9 +179,6 @@ byte spispeedold;
char buff[16];
char eonpicodeold[20][6];
char programTypePrevious[18];
char radioIdPrevious[7];
char stationIDPrevious[8];
char stationStatePrevious[3];
const uint8_t* currentFont = nullptr;
float vPerold;
int ActiveColor;
@@ -263,7 +260,6 @@ String eonstringold;
String LIColdString;
String pinstringold;
String PIold;
String programServicePrevious;
String PSold;
String ptynold = " ";
String PTYold;
@@ -369,6 +365,8 @@ void setup() {
gpio_set_drive_capability((gpio_num_t) 17, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 18, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 19, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t)21, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t)22, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 23, GPIO_DRIVE_CAP_0);
setupmode = true;
EEPROM.begin(EE_TOTAL_CNT);
@@ -488,7 +486,6 @@ void setup() {
Round30K(frequency_OIRT);
}
break;
default: break;
}
tft.init();
@@ -2332,9 +2329,6 @@ void ShowFreq(int mode) {
}
attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_A), read_encoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_B), read_encoder, CHANGE);
strcpy(programTypePrevious, "0");
strcpy(radioIdPrevious, "0");
programServicePrevious = "0";
rtplusstringold = "";
eonstringold = "";
afstringold = "";
+2084
View File
File diff suppressed because it is too large Load Diff
+2090
View File
File diff suppressed because it is too large Load Diff
+2048
View File
File diff suppressed because it is too large Load Diff
+2107
View File
File diff suppressed because it is too large Load Diff
+2591
View File
File diff suppressed because it is too large Load Diff
+2641
View File
File diff suppressed because it is too large Load Diff
+2141
View File
File diff suppressed because it is too large Load Diff
+2100
View File
File diff suppressed because it is too large Load Diff
+2050
View File
File diff suppressed because it is too large Load Diff
+2086
View File
File diff suppressed because it is too large Load Diff
-21938
View File
File diff suppressed because it is too large Load Diff
+32 -10
View File
@@ -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;
+3
View File
@@ -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];
-21545
View File
File diff suppressed because it is too large Load Diff
+10 -6
View File
@@ -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);
}
+4 -2
View File
@@ -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
View File
@@ -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;
}
}
-4
View File
@@ -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;