diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 2002e4f..3bd7257 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -322,6 +322,8 @@ unsigned int LowEdgeSet; unsigned int LWHighEdgeSet; unsigned int LWLowEdgeSet; unsigned int mappedfreqold[20]; +unsigned int mappedfreqold2[20]; +unsigned int mappedfreqold3[20]; unsigned int memory[EE_PRESETS_CNT]; unsigned int MWHighEdgeSet; unsigned int MWLowEdgeSet; @@ -1772,8 +1774,8 @@ void ModeButtonPress() { BuildDisplay(); ScreensaverTimerReopen(); } else if (afscreen) { - if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2) afpagenr = 1; - if (afpagenr != 0) BuildAFScreen(); + if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2 && afpage) afpagenr = 3; else afpagenr = 1; + BuildAFScreen(); } else { if (!menu) { seek = false; diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 24a6ba4..b55d862 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -1379,43 +1379,49 @@ void TEF6686::readRDS(byte showrdserrors) offset = rds.rdsB & 0x0F; // Read offset - if (offset < 9) { - byte position; - for (position = 0; position < 20; position++) { - if (eon[position].pi == rds.rdsD) { // Find position in array - break; - } + byte position; + for (position = 0; position < 20; position++) { + if (eon[position].pi == rds.rdsD) { // Find position in array + break; } + } - if (offset < 4 && eon[position].pi == rds.rdsD) { - for (int j = 0; j < 9; j++) EONPStext[position][j] = '\0'; // Clear buffer - eon_buffer[position][(offset * 2) + 0] = rds.rdsC >> 8; // First character of segment - eon_buffer[position][(offset * 2) + 1] = rds.rdsC & 0xFF; // Second character of segment - eon_buffer[position][(offset * 2) + 2] = '\0'; // Endmarker of segment - } + if (offset < 4 && eon[position].pi == rds.rdsD) { + for (int j = 0; j < 9; j++) EONPStext[position][j] = '\0'; // Clear buffer + eon_buffer[position][(offset * 2) + 0] = rds.rdsC >> 8; // First character of segment + eon_buffer[position][(offset * 2) + 1] = rds.rdsC & 0xFF; // Second character of segment + eon_buffer[position][(offset * 2) + 2] = '\0'; // Endmarker of segment + } - if (offset > 3 && eon[position].pi == rds.rdsD) { // Last chars are received - RDScharConverter(eon_buffer[position], EONPStext[position], sizeof(EONPStext[position]) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII - String utf8String = convertToUTF8(EONPStext[position]); // Convert RDS characterset to ASCII - eon[position].ps = extractUTF8Substring(utf8String, 0, 8, true); // Make sure PS does not exceed 8 characters - for (int j = 0; j < 9; j++) eon_buffer[position][j] = '\0'; // Clear buffer - } + if (offset > 3 && eon[position].pi == rds.rdsD) { // Last chars are received + RDScharConverter(eon_buffer[position], EONPStext[position], sizeof(EONPStext[position]) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII + String utf8String = convertToUTF8(EONPStext[position]); // Convert RDS characterset to ASCII + eon[position].ps = extractUTF8Substring(utf8String, 0, 8, true); // Make sure PS does not exceed 8 characters + for (int j = 0; j < 9; j++) eon_buffer[position][j] = '\0'; // Clear buffer + } - if (offset > 4 && eon[position].pi == rds.rdsD) { - if (((rds.rdsC >> 8) * 10 + 8750) == currentfreq) { // Check if mapped frequency belongs to current frequency - if (eon[position].mappedfreq == 0) { - eon[position].mappedfreq = ((rds.rdsC & 0xFF) * 10 + 8750); // Add mapped frequency to array - } else { - if (eon[position].mappedfreq2 == 0 && eon[position].mappedfreq != (rds.rdsC & 0xFF) * 10 + 8750) { - eon[position].mappedfreq2 = ((rds.rdsC & 0xFF) * 10 + 8750); - } else if (eon[position].mappedfreq3 == 0 && eon[position].mappedfreq != (rds.rdsC & 0xFF) * 10 + 8750 && eon[position].mappedfreq2 != (rds.rdsC & 0xFF) * 10 + 8750) { - eon[position].mappedfreq3 = ((rds.rdsC & 0xFF) * 10 + 8750); - } + if (offset == 13 && eon[position].pi == rds.rdsD) { + eon[position].taset = true; + eon[position].ta = bitRead(rds.rdsC, 0); + } + + if (bitRead(rds.rdsB, 4) && eon[position].pi == rds.rdsD) eon[position].tp = true; + + if (offset > 4 && offset < 9 && eon[position].pi == rds.rdsD) { + if (((rds.rdsC >> 8) * 10 + 8750) == currentfreq) { // Check if mapped frequency belongs to current frequency + if (eon[position].mappedfreq == 0) { + eon[position].mappedfreq = ((rds.rdsC & 0xFF) * 10 + 8750); // Add mapped frequency to array + } else { + if (eon[position].mappedfreq2 == 0 && eon[position].mappedfreq != ((rds.rdsC & 0xFF) * 10 + 8750)) { + eon[position].mappedfreq2 = ((rds.rdsC & 0xFF) * 10 + 8750); + } else if (eon[position].mappedfreq2 != ((rds.rdsC & 0xFF) * 10 + 8750) && eon[position].mappedfreq != ((rds.rdsC & 0xFF) * 10 + 8750)) { + if (eon[position].mappedfreq3 == 0) eon[position].mappedfreq3 = ((rds.rdsC & 0xFF) * 10 + 8750); } } } } + for (int i = 0; i < 20; i++) { for (int j = 0; j < 20 - i - 1; j++) { if (eon[j].pi == 0) continue; @@ -1434,12 +1440,12 @@ void TEF6686::readRDS(byte showrdserrors) eon[j + 1].picode[sizeof(eon[j + 1].picode) - 1] = '\0'; std::swap(eon[j].ps, eon[j + 1].ps); - std::swap(eon[j].eonvalid, eon[j + 1].eonvalid); - std::swap(eon[j].checked, eon[j + 1].checked); + std::swap(eon[j].ta, eon[j + 1].ta); + std::swap(eon[j].tp, eon[j + 1].tp); + std::swap(eon[j].taset, eon[j + 1].taset); } } } - } } break; @@ -1512,7 +1518,9 @@ void TEF6686::clearRDS (bool fullsearchrds) { eon[i].mappedfreq = 0; eon[i].mappedfreq2 = 0; eon[i].mappedfreq3 = 0; - eon[i].checked = false; + eon[i].ta = false; + eon[i].tp = false; + eon[i].taset = false; for (int y = 0; y < 5; y++) { eon[i].picode[y] = '\0'; } diff --git a/src/TEF6686.h b/src/TEF6686.h index 0193315..6555c56 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -632,8 +632,9 @@ typedef struct _eon_ { uint16_t pi; char picode[6]; String ps; - bool eonvalid; - bool checked; + bool ta; + bool tp; + bool taset; } eon_; typedef struct _logbook_ { @@ -646,8 +647,8 @@ typedef struct _logbook_ { class TEF6686 { public: - af_ af[50]; - eon_ eon[20]; + af_ af[51]; + eon_ eon[21]; rds_ rds; logbook_ logbook[22]; uint16_t TestAF(); diff --git a/src/gui.cpp b/src/gui.cpp index 1aaf2f8..d570923 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -315,7 +315,6 @@ void BuildAFScreen() { tft.drawLine(0, 30, 320, 30, FrameColor); tft.drawLine(0, 199, 320, 199, FrameColor); tft.drawLine(0, 218, 320, 218, FrameColor); - tft.drawLine(168, 30, 168, 199, FrameColor); tft.drawLine(53, 30, 53, 0, FrameColor); tft.drawLine(89, 30, 89, 0, FrameColor); tft.drawLine(120, 30, 120, 0, FrameColor); @@ -323,8 +322,7 @@ void BuildAFScreen() { tft.drawLine(248, 30, 248, 0, FrameColor); tftPrint(-1, "kHz", 203, 4, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][93], 160, 222, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][88], 184, 48, PrimaryColor, PrimaryColorSmooth, 16); - tftPrint(-1, myLanguage[language][87], 6, 48, PrimaryColor, PrimaryColorSmooth, 16); + if (afpagenr == 1) tftPrint(-1, myLanguage[language][87], 6, 48, PrimaryColor, PrimaryColorSmooth, 16); else if (afpagenr == 2) tftPrint(-1, myLanguage[language][88], 6, 48, PrimaryColor, PrimaryColorSmooth, 16); RDSstatusold = false; ShowFreq(0); Stereostatusold = false; @@ -340,13 +338,16 @@ void BuildAFScreen() { 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++) { - std::memset(eonpicodeold[i], '\0', sizeof(eonpicodeold[i])); + mappedfreqold[i] = 0; + mappedfreqold2[i] = 0; + mappedfreqold3[i] = 0; + eonpicodeold[i][0] = '\0'; + eonpsold[i] = ""; } + for (byte i = 0; i < 20; i++) std::memset(eonpicodeold[i], '\0', sizeof(eonpicodeold[i])); - if (radio.rds.hasDABAF && radio.rds.dabaffreq != 0) tftPrint(1, "DAB: " + String(radio.rds.dabafchannel) + " (" + String(radio.rds.dabafeid) + ")", 166, 32, SecondaryColor, SecondaryColorSmooth, 16); + if (afpagenr == 1 && radio.rds.hasDABAF && radio.rds.dabaffreq != 0) tftPrint(1, "DAB: " + String(radio.rds.dabafchannel) + " (" + String(radio.rds.dabafeid) + ")", 166, 32, SecondaryColor, SecondaryColorSmooth, 16); } } @@ -590,7 +591,7 @@ void BuildAdvancedRDS() { rdsreset = true; afscreen = false; afpage = false; - afpagenr = 0; + afpagenr = 1; advancedRDS = true; ScreensaverTimerSet(OFF); if (theme == 0) { diff --git a/src/gui.h b/src/gui.h index a617125..16b3196 100644 --- a/src/gui.h +++ b/src/gui.h @@ -162,6 +162,8 @@ extern unsigned int ConverterSet; extern unsigned int HighEdgeSet; extern unsigned int LowEdgeSet; extern unsigned int mappedfreqold[20]; +extern unsigned int mappedfreqold2[20]; +extern unsigned int mappedfreqold3[20]; extern TFT_eSPI tft; extern TEF6686 radio; diff --git a/src/rds.cpp b/src/rds.cpp index 0b9477e..7b1ea00 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -621,122 +621,154 @@ void showRadioText() { } void ShowAFEON() { - if (radio.af_counter > 30 || radio.eon_counter > 9) { - if (!afpage) { - afpage = true; - afpagenr = 1; - } - } - - if (afpage) tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); - - if (radio.rds.hasAF) { - if (!hasafold) { - if (!screenmute) tftPrint(-1, myLanguage[language][87], 6, 48, BackgroundColor, BackgroundColor, 16); - if (!screenmute) tftPrint(-1, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16); - hasafold = true; + if (!screenmute) { + if (radio.eon_counter > 9) { + if (!afpage) { + afpage = true; + tftPrint(1, String(afpagenr) + "/2", 315, 222, BackgroundColor, BackgroundColor, 16); + } } - if (!(afpage && afpagenr == 2 && radio.af_updatecounter < 30)) { + if (afpage) tftPrint(1, String(afpagenr) + "/3", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); + + if (radio.rds.hasAF && afpagenr == 1) { + if (!hasafold) { + tftPrint(-1, myLanguage[language][87], 6, 48, BackgroundColor, BackgroundColor, 16); + tftPrint(-1, "AF:", 4, 32, ActiveColor, ActiveColorSmooth, 16); + hasafold = true; + } + if (af_counterold != radio.af_updatecounter) { - tft.fillRect(2, 48, 166, 150, BackgroundColor); + tft.fillRect(2, 48, 316, 150, BackgroundColor); for (byte i = 0; i < radio.af_counter; i++) { - byte x = i - (afpagenr == 2 ? 30 : 0); - if (!screenmute) { - tftPrint(-1, (radio.afmethodB && !radio.af[i].regional && radio.af[i].same) ? "S " : (radio.afmethodB && radio.af[i].regional && radio.af[i].same) ? "M " : (radio.afmethodB && radio.af[i].regional && !radio.af[i].same) ? "R " : "", 10 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), ActiveColor, ActiveColorSmooth, 16); - if (radio.af[i].checked) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16); - } else if (!radio.af[i].afvalid) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16); - } else { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), PrimaryColor, PrimaryColorSmooth, 16); - } + tftPrint(-1, (radio.afmethodB && !radio.af[i].regional && radio.af[i].same) ? "S " : (radio.afmethodB && radio.af[i].regional && radio.af[i].same) ? "M " : (radio.afmethodB && radio.af[i].regional && !radio.af[i].same) ? "R " : "", 10 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), ActiveColor, ActiveColorSmooth, 16); + if (radio.af[i].checked) { + tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16); + } else if (!radio.af[i].afvalid) { + tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16); + } else { + tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 55 + (i > 9 ? 54 : 0) + (i > 19 ? 54 : 0) + (i > 29 ? 54 : 0) + (i > 39 ? 54 : 0), 48 + (15 * i) - (i > 9 ? 150 : 0) - (i > 19 ? 150 : 0) - (i > 29 ? 150 : 0) - (i > 39 ? 150 : 0), PrimaryColor, PrimaryColorSmooth, 16); } - if (i == 29 + (afpagenr == 2 ? 30 : 0)) i = 254; } - - if (radio.af_counter > 10 + (afpagenr == 2 ? 30 : 0)) tft.drawLine(59, 54, 59, 191, SecondaryColor); - if (radio.af_counter > 20 + (afpagenr == 2 ? 30 : 0)) tft.drawLine(113, 54, 113, 191, SecondaryColor); + if (radio.af_counter > 10) tft.drawLine(59, 54, 59, 191, SecondaryColor); + if (radio.af_counter > 20) tft.drawLine(113, 54, 113, 191, SecondaryColor); + if (radio.af_counter > 30) tft.drawLine(167, 54, 167, 191, SecondaryColor); + if (radio.af_counter > 40) tft.drawLine(221, 54, 221, 191, SecondaryColor); af_counterold = radio.af_updatecounter; } } - } - if (radio.rds.hasEON) { - if (!haseonold && !screenmute) { - tftPrint(-1, myLanguage[language][88], 184, 48, BackgroundColor, BackgroundColor, 16); - tftPrint(-1, "PI:", 170, 32, ActiveColor, ActiveColorSmooth, 16); - } - haseonold = true; + 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); + haseonold = true; + } - if (!screenmute && millis() >= eonticker + 1000) { - eonticker = millis(); - byte y = 0; - if (afpagenr == 2) y = 10; - for (byte i = 0; i < radio.eon_counter; i++) { - if (strcmp(eonpicodeold[i + y], radio.eon[i + y].picode) != 0) tftPrint(-1, String(eonpicodeold[i + y]), 170, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(-1, String(radio.eon[i + y].picode), 170, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); - strcpy(eonpicodeold[i + y], radio.eon[i + y].picode); + if (millis() >= eonticker + 1000) { + eonticker = millis(); + byte y = 0; + if (afpagenr == 3) y = 10; + for (byte i = 0; i < radio.eon_counter; i++) { + if (strcmp(eonpicodeold[i + y], radio.eon[i + y].picode) != 0) tftPrint(-1, String(eonpicodeold[i + y]), 4, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + tftPrint(-1, String(radio.eon[i + y].picode), 4, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); + strcpy(eonpicodeold[i + y], radio.eon[i + y].picode); - if (radio.eon[i + y].ps.length() > 0) { - tftPrint(-1, "PS:", 206, 32, ActiveColor, ActiveColorSmooth, 16); + if (radio.eon[i + y].ps.length() > 0) { + tftPrint(-1, "PS:", 66, 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]), 206, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(-1, String(radio.eon[i + y].ps), 206, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16); - eonpsold[i + y] = radio.eon[i + y].ps; + 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); + eonpsold[i + y] = radio.eon[i + y].ps; + } else { + tftPrint(-1, String(eonpsold[i + y]), 66, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); + } + + if (radio.eon[i + y].mappedfreq > 0) { + tftPrint(1, "FREQ:", 176, 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); + 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); + } + + 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), SecondaryColor, 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); + } + + + 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); + 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); + } + + + if (radio.eon[i + y].taset) { + if (radio.eon[i + y].ta) { + tft.fillCircle(276, 54 + (15 * i), 4, InsignificantColor); + } else { + tft.fillCircle(276, 54 + (15 * i), 4, BackgroundColor); + } + } else { + tft.fillCircle(276, 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 (i == 9) i = 254; } - - if (radio.eon[i + y].mappedfreq > 0) { - tftPrint(1, "FREQ:", 316, 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), 316, 48 + (15 * i), BackgroundColor, BackgroundColor, 16); - tftPrint(1, String(radio.eon[i + y].mappedfreq / 100) + "." + String((radio.eon[i + y].mappedfreq % 100) / 10), 316, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 16); - mappedfreqold[i + y] = radio.eon[i + y].mappedfreq; - } - if (i == 9) i = 254; } } - } - if (radio.rds.hasAID) { - if (aid_counterold != radio.rds.aid_counter) { - AIDString = ""; - char id[5]; + if (radio.rds.hasAID) { + if (aid_counterold != radio.rds.aid_counter) { + AIDString = ""; + char id[5]; - for (int y = 0; y < radio.rds.aid_counter; y++) { - bool aidProcessed = false; + for (int y = 0; y < radio.rds.aid_counter; y++) { + bool aidProcessed = false; - for (int i = 0; i < 65; i++) { - if (radio.rds.aid[y] == oda_app_ids[i]) { - if (!aidProcessed) { - for (int z = 0; z < 4; z++) { - uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF; - if (nibble < 10) { - id[z] = nibble + '0'; - } else { - id[z] = nibble - 10 + 'A'; + for (int i = 0; i < 65; i++) { + if (radio.rds.aid[y] == oda_app_ids[i]) { + if (!aidProcessed) { + for (int z = 0; z < 4; z++) { + uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF; + if (nibble < 10) { + id[z] = nibble + '0'; + } else { + id[z] = nibble - 10 + 'A'; + } } + id[4] = '\0'; + + AIDString += String(id); + AIDString += ": "; + AIDString += oda_app_names[i]; + + aidProcessed = true; } - id[4] = '\0'; - - AIDString += String(id); - AIDString += ": "; - AIDString += oda_app_names[i]; - - aidProcessed = true; + break; } - break; + } + + if (!AIDString.isEmpty() && y < radio.rds.aid_counter - 1 && aidProcessed) { + AIDString += " | "; } } - - if (!AIDString.isEmpty() && y < radio.rds.aid_counter - 1 && aidProcessed) { - AIDString += " | "; - } + aid_counterold = radio.rds.aid_counter; } - aid_counterold = radio.rds.aid_counter; - } - if (!screenmute) { if (xPos == 0) { if (millis() - rttickerhold >= 2000) { xPos --; diff --git a/src/rds.h b/src/rds.h index f72ca17..44bf487 100644 --- a/src/rds.h +++ b/src/rds.h @@ -93,6 +93,8 @@ extern String stationStateold; extern String XDRGTKRDS; extern String XDRGTKRDSold; extern unsigned int mappedfreqold[20]; +extern unsigned int mappedfreqold2[20]; +extern unsigned int mappedfreqold3[20]; extern unsigned long afticker; extern unsigned long aftickerhold; extern unsigned long aftimer;