Updated AF/EON screen

First page only AF
2nd and optional 3th page only EON, including 3x Mapped freq. and TP TA flags.
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-11-09 19:50:07 +01:00
parent 6e854036da
commit 3738781457
7 changed files with 184 additions and 136 deletions

View File

@@ -322,6 +322,8 @@ unsigned int LowEdgeSet;
unsigned int LWHighEdgeSet; unsigned int LWHighEdgeSet;
unsigned int LWLowEdgeSet; unsigned int LWLowEdgeSet;
unsigned int mappedfreqold[20]; unsigned int mappedfreqold[20];
unsigned int mappedfreqold2[20];
unsigned int mappedfreqold3[20];
unsigned int memory[EE_PRESETS_CNT]; unsigned int memory[EE_PRESETS_CNT];
unsigned int MWHighEdgeSet; unsigned int MWHighEdgeSet;
unsigned int MWLowEdgeSet; unsigned int MWLowEdgeSet;
@@ -1772,8 +1774,8 @@ void ModeButtonPress() {
BuildDisplay(); BuildDisplay();
ScreensaverTimerReopen(); ScreensaverTimerReopen();
} else if (afscreen) { } else if (afscreen) {
if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2) afpagenr = 1; if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2 && afpage) afpagenr = 3; else afpagenr = 1;
if (afpagenr != 0) BuildAFScreen(); BuildAFScreen();
} else { } else {
if (!menu) { if (!menu) {
seek = false; seek = false;

View File

@@ -1379,43 +1379,49 @@ void TEF6686::readRDS(byte showrdserrors)
offset = rds.rdsB & 0x0F; // Read offset offset = rds.rdsB & 0x0F; // Read offset
if (offset < 9) { byte position;
byte position; for (position = 0; position < 20; position++) {
for (position = 0; position < 20; position++) { if (eon[position].pi == rds.rdsD) { // Find position in array
if (eon[position].pi == rds.rdsD) { // Find position in array break;
break;
}
} }
}
if (offset < 4 && eon[position].pi == rds.rdsD) { if (offset < 4 && eon[position].pi == rds.rdsD) {
for (int j = 0; j < 9; j++) EONPStext[position][j] = '\0'; // Clear buffer 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) + 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) + 1] = rds.rdsC & 0xFF; // Second character of segment
eon_buffer[position][(offset * 2) + 2] = '\0'; // Endmarker of segment eon_buffer[position][(offset * 2) + 2] = '\0'; // Endmarker of segment
} }
if (offset > 3 && eon[position].pi == rds.rdsD) { // Last chars are received 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 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 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 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 for (int j = 0; j < 9; j++) eon_buffer[position][j] = '\0'; // Clear buffer
} }
if (offset > 4 && eon[position].pi == rds.rdsD) { if (offset == 13 && eon[position].pi == rds.rdsD) {
if (((rds.rdsC >> 8) * 10 + 8750) == currentfreq) { // Check if mapped frequency belongs to current frequency eon[position].taset = true;
if (eon[position].mappedfreq == 0) { eon[position].ta = bitRead(rds.rdsC, 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) { if (bitRead(rds.rdsB, 4) && eon[position].pi == rds.rdsD) eon[position].tp = true;
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) { if (offset > 4 && offset < 9 && eon[position].pi == rds.rdsD) {
eon[position].mappedfreq3 = ((rds.rdsC & 0xFF) * 10 + 8750); 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 i = 0; i < 20; i++) {
for (int j = 0; j < 20 - i - 1; j++) { for (int j = 0; j < 20 - i - 1; j++) {
if (eon[j].pi == 0) continue; 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'; eon[j + 1].picode[sizeof(eon[j + 1].picode) - 1] = '\0';
std::swap(eon[j].ps, eon[j + 1].ps); std::swap(eon[j].ps, eon[j + 1].ps);
std::swap(eon[j].eonvalid, eon[j + 1].eonvalid); std::swap(eon[j].ta, eon[j + 1].ta);
std::swap(eon[j].checked, eon[j + 1].checked); std::swap(eon[j].tp, eon[j + 1].tp);
std::swap(eon[j].taset, eon[j + 1].taset);
} }
} }
} }
} }
} }
break; break;
@@ -1512,7 +1518,9 @@ void TEF6686::clearRDS (bool fullsearchrds) {
eon[i].mappedfreq = 0; eon[i].mappedfreq = 0;
eon[i].mappedfreq2 = 0; eon[i].mappedfreq2 = 0;
eon[i].mappedfreq3 = 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++) { for (int y = 0; y < 5; y++) {
eon[i].picode[y] = '\0'; eon[i].picode[y] = '\0';
} }

View File

@@ -632,8 +632,9 @@ typedef struct _eon_ {
uint16_t pi; uint16_t pi;
char picode[6]; char picode[6];
String ps; String ps;
bool eonvalid; bool ta;
bool checked; bool tp;
bool taset;
} eon_; } eon_;
typedef struct _logbook_ { typedef struct _logbook_ {
@@ -646,8 +647,8 @@ typedef struct _logbook_ {
class TEF6686 { class TEF6686 {
public: public:
af_ af[50]; af_ af[51];
eon_ eon[20]; eon_ eon[21];
rds_ rds; rds_ rds;
logbook_ logbook[22]; logbook_ logbook[22];
uint16_t TestAF(); uint16_t TestAF();

View File

@@ -315,7 +315,6 @@ void BuildAFScreen() {
tft.drawLine(0, 30, 320, 30, FrameColor); tft.drawLine(0, 30, 320, 30, FrameColor);
tft.drawLine(0, 199, 320, 199, FrameColor); tft.drawLine(0, 199, 320, 199, FrameColor);
tft.drawLine(0, 218, 320, 218, FrameColor); tft.drawLine(0, 218, 320, 218, FrameColor);
tft.drawLine(168, 30, 168, 199, FrameColor);
tft.drawLine(53, 30, 53, 0, FrameColor); tft.drawLine(53, 30, 53, 0, FrameColor);
tft.drawLine(89, 30, 89, 0, FrameColor); tft.drawLine(89, 30, 89, 0, FrameColor);
tft.drawLine(120, 30, 120, 0, FrameColor); tft.drawLine(120, 30, 120, 0, FrameColor);
@@ -323,8 +322,7 @@ void BuildAFScreen() {
tft.drawLine(248, 30, 248, 0, FrameColor); tft.drawLine(248, 30, 248, 0, FrameColor);
tftPrint(-1, "kHz", 203, 4, ActiveColor, ActiveColorSmooth, 28); tftPrint(-1, "kHz", 203, 4, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][93], 160, 222, ActiveColor, ActiveColorSmooth, 16); tftPrint(0, myLanguage[language][93], 160, 222, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][88], 184, 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);
tftPrint(-1, myLanguage[language][87], 6, 48, PrimaryColor, PrimaryColorSmooth, 16);
RDSstatusold = false; RDSstatusold = false;
ShowFreq(0); ShowFreq(0);
Stereostatusold = false; Stereostatusold = false;
@@ -340,13 +338,16 @@ void BuildAFScreen() {
afmethodBold = false; afmethodBold = false;
PIold = " "; PIold = " ";
PSold = " "; 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++) { 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; rdsreset = true;
afscreen = false; afscreen = false;
afpage = false; afpage = false;
afpagenr = 0; afpagenr = 1;
advancedRDS = true; advancedRDS = true;
ScreensaverTimerSet(OFF); ScreensaverTimerSet(OFF);
if (theme == 0) { if (theme == 0) {

View File

@@ -162,6 +162,8 @@ extern unsigned int ConverterSet;
extern unsigned int HighEdgeSet; extern unsigned int HighEdgeSet;
extern unsigned int LowEdgeSet; extern unsigned int LowEdgeSet;
extern unsigned int mappedfreqold[20]; extern unsigned int mappedfreqold[20];
extern unsigned int mappedfreqold2[20];
extern unsigned int mappedfreqold3[20];
extern TFT_eSPI tft; extern TFT_eSPI tft;
extern TEF6686 radio; extern TEF6686 radio;

View File

@@ -621,122 +621,154 @@ void showRadioText() {
} }
void ShowAFEON() { void ShowAFEON() {
if (radio.af_counter > 30 || radio.eon_counter > 9) { if (!screenmute) {
if (!afpage) { if (radio.eon_counter > 9) {
afpage = true; if (!afpage) {
afpagenr = 1; afpage = true;
} tftPrint(1, String(afpagenr) + "/2", 315, 222, BackgroundColor, BackgroundColor, 16);
} }
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 (!(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) { 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++) { for (byte i = 0; i < radio.af_counter; i++) {
byte x = i - (afpagenr == 2 ? 30 : 0); 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 (!screenmute) { if (radio.af[i].checked) {
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); 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);
if (radio.af[i].checked) { } 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), InsignificantColor, InsignificantColorSmooth, 16); 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 if (!radio.af[i].afvalid) { } 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), SignificantColor, SignificantColorSmooth, 16); 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);
} 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);
}
} }
if (i == 29 + (afpagenr == 2 ? 30 : 0)) i = 254;
} }
if (radio.af_counter > 10) tft.drawLine(59, 54, 59, 191, SecondaryColor);
if (radio.af_counter > 10 + (afpagenr == 2 ? 30 : 0)) tft.drawLine(59, 54, 59, 191, SecondaryColor); if (radio.af_counter > 20) tft.drawLine(113, 54, 113, 191, SecondaryColor);
if (radio.af_counter > 20 + (afpagenr == 2 ? 30 : 0)) 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; af_counterold = radio.af_updatecounter;
} }
} }
}
if (radio.rds.hasEON) { if (radio.rds.hasEON && afpagenr > 1) {
if (!haseonold && !screenmute) { if (!haseonold) {
tftPrint(-1, myLanguage[language][88], 184, 48, BackgroundColor, BackgroundColor, 16); tftPrint(-1, myLanguage[language][88], 6, 48, BackgroundColor, BackgroundColor, 16);
tftPrint(-1, "PI:", 170, 32, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "PI:", 4, 32, ActiveColor, ActiveColorSmooth, 16);
} tftPrint(0, "TA:", 276, 32, ActiveColor, ActiveColorSmooth, 16);
haseonold = true; tftPrint(0, "TP:", 302, 32, ActiveColor, ActiveColorSmooth, 16);
haseonold = true;
}
if (!screenmute && millis() >= eonticker + 1000) { if (millis() >= eonticker + 1000) {
eonticker = millis(); eonticker = millis();
byte y = 0; byte y = 0;
if (afpagenr == 2) y = 10; if (afpagenr == 3) y = 10;
for (byte i = 0; i < radio.eon_counter; i++) { 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); 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), 170, 48 + (15 * i), PrimaryColor, PrimaryColorSmooth, 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); strcpy(eonpicodeold[i + y], radio.eon[i + y].picode);
if (radio.eon[i + y].ps.length() > 0) { if (radio.eon[i + y].ps.length() > 0) {
tftPrint(-1, "PS:", 206, 32, ActiveColor, ActiveColorSmooth, 16); 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); 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), 206, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16); tftPrint(-1, String(radio.eon[i + y].ps), 66, 48 + (15 * i), SecondaryColor, SecondaryColorSmooth, 16);
eonpsold[i + y] = radio.eon[i + y].ps; 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 (radio.rds.hasAID) {
if (aid_counterold != radio.rds.aid_counter) { if (aid_counterold != radio.rds.aid_counter) {
AIDString = ""; AIDString = "";
char id[5]; char id[5];
for (int y = 0; y < radio.rds.aid_counter; y++) { for (int y = 0; y < radio.rds.aid_counter; y++) {
bool aidProcessed = false; bool aidProcessed = false;
for (int i = 0; i < 65; i++) { for (int i = 0; i < 65; i++) {
if (radio.rds.aid[y] == oda_app_ids[i]) { if (radio.rds.aid[y] == oda_app_ids[i]) {
if (!aidProcessed) { if (!aidProcessed) {
for (int z = 0; z < 4; z++) { for (int z = 0; z < 4; z++) {
uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF; uint8_t nibble = (radio.rds.aid[y] >> (4 * (3 - z))) & 0xF;
if (nibble < 10) { if (nibble < 10) {
id[z] = nibble + '0'; id[z] = nibble + '0';
} else { } else {
id[z] = nibble - 10 + 'A'; id[z] = nibble - 10 + 'A';
}
} }
id[4] = '\0';
AIDString += String(id);
AIDString += ": ";
AIDString += oda_app_names[i];
aidProcessed = true;
} }
id[4] = '\0'; break;
AIDString += String(id);
AIDString += ": ";
AIDString += oda_app_names[i];
aidProcessed = true;
} }
break; }
if (!AIDString.isEmpty() && y < radio.rds.aid_counter - 1 && aidProcessed) {
AIDString += " | ";
} }
} }
aid_counterold = radio.rds.aid_counter;
if (!AIDString.isEmpty() && y < radio.rds.aid_counter - 1 && aidProcessed) {
AIDString += " | ";
}
} }
aid_counterold = radio.rds.aid_counter;
}
if (!screenmute) {
if (xPos == 0) { if (xPos == 0) {
if (millis() - rttickerhold >= 2000) { if (millis() - rttickerhold >= 2000) {
xPos --; xPos --;

View File

@@ -93,6 +93,8 @@ extern String stationStateold;
extern String XDRGTKRDS; extern String XDRGTKRDS;
extern String XDRGTKRDSold; extern String XDRGTKRDSold;
extern unsigned int mappedfreqold[20]; extern unsigned int mappedfreqold[20];
extern unsigned int mappedfreqold2[20];
extern unsigned int mappedfreqold3[20];
extern unsigned long afticker; extern unsigned long afticker;
extern unsigned long aftickerhold; extern unsigned long aftickerhold;
extern unsigned long aftimer; extern unsigned long aftimer;