RDS USA now shows both PI and Callsign
Callsign converter needs futher adjustment.
This commit is contained in:
+14
-3
@@ -273,6 +273,7 @@ String RTold;
|
||||
String rtplusstringold;
|
||||
String salt;
|
||||
String saltkey = " ";
|
||||
String stationIDold;
|
||||
String SWMIBandstring = String();
|
||||
String SWMIBandstringold = String();
|
||||
String XDRGTK_key;
|
||||
@@ -798,7 +799,10 @@ void loop() {
|
||||
}
|
||||
}
|
||||
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) tftPrint(-1, "ID:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) {
|
||||
tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
tftPrint(-1, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16);
|
||||
@@ -827,7 +831,10 @@ void loop() {
|
||||
tft.fillRect(16, 133, 188, 6, GreyoutColor);
|
||||
}
|
||||
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16);
|
||||
if (region == REGION_US) tftPrint(-1, "ID:", 212, 193, GreyoutColor, BackgroundColor, 16);
|
||||
if (region == REGION_US) {
|
||||
tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16);
|
||||
}
|
||||
tftPrint(-1, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16);
|
||||
@@ -1661,7 +1668,11 @@ void SelectBand() {
|
||||
if (!screenmute) {
|
||||
BuildDisplay();
|
||||
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, GreyoutColor, BackgroundColor, 16);
|
||||
if (region == REGION_US) tftPrint(-1, "ID:", 212, 193, GreyoutColor, BackgroundColor, 16);
|
||||
if (region == REGION_US) {
|
||||
tftPrint(-1, "PI:", 212, 184, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "ID:", 212, 201, GreyoutColor, BackgroundColor, 16);
|
||||
}
|
||||
|
||||
tftPrint(-1, "PS:", 3, 193, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "RT:", 3, 221, GreyoutColor, BackgroundColor, 16);
|
||||
tftPrint(-1, "PTY:", 3, 163, GreyoutColor, BackgroundColor, 16);
|
||||
|
||||
+20
-20
@@ -389,7 +389,7 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
afreset = false;
|
||||
}
|
||||
|
||||
if (rds.region != 1 && ((!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) || (rds.pierrors && !errorfreepi))) {
|
||||
if (((!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) || (rds.pierrors && !errorfreepi))) {
|
||||
if (rds.rdsA != piold) {
|
||||
piold = rds.rdsA;
|
||||
rds.picode[0] = (rds.rdsA >> 12) & 0xF;
|
||||
@@ -436,38 +436,34 @@ void TEF6686::readRDS(byte showrdserrors)
|
||||
memset(rds.picode, 0, sizeof(rds.picode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// USA Station callsign decoder
|
||||
if (rds.region == 1) { // When ID was decoded correctly before, no need to decode again.
|
||||
// USA Station callsign decoder
|
||||
uint16_t stationID = rds.rdsA;
|
||||
if (stationID > 4096) {
|
||||
if (stationID > 21671 && (stationID & 0xF00U) >> 8 == 0) stationID = ((uint16_t)uint8_t(0xA0 + ((stationID & 0xF000U) >> 12)) << 8) + lowByte(stationID); // C0DE -> ACDE
|
||||
if (stationID > 21671 && lowByte(stationID) == 0) stationID = 0xAF00 + uint8_t(highByte(stationID)); // CD00 -> AFCD
|
||||
if (stationID < 39247) {
|
||||
if (stationID > 21671) {
|
||||
rds.picode[0] = 'W';
|
||||
rds.stationID[0] = 'W';
|
||||
stationID -= 21672;
|
||||
} else {
|
||||
rds.picode[0] = 'K';
|
||||
rds.stationID[0] = 'K';
|
||||
stationID -= 4096;
|
||||
}
|
||||
rds.picode[1] = char(stationID / 676 + 65);
|
||||
rds.picode[2] = char((stationID - 676 * int(stationID / 676)) / 26 + 65);
|
||||
rds.picode[3] = char(((stationID - 676 * int(stationID / 676)) % 26) + 65);
|
||||
rds.picode[5] = '\0';
|
||||
rds.stationID[1] = char(stationID / 676 + 65);
|
||||
rds.stationID[2] = char((stationID - 676 * int(stationID / 676)) / 26 + 65);
|
||||
rds.stationID[3] = char(((stationID - 676 * int(stationID / 676)) % 26) + 65);
|
||||
rds.stationID[5] = '\0';
|
||||
} else {
|
||||
stationID -= 4835;
|
||||
rds.picode[0] = 'K';
|
||||
rds.picode[1] = char(stationID / 676 + 65);
|
||||
rds.picode[2] = char((stationID - 676 * int(stationID / 676)) / 26 + 65);
|
||||
rds.picode[3] = char(((stationID - 676 * int(stationID / 676)) % 26) + 65);
|
||||
rds.picode[5] = '\0';
|
||||
rds.stationID[0] = 'K';
|
||||
rds.stationID[1] = char(stationID / 676 + 65);
|
||||
rds.stationID[2] = char((stationID - 676 * int(stationID / 676)) / 26 + 65);
|
||||
rds.stationID[3] = char(((stationID - 676 * int(stationID / 676)) % 26) + 65);
|
||||
rds.stationID[5] = '\0';
|
||||
}
|
||||
}
|
||||
if (((rds.rdsErr >> 14) & 0x02) > 2) rds.picode[5] = '?';
|
||||
if (((rds.rdsErr >> 14) & 0x01) > 1) rds.picode[4] = '?'; else rds.picode[4] = ' '; // Not sure, add a ?
|
||||
rds.picode[6] = '\0';
|
||||
rds.stationID[6] = '\0';
|
||||
}
|
||||
|
||||
if (!rds.rdsBerror || showrdserrors == 3) rdsblock = rds.rdsB >> 11; else return;
|
||||
@@ -1341,8 +1337,12 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
||||
for (i = 0; i < 17; i++) rds.stationType[i] = 0x20;
|
||||
rds.stationType[17] = 0;
|
||||
|
||||
for (i = 0; i < 6; i++) rds.picode[i] = 0x20;
|
||||
rds.picode[6] = 0;
|
||||
for (i = 0; i < 6; i++) {
|
||||
rds.picode[i] = 0x20;
|
||||
rds.stationID[i] = 0x20;
|
||||
rds.picode[6] = 0;
|
||||
rds.stationID[6] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 50; i++) {
|
||||
af[i].frequency = 0;
|
||||
|
||||
+2
-1
@@ -326,7 +326,7 @@ static const char* const ECCtext[] {
|
||||
};
|
||||
|
||||
static const char* const LICtext[] = {
|
||||
"Not def.", // 0
|
||||
"Unknown", // 0
|
||||
"Albanian", // 1
|
||||
"Breton", // 2
|
||||
"Catalan", // 3
|
||||
@@ -538,6 +538,7 @@ typedef struct _rds_ {
|
||||
String LICtext;
|
||||
char stationType[18];
|
||||
char picode[7];
|
||||
char stationID[7];
|
||||
uint16_t hour, minute, day, month, year, rdsA, rdsB, rdsC, rdsD, rdsErr, rdsStat, correctPI, rdsplusTag1, rdsplusTag2;
|
||||
uint16_t aid[10];
|
||||
byte aid_counter;
|
||||
|
||||
+10
-20
@@ -618,8 +618,11 @@ void BuildAdvancedRDS() {
|
||||
tftPrint(-1, "ERRORS", 3, 34, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(1, "MHz", 310, 35, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(1, unitString[unit], 310, 51, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_EU) tftPrint(-1, "PI", ITEM10 + 6, 81, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) tftPrint(-1, "ID", ITEM10 + 6, 81, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_EU) tftPrint(-1, "PI", 216, 81, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) {
|
||||
tftPrint(-1, "PI:", 216, 72, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "ID:", 216, 89, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
tftPrint(-1, "PS", 3, 81, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "PTY", 3, 109, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "RT+", 3, 147, ActiveColor, ActiveColorSmooth, 16);
|
||||
@@ -754,7 +757,10 @@ void BuildDisplay() {
|
||||
tftPrint(1, "C/N", 270, 163, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "dB", 300, 163, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) tftPrint(-1, "ID:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (region == REGION_US) {
|
||||
tftPrint(-1, "PI:", 212, 184, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "ID:", 212, 201, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
tftPrint(-1, "PS:", 3, 193, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "RT:", 3, 221, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, "PTY:", 3, 163, ActiveColor, ActiveColorSmooth, 16);
|
||||
@@ -1098,14 +1104,6 @@ void MenuUp() {
|
||||
if (region == REGION_EU) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_US) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
regionold = region;
|
||||
if (region == REGION_EU) {
|
||||
fmdeemphasis = DEEMPHASIS_50;
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
}
|
||||
if (region == REGION_US) {
|
||||
fmdeemphasis = DEEMPHASIS_75;
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
}
|
||||
radio.rds.region = region;
|
||||
break;
|
||||
|
||||
@@ -1659,14 +1657,6 @@ void MenuDown() {
|
||||
if (region == REGION_EU) tftPrint(0, myLanguage[language][47], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_US) tftPrint(0, myLanguage[language][48], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
regionold = region;
|
||||
if (region == REGION_EU) {
|
||||
fmdeemphasis = DEEMPHASIS_50;
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
}
|
||||
if (region == REGION_US) {
|
||||
fmdeemphasis = DEEMPHASIS_75;
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
}
|
||||
radio.rds.region = region;
|
||||
break;
|
||||
|
||||
@@ -2433,4 +2423,4 @@ void DoMenu() {
|
||||
menuopen = false;
|
||||
BuildMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
-11
@@ -296,7 +296,16 @@ void readRds() {
|
||||
if (!screenmute && !afscreen) {
|
||||
if (!RDSstatus) {
|
||||
if (radio.rds.correctPI != 0) {
|
||||
if (advancedRDS) tftPrint(0, PIold, 275, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, SecondaryColor, SecondaryColorSmooth, 28);
|
||||
if (region == REGION_EU) {
|
||||
|
||||
if (advancedRDS) tftPrint(0, PIold, 275, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, SecondaryColor, SecondaryColorSmooth, 28);
|
||||
}
|
||||
|
||||
if (region == REGION_US) {
|
||||
if (advancedRDS) tftPrint(-1, PIold, 240, 72, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, PIold, 240, 184, SecondaryColor, SecondaryColorSmooth, 16);
|
||||
if (advancedRDS) tftPrint(-1, stationIDold, 240, 89, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, stationIDold, 240, 201, SecondaryColor, SecondaryColorSmooth, 16);
|
||||
}
|
||||
|
||||
if (advancedRDS) tftPrint(-1, PSold, 38, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, SecondaryColor, SecondaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PTYold, 38, 109, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, SecondaryColor, SecondaryColorSmooth, 16);
|
||||
if (advancedRDS) {
|
||||
@@ -309,7 +318,16 @@ void readRds() {
|
||||
}
|
||||
} else {
|
||||
if (dropout) {
|
||||
if (advancedRDS) tftPrint(0, PIold, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_EU) {
|
||||
|
||||
if (advancedRDS) tftPrint(0, PIold, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
}
|
||||
|
||||
if (region == REGION_US) {
|
||||
if (advancedRDS) tftPrint(-1, PIold, 240, 72, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PIold, 240, 184, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (advancedRDS) tftPrint(-1, stationIDold, 240, 89, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, stationIDold, 240, 201, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
}
|
||||
|
||||
if (advancedRDS) tftPrint(-1, PSold, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (advancedRDS) tftPrint(-1, PTYold, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (!advancedRDS) {
|
||||
@@ -380,20 +398,29 @@ void showPI() {
|
||||
if (strcmp(radio.rds.picode, radioIdPrevious)) {
|
||||
if (!screenmute) {
|
||||
if (advancedRDS) {
|
||||
tftReplace(0, PIold, radio.rds.picode, 275, 75, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_EU) tftReplace(0, PIold, radio.rds.picode, 275, 75, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_US) {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 240, 72, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftReplace(-1, stationIDold, radio.rds.stationID, 240, 89, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
}
|
||||
} else if (afscreen) {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 30, 201, BWAutoColor, BWAutoColorSmooth, 16);
|
||||
} else {
|
||||
tftReplace(0, PIold, radio.rds.picode, 275, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_EU) tftReplace(0, PIold, radio.rds.picode, 275, 187, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (region == REGION_US) {
|
||||
tftReplace(-1, PIold, radio.rds.picode, 240, 184, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftReplace(-1, stationIDold, radio.rds.stationID, 240, 201, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
}
|
||||
}
|
||||
PIold = radio.rds.picode;
|
||||
stationIDold = radio.rds.stationID;
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4));
|
||||
Udp.endPacket();
|
||||
}
|
||||
strcpy(radioIdPrevious, radio.rds.picode);
|
||||
}
|
||||
PIold = radio.rds.picode;
|
||||
if (wifi) {
|
||||
Udp.beginPacket(remoteip, 9030);
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";PI=" + String(radio.rds.picode, 4));
|
||||
Udp.endPacket();
|
||||
}
|
||||
strcpy(radioIdPrevious, radio.rds.picode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ extern byte language;
|
||||
extern byte licold;
|
||||
extern byte MSold;
|
||||
extern byte rdsblockold;
|
||||
extern byte region;
|
||||
extern byte stationlistid;
|
||||
extern char programTypePrevious[18];
|
||||
extern char radioIdPrevious[7];
|
||||
@@ -88,6 +89,7 @@ extern String RDSSPYRDS;
|
||||
extern String RDSSPYRDSold;
|
||||
extern String RTold;
|
||||
extern String rtplusstringold;
|
||||
extern String stationIDold;
|
||||
extern String XDRGTKRDS;
|
||||
extern String XDRGTKRDSold;
|
||||
extern unsigned int mappedfreqold[20];
|
||||
|
||||
Reference in New Issue
Block a user