Added support for 32 chars RT.

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-07-09 14:34:39 +02:00
parent 124d73b02c
commit f13c1e9e3c
3 changed files with 39 additions and 8 deletions
+7 -6
View File
@@ -2670,7 +2670,7 @@ void readRds() {
RDSstatus = radio.rds.hasRDS;
ShowRDSLogo(RDSstatus);
if (RDSstatus == 0 && screenmute == false) {
tft.setTextColor(PrimaryColor);
tft.setTextColor(SecondaryColor);
tft.setFreeFont(FONT14);
if (advancedRDS) tft.drawString(PIold, 244, 66, GFXFF); else tft.drawString(PIold, 244, 183, GFXFF);
tft.setFreeFont(FONT14);
@@ -3160,24 +3160,24 @@ void showRadioText() {
if (millis() - rtticker >= 350) {
xPos -= charWidth;
if (advancedRDS) {
if (xPos < -tft.textWidth(radio.rds.stationText) + (charWidth * 14)) xPos = 6;
if (xPos < -tft.textWidth(radio.rds.stationText + " " + radio.rds.stationText32) + (charWidth * 14)) xPos = 6;
sprite2.setFreeFont(FONT7);
sprite2.setTextDatum(ML_DATUM);
sprite2.fillSprite(BackgroundColor);
sprite2.setTextColor(PrimaryColor);
sprite2.drawString(radio.rds.stationText, xPos, 4, GFXFF);
sprite2.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 4, GFXFF);
sprite2.pushSprite(35, 222);
} else {
if (xPos < -tft.textWidth(radio.rds.stationText) + (charWidth * 24)) xPos = 6;
if (xPos < -tft.textWidth(radio.rds.stationText + " " + radio.rds.stationText32) + (charWidth * 24)) xPos = 6;
sprite.setFreeFont(FONT7);
sprite.setTextDatum(ML_DATUM);
sprite.fillSprite(BackgroundColor);
sprite.setTextColor(PrimaryColor);
sprite.drawString(radio.rds.stationText, xPos, 4, GFXFF);
sprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 4, GFXFF);
sprite.pushSprite(1, 222);
}
rtticker = millis();
RTold = radio.rds.stationText;
RTold = radio.rds.stationText + " " + radio.rds.stationText32;
cleanup = true;
}
} else if (cleanup == true) {
@@ -3203,6 +3203,7 @@ void showRadioText() {
tft.drawLine(0, 239, 320, 239, FrameColor);
}
void BuildMenu() {
advancedRDS = false;
tft.setFreeFont(FONT7);
+30 -2
View File
@@ -436,7 +436,7 @@ void TEF6686::readRDS(bool showrdserrors)
case RDS_GROUP_2A: {
if (showrdserrors || rds.correct) {
// RT decoder
// RT decoder (64 characters)
rds.hasRT = true;
rds.rtAB = (bitRead(rds.rdsB, 4)); // Get AB flag
@@ -464,6 +464,32 @@ void TEF6686::readRDS(bool showrdserrors)
}
} break;
case RDS_GROUP_2B: {
if (showrdserrors || rds.correct) {
// RT decoder (32 characters)
rds.hasRT = true;
rds.rtAB = (bitRead(rds.rdsB, 4)); // Get AB flag
if (rds.rtAB != rtABold) { // Erase old RT, because of AB change
for (byte i = 0; i < 33; i++) {
rt_buffer32[i] = 0x20;
}
rt_buffer32[33] = '\0';
rtABold = rds.rtAB;
}
offset = (rds.rdsB & 0xf) * 2; // Get RT character segment
rt_buffer32[offset + 0] = rds.rdsD >> 8; // First character of segment
rt_buffer32[offset + 1] = rds.rdsD & 0xff; // Second character of segment
wchar_t RTtext[33] = L""; // Create 16 bit char buffer for Extended ASCII
RDScharConverter(rt_buffer32, RTtext, sizeof(RTtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII
rds.stationText32 = convertToUTF8(RTtext); // Convert RDS characterset to ASCII
rds.stationText32 = extractUTF8Substring(rds.stationText32, 0, 32, true); // Make sure RT does not exceed 32 characters
rds.stationText32 += " "; // Add extra spaces
}
} break;
case RDS_GROUP_3A: {
// RT+ init
if (rds.rdsD == 0x4BD7) { // Check for RT+ application
@@ -554,7 +580,7 @@ void TEF6686::readRDS(bool showrdserrors)
rds.RTContent2 = convertToUTF8(RTtext2); // Convert RDS characterset to ASCII
rds.RTContent2 = extractUTF8Substring(rds.RTContent2, 0, 44, false); // Make sure RT does not exceed 32 characters
if (rds.correct && rdsblock == 16 && (rds.rdsB & (1 << 4))) rds.hasTMC = true; // TMC flag
if (rds.correct && rdsblock == 16 && (rds.rdsB & (1 << 4))) rds.hasTMC = true; // TMC flag
}
break;
@@ -636,6 +662,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
uint8_t i;
rds.stationName = "";
rds.stationText = "";
rds.stationText32 = "";
rds.RTContent1 = "";
rds.RTContent2 = "";
rds.PTYN = "";
@@ -647,6 +674,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
PTYNtext[i] = L'\0';
}
for (i = 0; i < 65; i++) rt_buffer[i] = 0;
for (i = 0; i < 33; i++) rt_buffer32[i] = 0;
for (i = 0; i < 18; i++) rds.stationType[i] = 0;
for (i = 0; i < 6; i++) rds.picode[i] = 0;
+2
View File
@@ -97,6 +97,7 @@ typedef struct _rds_ {
byte MS;
String stationName;
String stationText;
String stationText32;
String RTContent1;
String RTContent2;
String PTYN;
@@ -214,6 +215,7 @@ class TEF6686 {
bool rt_process;
char rt_buffer[65];
char rt_buffer2[65];
char rt_buffer32[33];
bool useRTPlus = true;
bool ABold;
char stationTextBuffer[65];