From c5350b38606c5a6cd0cef75f1d196418a43b29de Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Mon, 14 Aug 2023 20:30:38 +0200 Subject: [PATCH] Bugfixes - Show PI errors is fixed - RDS error detector fixed - Battery indicator fixed - Regional AF's now have a leading 'r' - Edge beep on SW bands added - Beep on boot only when edge beep is enabled - Added Stationlist ID, this is used for identification in Stationlist log - Code optimalisation --- TEF6686_ESP32.ino | 72 ++++++++++++++++++++++++++--------------------- src/TEF6686.cpp | 28 ++++++++++++------ src/TEF6686.h | 3 +- src/constants.h | 5 ++-- src/gui.cpp | 31 ++++++++++++++++---- src/gui.h | 3 +- src/language.h | 50 +++++++++++++++++++++----------- src/rds.cpp | 16 +++++------ src/rds.h | 2 +- 9 files changed, 134 insertions(+), 76 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index bad3fbb..78b060d 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -52,6 +52,8 @@ bool afscreen; bool aftest; bool artheadold; bool batterydetect = true; +bool beepresetstart; +bool beepresetstop; bool BWreset; bool change2; bool compressedold; @@ -156,6 +158,7 @@ byte screensaverset; byte showmodulation; byte showSWMIBand; byte submenu; +byte stationlistid; byte nowToggleSWMIBand = 1; byte stepsize; byte StereoLevel; @@ -166,7 +169,7 @@ byte tunemode; byte unit; char buff[16]; char programTypePrevious[18]; -char radioIdPrevious[6]; +char radioIdPrevious[7]; const uint8_t* currentFont = nullptr; float vPerold; int ActiveColor; @@ -406,6 +409,7 @@ void setup() { amcodect = EEPROM.readByte(EE_BYTE_AM_CO_DECT); amcodectcount = EEPROM.readByte(EE_BYTE_AM_CO_DECT_COUNT); radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF); + stationlistid = EEPROM.readByte(EE_BYTE_STATIONLISTID); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; // later will read from flash LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; // later will read from flash @@ -654,7 +658,7 @@ void setup() { SelectBand(); setupmode = false; - radio.tone(50, -5, 2000); + if (edgebeep) radio.tone(50, -5, 2000); if (screensaverset) { ScreensaverTimerInit(); @@ -665,7 +669,7 @@ void setup() { void loop() { if (digitalRead(BANDBUTTON) == LOW ) BANDBUTTONPress(); - if (power) { + if (power || poweroptions == DEEP_SLEEP) { if (millis() >= tuningtimer + 200) Communication(); if (!menu && !afscreen) { @@ -851,7 +855,9 @@ void loop() { } } } - } else { + } + + if (!power) { if (rotary == -1) { if (!touchrotating) { rotary = 0; @@ -1784,6 +1790,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_AM_CO_DECT, amcodect); EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, amcodectcount); EEPROM.writeByte(EE_BYTE_SORTAF, radio.rds.sortaf); + EEPROM.writeByte(EE_BYTE_STATIONLISTID, stationlistid); EEPROM.commit(); Serial.end(); if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); @@ -2128,7 +2135,6 @@ void ShowFreq(int mode) { DivdeSWMIBand(); updateSWMIBand(); } - } else { unsigned int freq = 0; if (band == BAND_FM) freq = frequency + ConverterSet * 100; @@ -2147,7 +2153,7 @@ void ShowFreq(int mode) { sprite1.setTextColor(PrimaryColor, PrimaryColorSmooth, false); sprite1.drawString(String(freq / 100) + "." + (freq % 100 < 10 ? "0" : "") + String(freq % 100) + " ", 218, -6); sprite1.pushSprite(46, 46); - // freqold = freq; + freqold = freq; } else if (mode == 1) { sprite1.fillSprite(BackgroundColor); sprite1.pushSprite(46, 46); @@ -2168,21 +2174,18 @@ void ShowFreq(int mode) { sprite.fillSprite(BackgroundColor); sprite2.fillSprite(BackgroundColor); if (advancedRDS) sprite2.pushSprite(35, 220); else if (!afscreen) sprite.pushSprite(38, 220); + } - if (wifi) { - String stationprint; - stationprint = "from=TEF_tuner;RcvLevel="; - stationprint += String(SStatus / 10); - stationprint += ";bandwidth=-1;freq="; - if (band > BAND_GAP) { - stationprint += String(frequency_AM) + "000"; - } else { - stationprint += String(band == BAND_FM ? frequency : frequency_OIRT) + "0000"; - } - Udp.beginPacket(remoteip, 9030); - Udp.print(stationprint); - Udp.endPacket(); + if (wifi) { + Udp.beginPacket(remoteip, 9030); + if (band == BAND_FM) { + Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency) + "0000"); + } else if (band == BAND_OIRT) { + Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency_OIRT) + "0000"); + } else { + Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10) + ";bandwidth=-1;freq=" + String(frequency_AM) + "000"); } + Udp.endPacket(); } tuningtimer = millis(); } @@ -2249,8 +2252,7 @@ void ShowSignalLevel() { } if (wifi) { Udp.beginPacket(remoteip, 9030); - Udp.print("from=TEF_tuner;RcvLevel="); - Udp.print(String(SStatus / 10)); + Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RcvLevel=" + String(SStatus / 10)); Udp.endPacket(); } } @@ -2400,8 +2402,7 @@ void ShowBW() { BWreset = false; if (wifi) { Udp.beginPacket(remoteip, 9030); - Udp.print("from=TEF_tuner;bandwidth="); - Udp.print(String(BW * 1000)); + Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";bandwidth=" + String(BW * 1000)); Udp.endPacket(); } } @@ -2610,12 +2611,20 @@ void updateSWMIBand() { case SW_MI_BAND_90M: case SW_MI_BAND_120M: case SW_MI_BAND_160M: - tftReplace(-1, SWMIBandstringold, SWMIBandstring, 50, 51, SecondaryColor, SecondaryColorSmooth, 16); - if (!SWMIBandstring.equals(SWMIBandstringold)) SWMIBandstringold = SWMIBandstring; + tftPrint(-1, SWMIBandstring, 50, 51, SecondaryColor, SecondaryColorSmooth, 16); + beepresetstart = true; + if (edgebeep && beepresetstop) { + EdgeBeeper(); + beepresetstop = false; + } break; case SW_MI_BAND_GAP: - tftPrint(-1, SWMIBandstringold, 50, 51, BackgroundColor, BackgroundColor, 16); + beepresetstop = true; + if (edgebeep && beepresetstart) { + EdgeBeeper(); + beepresetstart = false; + } break; } } @@ -2813,15 +2822,14 @@ void ShowBattery() { if (!wifi && batterydetect) { float batteryV = constrain((((float)v / 4095.0) * 3.3 * (1100 / 1000.0) * 2.0), 0.0, 5.0); - float vPer = constrain((batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE), 0.0, 1.0) * 100; + float vPer = constrain((batteryV - BATTERY_LOW_VALUE) / (BATTERY_FULL_VALUE - BATTERY_LOW_VALUE), 0.0, 0.99) * 100; if (abs(batteryV - batteryVold) > 0.05 && batteryoptions == BATTERY_VALUE) { - batteryVold = batteryV; tftReplace(-1, String(batteryVold, 1) + "V", String(batteryV, 1) + "V", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); + batteryVold = batteryV; } else if (int(vPer) != int(vPerold) && batteryoptions == BATTERY_PERCENT && abs(vPer - vPerold) > 0.5) { - vPerold = vPer; - if (vPer > 99.0) vPer = 99.0; tftReplace(-1, String(vPerold, 0) + "%", String(vPer, 0) + "%", 279, 9, BatteryValueColor, BatteryValueColorSmooth, 16); + vPerold = vPer; } } } @@ -2982,9 +2990,8 @@ void TuneDown() { } void EdgeBeeper() { - bool x = radio.mute; radio.tone(50, -5, 2000); - if (x) { + if (radio.mute) { radio.setMute(); if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor); } else { @@ -3152,6 +3159,7 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_AM_CO_DECT, 100); EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, 3); EEPROM.writeByte(EE_BYTE_SORTAF, 1); + EEPROM.writeByte(EE_BYTE_STATIONLISTID, 1); EEPROM.commit(); } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 4e777ed..5feaca0 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -373,10 +373,10 @@ void TEF6686::readRDS(bool showrdserrors) if (rds.rdsB != rdsBprevious) { rds.correct = false; - rds.rdsAerror = ((((rds.rdsErr >> 14) & 0x03) == 0x02) || (((rds.rdsErr >> 14) & 0x03) == 0x03)); - rds.rdsBerror = ((((rds.rdsErr >> 12) & 0x03) == 0x02) || (((rds.rdsErr >> 12) & 0x03) == 0x03)); - rds.rdsCerror = ((((rds.rdsErr >> 10) & 0x03) == 0x02) || (((rds.rdsErr >> 10) & 0x03) == 0x03)); - rds.rdsDerror = ((((rds.rdsErr >> 8) & 0x03) == 0x02) || (((rds.rdsErr >> 8) & 0x03) == 0x03)); + rds.rdsAerror = (((rds.rdsErr >> 14) & 0x03) > 1); + rds.rdsBerror = (((rds.rdsErr >> 12) & 0x03) > 1); + rds.rdsCerror = (((rds.rdsErr >> 10) & 0x03) > 1); + rds.rdsDerror = (((rds.rdsErr >> 8) & 0x03) > 1); if (!rds.rdsAerror && !rds.rdsBerror && !rds.rdsCerror && !rds.rdsDerror) rds.correct = true; // Any errors in all blocks? if ((rdsStat & (1 << 15))) rdsReady = true; @@ -405,8 +405,15 @@ void TEF6686::readRDS(bool showrdserrors) } } - if (((rds.rdsErr >> 14) & 0x02) > 2) rds.picode[5] = '?'; - if (((rds.rdsErr >> 14) & 0x01) > 1) rds.picode[4] = '?'; else rds.picode[4] = ' '; // Not sure, add a ? + if (rds.correct) errorfreepi = true; + +if (!errorfreepi) { + if (((rds.rdsErr >> 14) & 0x03) > 2) rds.picode[5] = '?'; else rds.picode[5] = ' '; + if (((rds.rdsErr >> 14) & 0x03) > 1) rds.picode[4] = '?'; else rds.picode[4] = ' '; // Not sure, add a ? +} else { + rds.picode[4] = ' '; + rds.picode[5] = ' '; +} rds.picode[6] = '\0'; if (strncmp(rds.picode, "0000", 4) == 0) { if (piold != 0) { @@ -422,6 +429,10 @@ void TEF6686::readRDS(bool showrdserrors) } } } else { + if (rds.stationName.length() == 0) { + memset(rds.picode, 0, sizeof(rds.picode)); + } + memset(rds.picode, 0, sizeof(rds.picode)); } } @@ -536,7 +547,7 @@ void TEF6686::readRDS(bool showrdserrors) if (!isValuePresent) { af[af_counter].frequency = buffer0; - if (buffer1 == currentfreq && buffer0 > buffer1) af[af_counter].regional = true; + if (buffer1 == currentfreq && buffer0 > buffer1) af[af_counter].regional = true; if (af_counter < 50) af_counter++; } @@ -550,7 +561,7 @@ void TEF6686::readRDS(bool showrdserrors) if (!isValuePresent) { af[af_counter].frequency = buffer1; - if (buffer0 == currentfreq && buffer0 < buffer1) af[af_counter].regional = true; + if (buffer0 == currentfreq && buffer0 < buffer1) af[af_counter].regional = true; if (af_counter < 50) af_counter++; } @@ -963,6 +974,7 @@ void TEF6686::clearRDS (bool fullsearchrds) rds.rdsplusTag1 = 169; rds.rdsplusTag2 = 169; afinit = false; + errorfreepi = false; } void TEF6686::tone(uint16_t time, int16_t amplitude, uint16_t frequency) { diff --git a/src/TEF6686.h b/src/TEF6686.h index 22f6b76..8187c0c 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -287,7 +287,8 @@ class TEF6686 { bool runningbit; bool initrt; bool initab; - bool afinit; + bool afinit; + bool errorfreepi; }; #endif \ No newline at end of file diff --git a/src/constants.h b/src/constants.h index 34de22b..01d2c30 100644 --- a/src/constants.h +++ b/src/constants.h @@ -117,8 +117,9 @@ #define EE_BYTE_HIGHCUTLEVEL 22 #define EE_BYTE_HIGHCUTOFFSET 23 #define EE_BYTE_LEVELOFFSET 24 -#define EE_BYTE_RTBUFFER 25 -#define EE_BYTE_SORTAF 26 +#define EE_BYTE_RTBUFFER 25 +#define EE_BYTE_SORTAF 26 +#define EE_BYTE_STATIONLISTID 27 #define EE_BYTE_EDGEBEEP 28 #define EE_BYTE_SOFTMUTEAM 29 #define EE_BYTE_SOFTMUTEFM 30 diff --git a/src/gui.cpp b/src/gui.cpp index 61ddc3b..050c633 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -6,7 +6,7 @@ #include byte menuitem; -byte items[8] = {8, 2, 6, 9, 8, 9, 7, 4}; +byte items[8] = {8, 2, 6, 9, 8, 9, 7, 5}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -456,7 +456,7 @@ void BuildMenu() { tftPrint(-1, myLanguage[language][61], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][99], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][176], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); - tftPrint(-1, myLanguage[language][196], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][196], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); if (showrdserrors) tftPrint(1, myLanguage[language][42], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (region == 0) tftPrint(1, myLanguage[language][47], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); @@ -466,7 +466,7 @@ void BuildMenu() { if (radio.rds.pierrors) tftPrint(1, myLanguage[language][42], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (af) tftPrint(1, myLanguage[language][42], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (radio.rds.rtbuffer) tftPrint(1, myLanguage[language][42], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); - if (radio.rds.sortaf) tftPrint(1, myLanguage[language][42], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); + if (radio.rds.sortaf) tftPrint(1, myLanguage[language][42], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; case FMSETTINGS: @@ -540,11 +540,13 @@ void BuildMenu() { if (wifi) tftPrint(-1, String(myLanguage[language][51]) + " IP: " + String(WiFi.localIP().toString()), 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(-1, myLanguage[language][51], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][52], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, myLanguage[language][58], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16); + tftPrint(-1, myLanguage[language][197], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16); if (USBmode) tftPrint(1, "RDS Spy", 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, "XDRGTK", 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); if (wifi) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, ">", 310, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); tftPrint(1, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); + tftPrint(1, String(stationlistid, DEC), 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; } @@ -1055,7 +1057,7 @@ void MenuUp() { if (radio.rds.rtbuffer) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; - case ITEM8: + case ITEM8: if (radio.rds.sortaf) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); if (radio.rds.sortaf) radio.rds.sortaf = false; else radio.rds.sortaf = true; if (radio.rds.sortaf) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); @@ -1254,6 +1256,13 @@ void MenuUp() { if (subnetclient > 254) subnetclient = 1; tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM5: + tftPrint(0, String(stationlistid, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); + stationlistid ++; + if (stationlistid > 10) stationlistid = 1; + tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } @@ -1716,6 +1725,13 @@ void MenuDown() { if (subnetclient < 1) subnetclient = 254; tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM5: + tftPrint(0, String(stationlistid, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); + stationlistid --; + if (stationlistid == 0) stationlistid = 10; + tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } @@ -2116,7 +2132,7 @@ void DoMenu() { EEPROM.commit(); tryWiFi(); delay(2000); - menuopen = false; + menuopen = false; BuildMenu(); } break; @@ -2124,6 +2140,11 @@ void DoMenu() { tftPrint(0, myLanguage[language][58], 155, 78, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(subnetclient, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break; + + case ITEM5: + tftPrint(0, myLanguage[language][197], 155, 78, ActiveColor, ActiveColorSmooth, 28); + tftPrint(0, String(stationlistid, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; } diff --git a/src/gui.h b/src/gui.h index 4c6044f..35e33c2 100644 --- a/src/gui.h +++ b/src/gui.h @@ -95,6 +95,7 @@ extern byte screensaverOptions[5]; extern byte screensaverset; extern byte showmodulation; extern byte showSWMIBand; +extern byte stationlistid; extern int8_t CNold; extern byte StereoLevel; extern byte StereoLevel; @@ -104,7 +105,7 @@ extern byte theme; extern byte touchrotating; extern byte unit; extern char programTypePrevious[18]; -extern char radioIdPrevious[6]; +extern char radioIdPrevious[7]; extern float batteryVold; extern float vPerold; extern int ActiveColor; diff --git a/src/language.h b/src/language.h index 9578ff5..e14b539 100644 --- a/src/language.h +++ b/src/language.h @@ -1,6 +1,6 @@ // [number of languages][number of texts] -static const char* const myLanguage[16][197] = { +static const char* const myLanguage[16][198] = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -197,7 +197,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Nederlands", // Dutch @@ -396,7 +397,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "VERBIND", // 195 - "Auto AF sorteren" // 196 + "Auto AF sorteren", // 196 + "Stationlist ID" // 197 }, { "Polski", // Polish @@ -595,7 +597,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "LACZNOSC", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Hrvatski", // Croatian @@ -794,7 +797,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Ελληνικά", // Greek @@ -993,7 +997,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "ΣΥΝΔΕΣΗ", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Romana", // Romanian @@ -1192,7 +1197,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Deutsch", // German @@ -1391,7 +1397,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Czech", // Czech @@ -1590,7 +1597,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Slovak", // Slovak @@ -1789,7 +1797,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Français", // French @@ -1988,7 +1997,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Български", // Bulgarian @@ -2187,7 +2197,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Русский", // Russian @@ -2386,7 +2397,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "ПОДКЛЮЧЕНИЕ", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Українська", // Ukranian @@ -2585,7 +2597,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "ПІДКЛЮЧЕННЯ", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Italiano", // Italian @@ -2784,7 +2797,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Simplified Chinese", // Simplified Chinese @@ -2983,7 +2997,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "CONNECT", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 }, { "Norsk", // Norwegian @@ -3182,7 +3197,8 @@ static const char* const myLanguage[16][197] = { "FM", // 193 "AM", // 194 "TILKOBLE", // 195 - "Auto sort AF" // 196 + "Auto sort AF", // 196 + "Stationlist ID" // 197 } }; diff --git a/src/rds.cpp b/src/rds.cpp index 39e19d7..b1b00e3 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -317,7 +317,7 @@ void showECC() { if (radio.rds.ECC == 164) ECC = myCountries[132]; if (radio.rds.ECC == 208) ECC = myCountries[112]; if (radio.rds.ECC == 209) ECC = myCountries[119]; - if (radio.rds.ECC == 210) ECC = myCountries[72]; + if (radio.rds.ECC == 210) ECC = myCountries[72]; if (radio.rds.ECC == 211) ECC = myCountries[92]; if (radio.rds.ECC == 224) ECC = myCountries[9]; if (radio.rds.ECC == 225) ECC = myCountries[10]; @@ -432,9 +432,9 @@ void showECC() { if (radio.rds.ECC == 208) ECC = myCountries[85]; if (radio.rds.ECC == 209) ECC = myCountries[97]; if (radio.rds.ECC == 210) ECC = myCountries[121]; - if (radio.rds.ECC == 211) ECC = myCountries[70]; + if (radio.rds.ECC == 211) ECC = myCountries[70]; if (radio.rds.ECC == 212) ECC = myCountries[86]; - if (radio.rds.ECC == 224) ECC = myCountries[38]; + if (radio.rds.ECC == 224) ECC = myCountries[38]; if (radio.rds.ECC == 225) ECC = myCountries[39]; if (radio.rds.ECC == 226) ECC = myCountries[40]; if (radio.rds.ECC == 227) ECC = myCountries[41]; @@ -533,7 +533,7 @@ void showECC() { if (radio.rds.ECC == 240) ECC = myCountries[202]; if (radio.rds.ECC == 241) ECC = myCountries[192]; if (radio.rds.ECC == 242) ECC = myCountries[220]; - if (radio.rds.ECC == 243) ECC = myCountries[71]; + if (radio.rds.ECC == 243) ECC = myCountries[71]; } else { ECC = myLanguage[language][73]; } @@ -777,13 +777,11 @@ void ShowAFEON() { for (byte i = 0; i < radio.af_counter; i++) { byte x = i - (afpagenr == 2 ? 30 : 0); if (radio.af[i].checked) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16); + tftPrint(1, (radio.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (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), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16); - } else if (radio.af[i].regional) { - tftPrint(1, String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SecondaryColor, SecondaryColorSmooth, 16); + tftPrint(1, (radio.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (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), 50 + (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.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (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; } diff --git a/src/rds.h b/src/rds.h index 3d3245b..11b185e 100644 --- a/src/rds.h +++ b/src/rds.h @@ -45,7 +45,7 @@ extern byte licold; extern byte MSold; extern byte rdsblockold; extern char programTypePrevious[18]; -extern char radioIdPrevious[6]; +extern char radioIdPrevious[7]; extern int ActiveColor; extern int ActiveColorSmooth; extern int BackgroundColor;