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 buff[16];
char eonpicodeold[20][6]; char eonpicodeold[20][6];
char programTypePrevious[18]; char programTypePrevious[18];
char radioIdPrevious[7];
char stationIDPrevious[8];
char stationStatePrevious[3];
const uint8_t* currentFont = nullptr; const uint8_t* currentFont = nullptr;
float vPerold; float vPerold;
int ActiveColor; int ActiveColor;
@@ -263,7 +260,6 @@ String eonstringold;
String LIColdString; String LIColdString;
String pinstringold; String pinstringold;
String PIold; String PIold;
String programServicePrevious;
String PSold; String PSold;
String ptynold = " "; String ptynold = " ";
String PTYold; 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) 17, GPIO_DRIVE_CAP_0);
gpio_set_drive_capability((gpio_num_t) 18, 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) 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); gpio_set_drive_capability((gpio_num_t) 23, GPIO_DRIVE_CAP_0);
setupmode = true; setupmode = true;
EEPROM.begin(EE_TOTAL_CNT); EEPROM.begin(EE_TOTAL_CNT);
@@ -488,7 +486,6 @@ void setup() {
Round30K(frequency_OIRT); Round30K(frequency_OIRT);
} }
break; break;
default: break;
} }
tft.init(); tft.init();
@@ -2332,9 +2329,6 @@ void ShowFreq(int mode) {
} }
attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_A), read_encoder, CHANGE); attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_A), read_encoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_B), read_encoder, CHANGE); attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_B), read_encoder, CHANGE);
strcpy(programTypePrevious, "0");
strcpy(radioIdPrevious, "0");
programServicePrevious = "0";
rtplusstringold = ""; rtplusstringold = "";
eonstringold = ""; eonstringold = "";
afstringold = ""; 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.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F
} }
} }
rds.picodetext = rds.picode;
} }
if (!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) errorfreepi = true; if (!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) errorfreepi = true;
@@ -444,9 +445,33 @@ void TEF6686::readRDS(byte showrdserrors)
// USA Station callsign decoder // USA Station callsign decoder
if (ps_process && rds.correctPI != 0 && rds.region == 1 && correctPIold != rds.correctPI) { if (ps_process && rds.correctPI != 0 && rds.region == 1 && correctPIold != rds.correctPI) {
bool foundMatch = false; bool foundMatch = false;
File file;
if (SPIFFS.begin(true)) { 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) { if (file) {
int i = 0; int i = 0;
while (file.available() && !isprint(file.peek())) { while (file.available() && !isprint(file.peek())) {
@@ -454,7 +479,7 @@ void TEF6686::readRDS(byte showrdserrors)
i++; i++;
} }
char buffer[64]; char buffer[25];
while (file.available()) { while (file.available()) {
int bytesRead = file.readBytesUntil('\n', buffer, sizeof(buffer) - 1); int bytesRead = file.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
buffer[bytesRead] = '\0'; 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) { if (!foundMatch) {
uint16_t stationID = rds.rdsA; uint16_t stationID = rds.rdsA;
@@ -524,6 +541,8 @@ void TEF6686::readRDS(byte showrdserrors)
rds.stationID[8] = '\0'; rds.stationID[8] = '\0';
} }
correctPIold = rds.correctPI; correctPIold = rds.correctPI;
rds.stationIDtext = rds.stationID;
rds.stationStatetext = rds.stationState;
} }
} }
@@ -1379,6 +1398,9 @@ void TEF6686::clearRDS (bool fullsearchrds)
rds.PTYN = ""; rds.PTYN = "";
rds.ECCtext = ""; rds.ECCtext = "";
rds.LICtext = ""; rds.LICtext = "";
rds.picodetext = "";
rds.stationIDtext = "";
rds.stationStatetext = "";
ps_buffer[8] = 0; ps_buffer[8] = 0;
ptyn_buffer[8] = 0; ptyn_buffer[8] = 0;
+4 -1
View File
@@ -536,6 +536,9 @@ typedef struct _rds_ {
String PTYN; String PTYN;
String ECCtext; String ECCtext;
String LICtext; String LICtext;
String picodetext;
String stationIDtext;
String stationStatetext;
char stationType[18]; char stationType[18];
char picode[7]; char picode[7];
char stationID[8]; char stationID[8];
@@ -714,6 +717,6 @@ class TEF6686 {
uint8_t af_counterb; uint8_t af_counterb;
uint8_t af_counterbcheck; uint8_t af_counterbcheck;
bool afmethodBtrigger; bool afmethodBtrigger;
uint16_t correctPIold; uint16_t correctPIold;
}; };
#endif #endif
-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; batteryVold = 0;
vPerold = 0; vPerold = 0;
af_counterold = 254; af_counterold = 254;
strcpy(radioIdPrevious, "");
programServicePrevious = "";
afmethodBold = false; afmethodBold = false;
PIold = " ";
PSold = " ";
for (byte i = 0; i < 20; i++) eonpsold[i] = ""; 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++) mappedfreqold[i] = 0;
for (byte i = 0; i < 20; i++) eonpicodeold[0][i] = '\0'; for (byte i = 0; i < 20; i++) eonpicodeold[0][i] = '\0';
@@ -691,9 +691,11 @@ void BuildAdvancedRDS() {
vPerold = 0; vPerold = 0;
ECCold = 253; ECCold = 253;
strcpy(programTypePrevious, ""); strcpy(programTypePrevious, "");
strcpy(radioIdPrevious, "");
programServicePrevious = "";
ptynold = " "; ptynold = " ";
PIold = " ";
PSold = " ";
stationIDold = " ";
stationStateold = " ";
MSold = 0; MSold = 0;
licold = 254; licold = 254;
af_counterold = 254; af_counterold = 254;
@@ -837,8 +839,10 @@ void BuildDisplay() {
vPerold = 0; vPerold = 0;
rds_clockold = ""; rds_clockold = "";
strcpy(programTypePrevious, ""); strcpy(programTypePrevious, "");
strcpy(radioIdPrevious, ""); PIold = " ";
programServicePrevious = ""; PSold = " ";
stationIDold = " ";
stationStateold = " ";
BWreset = true; 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); 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 byte spispeedold;
extern char eonpicodeold[20][6]; extern char eonpicodeold[20][6];
extern char programTypePrevious[18]; extern char programTypePrevious[18];
extern char radioIdPrevious[7];
extern float batteryVold; extern float batteryVold;
extern float vPerold; extern float vPerold;
extern int ActiveColor; extern int ActiveColor;
@@ -150,11 +149,14 @@ extern String afstringold;
extern String CurrentThemeString; extern String CurrentThemeString;
extern String eonpsold[20]; extern String eonpsold[20];
extern String eonstringold; extern String eonstringold;
extern String PIold;
extern String pinstringold; extern String pinstringold;
extern String programServicePrevious; extern String PSold;
extern String ptynold; extern String ptynold;
extern String rds_clockold; extern String rds_clockold;
extern String rtplusstringold; extern String rtplusstringold;
extern String stationIDold;
extern String stationStateold;
extern String XDRGTK_key; extern String XDRGTK_key;
extern unsigned int ConverterSet; extern unsigned int ConverterSet;
extern unsigned int HighEdgeSet; extern unsigned int HighEdgeSet;
+2 -6
View File
@@ -394,7 +394,7 @@ void readRds() {
} }
void showPI() { 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 (!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 (!screenmute) {
if (advancedRDS) { if (advancedRDS) {
@@ -422,9 +422,6 @@ void showPI() {
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4)); Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4));
Udp.endPacket(); 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() { void showPS() {
if (radio.rds.stationName != programServicePrevious) { if (radio.rds.stationName != PSold) {
if (!screenmute) { if (!screenmute) {
if (advancedRDS) { if (advancedRDS) {
tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); tftReplace(-1, PSold, radio.rds.stationName, 38, 75, PrimaryColor, PrimaryColorSmooth, 28);
@@ -470,7 +467,6 @@ void showPS() {
} }
Udp.endPacket(); Udp.endPacket();
} }
programServicePrevious = radio.rds.stationName;
} }
} }
-4
View File
@@ -51,9 +51,6 @@ extern byte region;
extern byte stationlistid; extern byte stationlistid;
extern char eonpicodeold[20][6]; extern char eonpicodeold[20][6];
extern char programTypePrevious[18]; extern char programTypePrevious[18];
extern char stationIDPrevious[8];
extern char stationStatePrevious[3];
extern char radioIdPrevious[7];
extern int ActiveColor; extern int ActiveColor;
extern int ActiveColorSmooth; extern int ActiveColorSmooth;
extern int BackgroundColor; extern int BackgroundColor;
@@ -82,7 +79,6 @@ extern String eonstringold;
extern String LIColdString; extern String LIColdString;
extern String pinstringold; extern String pinstringold;
extern String PIold; extern String PIold;
extern String programServicePrevious;
extern String PSold; extern String PSold;
extern String ptynold; extern String ptynold;
extern String PTYold; extern String PTYold;