diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 585329a..7d4dd9f 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -174,6 +174,7 @@ byte unit; byte spispeed; byte spispeedold; char buff[16]; +char eonpicodeold[20][6]; char programTypePrevious[18]; char radioIdPrevious[7]; const uint8_t* currentFont = nullptr; @@ -252,7 +253,7 @@ String AIDString; String cryptedpassword; String CurrentThemeString; String ECColdtxt; -String eonpsold[11]; +String eonpsold[20]; String eonstringold; String LIColdString; String pinstringold; diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 286fdb9..4b05d7b 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -527,9 +527,9 @@ void TEF6686::readRDS(byte showrdserrors) if (rdsblock == 0 && rds.rdsC != rdsCold) { // Only when in GROUP 0A if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250) { - afinit = true; // AF detected - rds.hasAF = true; - } + afinit = true; // AF detected + rds.hasAF = true; + } if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250 && ((rds.rdsC & 0xFF) * 10 + 8750) == currentfreq && rds.hasAF && afmethodBtrigger) { afmethodB = true; // Check for AF method B @@ -1240,7 +1240,7 @@ void TEF6686::readRDS(byte showrdserrors) bool isValuePresent = false; for (int i = 0; i < 20; i++) { - if (eon[i].pi == rds.rdsD) { // Check if EON is already in array + if (eon[i].pi == rds.rdsD || rds.rdsA == rds.rdsD) { // Check if EON is already in array isValuePresent = true; break; } diff --git a/src/TEF6686.h b/src/TEF6686.h index c7c209f..3d4abcd 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -712,6 +712,6 @@ class TEF6686 { uint16_t rdsCold; uint8_t af_counterb; uint8_t af_counterbcheck; - bool afmethodBtrigger; + bool afmethodBtrigger; }; #endif \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp index 8cc48ad..d653c2d 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -335,7 +335,6 @@ void BuildAFScreen() { 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); - for (byte i = 0; i < 20; i++) mappedfreqold[i] = 0; RDSstatusold = false; ShowFreq(0); Stereostatusold = false; @@ -351,7 +350,9 @@ void BuildAFScreen() { strcpy(radioIdPrevious, ""); programServicePrevious = ""; afmethodBold = false; - for (byte i = 0; i < 11; 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++) eonpicodeold[0][i] = '\0'; } } diff --git a/src/gui.h b/src/gui.h index 67c6f38..c2cf6fd 100644 --- a/src/gui.h +++ b/src/gui.h @@ -107,6 +107,7 @@ extern byte touchrotating; extern byte unit; extern byte spispeed; extern byte spispeedold; +extern char eonpicodeold[20][6]; extern char programTypePrevious[18]; extern char radioIdPrevious[7]; extern float batteryVold; @@ -147,7 +148,7 @@ extern int8_t LowLevelSet; extern int8_t VolSet; extern String afstringold; extern String CurrentThemeString; -extern String eonpsold[11]; +extern String eonpsold[20]; extern String eonstringold; extern String pinstringold; extern String programServicePrevious; diff --git a/src/rds.cpp b/src/rds.cpp index 033179b..82af4a3 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -381,7 +381,7 @@ void readRds() { void showPI() { if (strcmp(radio.rds.picode, radioIdPrevious)) { - if (!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 (advancedRDS) { if (region == REGION_EU) tftReplace(0, PIold, radio.rds.picode, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); @@ -553,6 +553,15 @@ 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, 54, BackgroundColor, BackgroundColor, 16); @@ -560,16 +569,7 @@ void ShowAFEON() { hasafold = true; } - if (radio.af_counter > 30 || radio.eon_counter > 9) { - if (!afpage) { - afpage = true; - afpagenr = 1; - } - } else { - afpagenr = 0; - } - - if (af_counterold != radio.af_updatecounter) { + if (af_counterold != radio.af_updatecounter && (afpage != 2 && radio.af_counter < 31)) { tft.fillRect(2, 48, 166, 150, BackgroundColor); for (byte i = 0; i < radio.af_counter; i++) { byte x = i - (afpagenr == 2 ? 30 : 0); @@ -588,7 +588,6 @@ void ShowAFEON() { 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 (afpage && !screenmute) tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); af_counterold = radio.af_updatecounter; } } @@ -605,21 +604,22 @@ void ShowAFEON() { 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 (radio.eon[i + y].ps.length() > 0) { tftPrint(-1, "PS:", 206, 32, ActiveColor, ActiveColorSmooth, 16); - if (radio.eon[i + y].ps != eonpsold[i + y]) { - tftPrint(-1, String(eonpsold[i + y]), 206, 48 + (15 * i), BackgroundColor, BackgroundColor, 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]), 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 (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); - } + + 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; } diff --git a/src/rds.h b/src/rds.h index a9566e4..4cbd3b2 100644 --- a/src/rds.h +++ b/src/rds.h @@ -46,6 +46,7 @@ extern byte MSold; extern byte rdsblockold; extern byte region; extern byte stationlistid; +extern char eonpicodeold[20][6]; extern char programTypePrevious[18]; extern char radioIdPrevious[7]; extern int ActiveColor; @@ -71,7 +72,7 @@ extern IPAddress remoteip; extern String afstringold; extern String AIDString; extern String ECColdtxt; -extern String eonpsold[11]; +extern String eonpsold[20]; extern String eonstringold; extern String LIColdString; extern String pinstringold;