diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 11f7107..744c916 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -140,6 +140,7 @@ byte ContrastSet; byte CurrentTheme; byte displayflip; byte ECCold; +byte eonptyold[20]; byte EQset; byte fmdefaultstepsize; byte fmnb; diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 52263f7..a333172 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -1426,6 +1426,7 @@ void TEF6686::readRDS(byte showrdserrors) if (offset == 13 && eon[position].pi == rds.rdsD) { eon[position].taset = true; eon[position].ta = bitRead(rds.rdsC, 0); + eon[position].pty = (rds.rdsC >> 11) & 0xF; } if (bitRead(rds.rdsB, 4) && eon[position].pi == rds.rdsD) eon[position].tp = true; @@ -1460,7 +1461,7 @@ void TEF6686::readRDS(byte showrdserrors) eon[j].picode[sizeof(eon[j].picode) - 1] = '\0'; strncpy(eon[j + 1].picode, temp6, sizeof(eon[j + 1].picode) - 1); eon[j + 1].picode[sizeof(eon[j + 1].picode) - 1] = '\0'; - + std::swap(eon[j].pty, eon[j + 1].pty); std::swap(eon[j].ps, eon[j + 1].ps); std::swap(eon[j].ta, eon[j + 1].ta); std::swap(eon[j].tp, eon[j + 1].tp); @@ -1535,6 +1536,7 @@ void TEF6686::clearRDS (bool fullsearchrds) { } for (i = 0; i < 20; i++) { + eon[i].pty = 254; eon[i].pi = 0; eon[i].ps = ""; eon[i].mappedfreq = 0; @@ -1832,4 +1834,4 @@ void TEF6686::RDScharConverter(const char* input, wchar_t* output, size_t size, } } output[size - 1] = L'\0'; -} +} \ No newline at end of file diff --git a/src/TEF6686.h b/src/TEF6686.h index 31aac63..f6dae0e 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -635,6 +635,7 @@ typedef struct _eon_ { bool ta; bool tp; bool taset; + uint8_t pty; } eon_; typedef struct _logbook_ { diff --git a/src/rds.cpp b/src/rds.cpp index e9b96a8..bc5f4bd 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -520,11 +520,11 @@ void showRadioText() { AdvRadiotextSprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2); AdvRadiotextSprite.pushSprite(35, 220); } else if (!advancedRDS && radio.rds.stationText.length() < 29) { - xPos = 0; - RadiotextSprite.fillSprite(BackgroundColor); - if (RDSstatus) RadiotextSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else RadiotextSprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false); - RadiotextSprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2); - RadiotextSprite.pushSprite(38, 220); + xPos = 0; + RadiotextSprite.fillSprite(BackgroundColor); + if (RDSstatus) RadiotextSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else RadiotextSprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false); + RadiotextSprite.drawString(radio.rds.stationText + " " + radio.rds.stationText32, xPos, 2); + RadiotextSprite.pushSprite(38, 220); } else { if (millis() - rtticker >= 15) { if (xPos == 0) { @@ -633,9 +633,10 @@ void ShowAFEON() { if (radio.rds.hasEON && afpagenr > 1) { if (!haseonold) { tftPrint(-1, myLanguage[language][88], 6, 48, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, "PI:", 4, 32, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "TA:", 276, 32, ActiveColor, ActiveColorSmooth, 16); - tftPrint(0, "TP:", 302, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, "PI", 4, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(0, "TA", 250, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(0, "TP", 276, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(0, "PTY", 304, 32, ActiveColor, ActiveColorSmooth, 16); haseonold = true; } @@ -649,54 +650,59 @@ void ShowAFEON() { strcpy(eonpicodeold[i + y], radio.eon[i + y].picode); if (radio.eon[i + y].ps.length() > 0) { - tftPrint(-1, "PS:", 66, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, "PS", 46, 32, ActiveColor, ActiveColorSmooth, 16); - if (strcmp(radio.eon[i + y].ps.c_str(), eonpsold[i + y].c_str()) != 0) tftPrint(-1, String(eonpsold[i + y]), 66, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(-1, String(radio.eon[i + y].ps), 66, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16); + if (strcmp(radio.eon[i + y].ps.c_str(), eonpsold[i + y].c_str()) != 0) tftPrint(-1, String(eonpsold[i + y]), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(-1, String(radio.eon[i + y].ps), 46, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16); eonpsold[i + y] = radio.eon[i + y].ps; } else { - tftPrint(-1, String(eonpsold[i + y]), 66, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(-1, String(eonpsold[i + y]), 46, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq > 0) { - tftPrint(1, "FREQ:", 176, 32, ActiveColor, ActiveColorSmooth, 16); + tftPrint(1, "FREQ", 156, 32, ActiveColor, ActiveColorSmooth, 16); - if (radio.eon[i + y].mappedfreq != mappedfreqold[i + y]) tftPrint(1, String(mappedfreqold[i + y] / 100) + "." + String((mappedfreqold[i + y] % 100) / 10), 176, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(1, String(radio.eon[i + y].mappedfreq / 100) + "." + String((radio.eon[i + y].mappedfreq % 100) / 10), 176, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); + if (radio.eon[i + y].mappedfreq != mappedfreqold[i + y]) tftPrint(1, String(mappedfreqold[i + y] / 100) + "." + String((mappedfreqold[i + y] % 100) / 10), 156, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(radio.eon[i + y].mappedfreq / 100) + "." + String((radio.eon[i + y].mappedfreq % 100) / 10), 156, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); mappedfreqold[i + y] = radio.eon[i + y].mappedfreq; } else { - tftPrint(1, String(mappedfreqold[i + y] / 100) + "." + String((mappedfreqold[i + y] % 100) / 10), 176, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(mappedfreqold[i + y] / 100) + "." + String((mappedfreqold[i + y] % 100) / 10), 156, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq2 > 0) { - if (radio.eon[i + y].mappedfreq2 != mappedfreqold2[i + y]) tftPrint(1, String(mappedfreqold2[i + y] / 100) + "." + String((mappedfreqold2[i + y] % 100) / 10), 216, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(1, String(radio.eon[i + y].mappedfreq2 / 100) + "." + String((radio.eon[i + y].mappedfreq2 % 100) / 10), 216, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); + if (radio.eon[i + y].mappedfreq2 != mappedfreqold2[i + y]) tftPrint(1, String(mappedfreqold2[i + y] / 100) + "." + String((mappedfreqold2[i + y] % 100) / 10), 196, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(radio.eon[i + y].mappedfreq2 / 100) + "." + String((radio.eon[i + y].mappedfreq2 % 100) / 10), 196, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); mappedfreqold2[i + y] = radio.eon[i + y].mappedfreq2; } else { - tftPrint(1, String(mappedfreqold2[i + y] / 100) + "." + String((mappedfreqold2[i + y] % 100) / 10), 216, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(mappedfreqold2[i + y] / 100) + "." + String((mappedfreqold2[i + y] % 100) / 10), 196, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].mappedfreq3 > 0) { - if (radio.eon[i + y].mappedfreq3 != mappedfreqold3[i + y]) tftPrint(1, String(mappedfreqold3[i + y] / 100) + "." + String((mappedfreqold3[i + y] % 100) / 10), 256, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(1, String(radio.eon[i + y].mappedfreq3 / 100) + "." + String((radio.eon[i + y].mappedfreq3 % 100) / 10), 256, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); + if (radio.eon[i + y].mappedfreq3 != mappedfreqold3[i + y]) tftPrint(1, String(mappedfreqold3[i + y] / 100) + "." + String((mappedfreqold3[i + y] % 100) / 10), 236, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(radio.eon[i + y].mappedfreq3 / 100) + "." + String((radio.eon[i + y].mappedfreq3 % 100) / 10), 236, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); mappedfreqold3[i + y] = radio.eon[i + y].mappedfreq3; } else { - tftPrint(1, String(mappedfreqold3[i + y] / 100) + "." + String((mappedfreqold3[i + y] % 100) / 10), 256, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(1, String(mappedfreqold3[i + y] / 100) + "." + String((mappedfreqold3[i + y] % 100) / 10), 236, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); } if (radio.eon[i + y].taset) { if (radio.eon[i + y].ta) { - tft.fillCircle(276, 54 + (15 * i), 4, InsignificantColor); + tft.fillCircle(250, 54 + (15 * i), 4, InsignificantColor); } else { - tft.fillCircle(276, 54 + (15 * i), 4, BackgroundColor); + tft.fillCircle(250, 54 + (15 * i), 4, BackgroundColor); } } else { - tft.fillCircle(276, 54 + (15 * i), 4, BackgroundColor); + tft.fillCircle(250, 54 + (15 * i), 4, BackgroundColor); } - if (radio.eon[i + y].tp) tft.fillCircle(302, 54 + (15 * i), 4, InsignificantColor); else tft.fillCircle(302, 54 + (15 * i), 4, BackgroundColor); + if (radio.eon[i + y].tp) tft.fillCircle(276, 54 + (15 * i), 4, InsignificantColor); else tft.fillCircle(276, 54 + (15 * i), 4, BackgroundColor); + + if (radio.eon[i + y].pty != eonptyold[i + y]) { + tftReplace(0, String(eonptyold[i + y]), (radio.eon[i + y].pty < 32 ? String(radio.eon[i + y].pty) : " "), 304, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); + eonptyold[i + y] = radio.eon[i + y].pty; + } if (i == 9) i = 254; } diff --git a/src/rds.h b/src/rds.h index 956cf44..bc30551 100644 --- a/src/rds.h +++ b/src/rds.h @@ -46,6 +46,7 @@ extern byte ECCold; extern byte language; extern byte licold; extern byte MSold; +extern byte eonptyold[20]; extern byte rdsblockold; extern byte region; extern byte stationlistid;