From 29b2f79a565c5779c7cd87d48dc77548df4352a8 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Thu, 12 Oct 2023 12:11:40 +0200 Subject: [PATCH] Added Fast PS When enabled: When tuning to a new station PS is shown immediately. After two complete PS cycles normal PS detection is activated. This can cause incompete or faulty PS direct after tuning, which will recover. Disabled: After two complete PS cycles the PS is shown. This can take some longer time to show PS but will prevent errors as much as possible. In previous builds fast PS was already enabled, but can now be disabled if wanted. Also a small fix: when RDS is lost and level drops below low level threshold, the textcolor was not changed. --- TEF6686_ESP32.ino | 7 ++--- src/TEF6686.cpp | 53 +++++++++++++++++++++--------------- src/TEF6686.h | 11 ++++---- src/constants.h | 9 +++---- src/gui.cpp | 25 ++++++++++++++--- src/language.h | 54 ++++++++++++++++++++++++------------- src/rds.cpp | 68 ++++++++++++++++++++++------------------------- 7 files changed, 135 insertions(+), 92 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 95a9221..85bf2e5 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -56,7 +56,6 @@ bool beepresetstop; bool BWreset; bool change2; bool compressedold; -bool clearrds; bool direction; bool dropout; bool dynamicPTYold; @@ -424,6 +423,7 @@ void setup() { BWsetFM = EEPROM.readByte(EE_BYTE_BWSET_FM); BWsetAM = EEPROM.readByte(EE_BYTE_BWSET_AM); nowToggleSWMIBand = EEPROM.readByte(EE_BYTE_BANDAUTOSW); + radio.rds.fastps = EEPROM.readByte(EE_BYTE_FASTPS); LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN; LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX; @@ -811,7 +811,7 @@ void loop() { radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, CN); } } - if (screenmute) readRds(); + if (screenmute || radio.rds.correctPI != 0) readRds(); if (!menu) { doSquelch(); GetData(); @@ -1844,6 +1844,7 @@ void ModeButtonPress() { EEPROM.writeByte(EE_BYTE_SORTAF, radio.rds.sortaf); EEPROM.writeByte(EE_BYTE_STATIONLISTID, stationlistid); EEPROM.writeByte(EE_BYTE_FM_DEEMPHASIS, fmdeemphasis); + EEPROM.writeByte(EE_BYTE_FASTPS, radio.rds.fastps); EEPROM.commit(); Serial.end(); if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); @@ -2263,7 +2264,6 @@ void ShowFreq(int mode) { afstringold = ""; rds_clockold = ""; rdsreset = true; - clearrds = true; licold = 254; ECCold = 253; @@ -3289,6 +3289,7 @@ void DefaultSettings(byte userhardwaremodel) { EEPROM.writeByte(EE_BYTE_BWSET_FM, 0); EEPROM.writeByte(EE_BYTE_BWSET_AM, 2); EEPROM.writeByte(EE_BYTE_BANDAUTOSW, 0); + EEPROM.writeByte(EE_BYTE_FASTPS, 1); EEPROM.commit(); } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 75e959e..604f594 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -4,6 +4,8 @@ #include // https://github.com/PaulStoffregen/Time unsigned long rdstimer = 0; +unsigned long bitStartTime = 0; +bool lastBitState = false; void TEF6686::TestAFEON() { uint16_t status; @@ -358,7 +360,16 @@ void TEF6686::readRDS(byte showrdserrors) } } - if (highByte(rds.rdsErr) != 0xff) rds.hasRDS = true; else rds.hasRDS = false; // RDS decoder synchronized and data available + if (highByte(rds.rdsErr) != 0xff) { + rds.hasRDS = true; // RDS decoder synchronized and data available + bitStartTime = 0; + } else { + if (bitStartTime == 0) { + bitStartTime = millis(); + } else if (millis() - bitStartTime >= 87) { + rds.hasRDS = false; + } + } rds.rdsAerror = (((rds.rdsErr >> 14) & 0x03) > 0); rds.rdsBerror = (((rds.rdsErr >> 12) & 0x03) > 0); @@ -370,7 +381,7 @@ void TEF6686::readRDS(byte showrdserrors) rdsCerrorThreshold = (((rds.rdsErr >> 10) & 0x03) > showrdserrors); rdsDerrorThreshold = (((rds.rdsErr >> 8) & 0x03) > showrdserrors); - if (bitRead(rds.rdsStat, 9)) { // We have all data to decode... let's go... + if (bitRead(rds.rdsStat, 9)) { // We have all data to decode... let's go... //PI decoder if (!rdsAerrorThreshold && afreset) { @@ -387,9 +398,9 @@ void TEF6686::readRDS(byte showrdserrors) rds.picode[3] = rds.rdsA & 0xF; for (int i = 0; i < 4; i++) { if (rds.picode[i] < 10) { - rds.picode[i] += '0'; // Add ASCII offset for decimal digits + rds.picode[i] += '0'; // Add ASCII offset for decimal digits } else { - rds.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F + rds.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F } } } @@ -398,7 +409,7 @@ void TEF6686::readRDS(byte showrdserrors) 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 ? + if (((rds.rdsErr >> 14) & 0x03) > 1) rds.picode[4] = '?'; else rds.picode[4] = ' '; // Not sure, add a ? } else { rds.picode[4] = ' '; rds.picode[5] = ' '; @@ -412,9 +423,9 @@ void TEF6686::readRDS(byte showrdserrors) rds.picode[3] = piold & 0xF; for (int i = 0; i < 4; i++) { if (rds.picode[i] < 10) { - rds.picode[i] += '0'; // Add ASCII offset for decimal digits + rds.picode[i] += '0'; // Add ASCII offset for decimal digits } else { - rds.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F + rds.picode[i] += 'A' - 10; // Add ASCII offset for hexadecimal letters A-F } } } else { @@ -428,7 +439,7 @@ void TEF6686::readRDS(byte showrdserrors) } // USA Station callsign decoder - if (rds.region == 1) { // When ID was decoded correctly before, no need to decode again. + if (rds.region == 1) { // When ID was decoded correctly before, no need to decode again. uint16_t stationID = rds.rdsA; if (stationID > 4096) { if (stationID > 21671 && (stationID & 0xF00U) >> 8 == 0) stationID = ((uint16_t)uint8_t(0xA0 + ((stationID & 0xF000U) >> 12)) << 8) + lowByte(stationID); // C0DE -> ACDE @@ -455,7 +466,7 @@ void TEF6686::readRDS(byte 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.rdsErr >> 14) & 0x01) > 1) rds.picode[4] = '?'; else rds.picode[4] = ' '; // Not sure, add a ? rds.picode[6] = '\0'; } @@ -476,7 +487,7 @@ void TEF6686::readRDS(byte showrdserrors) ps_buffer[(offset * 2) + 1] = rds.rdsD & 0xFF; // Second character of segment ps_buffer[8] = '\0'; // Endmarker - if (offset == 3 && ps_process) { // Last chars are received + if (offset == 3 && (ps_process || !rds.fastps)) { // Last chars are received if (strcmp(ps_buffer, ps_buffer2) == 0) { // When no difference between current and buffer, let's go... RDScharConverter(ps_buffer2, PStext, sizeof(PStext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII String utf8String = convertToUTF8(PStext); // Convert RDS characterset to ASCII @@ -484,7 +495,7 @@ void TEF6686::readRDS(byte showrdserrors) } } - if (!ps_process) { // Let's get 2 runs of 8 PS characters fast and without refresh + if (!ps_process && rds.fastps) { // Let's get 2 runs of 8 PS characters fast and without refresh if (offset == 0) packet0 = true; if (offset == 1) packet1 = true; if (offset == 2) packet2 = true; @@ -629,10 +640,10 @@ void TEF6686::readRDS(byte showrdserrors) if (rds.rtAB != rtABold) { // Erase old RT, because of AB change initrt = false; if (rds.rtbuffer) { - wchar_t RTtext[65] = L""; // Create 16 bit char buffer for Extended ASCII - RDScharConverter(rt_buffer, RTtext, sizeof(RTtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII - rds.stationText = convertToUTF8(RTtext); // Convert RDS characterset to ASCII - rds.stationText = extractUTF8Substring(rds.stationText, 0, 64, true); // Make sure RT does not exceed 64 characters + wchar_t RTtext[65] = L""; // Create 16 bit char buffer for Extended ASCII + RDScharConverter(rt_buffer, RTtext, sizeof(RTtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII + rds.stationText = convertToUTF8(RTtext); // Convert RDS characterset to ASCII + rds.stationText = extractUTF8Substring(rds.stationText, 0, 64, true); // Make sure RT does not exceed 64 characters } for (byte i = 0; i < 64; i++) { @@ -649,10 +660,10 @@ void TEF6686::readRDS(byte showrdserrors) rt_buffer[offset + 3] = rds.rdsD & 0xff; // Fourth character of segment if (initrt || !rds.rtbuffer) { - wchar_t RTtext[65] = L""; // Create 16 bit char buffer for Extended ASCII - RDScharConverter(rt_buffer, RTtext, sizeof(RTtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII - rds.stationText = convertToUTF8(RTtext); // Convert RDS characterset to ASCII - rds.stationText = extractUTF8Substring(rds.stationText, 0, 64, true); // Make sure RT does not exceed 64 characters + wchar_t RTtext[65] = L""; // Create 16 bit char buffer for Extended ASCII + RDScharConverter(rt_buffer, RTtext, sizeof(RTtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII + rds.stationText = convertToUTF8(RTtext); // Convert RDS characterset to ASCII + rds.stationText = extractUTF8Substring(rds.stationText, 0, 64, true); // Make sure RT does not exceed 64 characters } for (int i = 0; i < 64; i++) rt_buffer2[i] = rt_buffer[i]; @@ -663,9 +674,9 @@ void TEF6686::readRDS(byte showrdserrors) if (showrdserrors == 3 || (!rdsBerrorThreshold && !rdsDerrorThreshold)) { // RT decoder (32 characters) rds.hasRT = true; - rds.rtAB32 = (bitRead(rds.rdsB, 4)); // Get AB flag + rds.rtAB32 = (bitRead(rds.rdsB, 4)); // Get AB flag - if (rds.rtAB32 != rtAB32old) { // Erase old RT, because of AB change + if (rds.rtAB32 != rtAB32old) { // Erase old RT, because of AB change for (byte i = 0; i < 33; i++) { rt_buffer32[i] = 0x20; } diff --git a/src/TEF6686.h b/src/TEF6686.h index c10a727..5c28438 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -171,6 +171,7 @@ typedef struct _rds_ { bool rdsreset; bool pierrors; bool sortaf; + bool fastps; bool rtbuffer = true; } rds_; @@ -274,7 +275,7 @@ class TEF6686 { bool useRTPlus = true; bool ABold; bool afreset; - bool mpxmode; + bool mpxmode; char stationTextBuffer[65]; uint16_t piold; bool rtABold; @@ -296,10 +297,10 @@ class TEF6686 { bool rdsCerrorThreshold; bool rdsDerrorThreshold; byte afmethodcounter; - bool packet0; - bool packet1; - bool packet2; - bool packet3; + bool packet0; + bool packet1; + bool packet2; + bool packet3; }; #endif \ No newline at end of file diff --git a/src/constants.h b/src/constants.h index 9e57780..7e22a7f 100644 --- a/src/constants.h +++ b/src/constants.h @@ -108,7 +108,7 @@ #define EE_PRESETS_CNT 99 #define EE_CHECKBYTE_VALUE 34 // 0 ~ 255,add new entry, change for new value -#define EE_TOTAL_CNT 617 +#define EE_TOTAL_CNT 618 #define EE_UINT16_FREQUENCY_FM 0 #define EE_BYTE_VOLSET 4 #define EE_BYTE_STEREO 5 @@ -180,12 +180,11 @@ #define EE_INT16_AMLEVELOFFSET 98 #define EE_UINT16_FREQUENCY_OIRT 102 #define EE_STRING_XDRGTK_KEY 106 // 11 byte -#define EE_PRESETS_BAND_START 118 -#define EE_PRESETS_START 220 +#define EE_BYTE_FASTPS 118 +#define EE_PRESETS_BAND_START 119 +#define EE_PRESETS_START 221 #define EE_PRESETS_FREQUENCY 8750 - - // End of EEPROM index defines static const char* const unitString[] = {"dBμV", "dBf", "dBm"}; diff --git a/src/gui.cpp b/src/gui.cpp index a2a6d44..8ab74de 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -6,7 +6,7 @@ #include byte menuitem; -byte items[8] = {8, 2, 6, 9, 8, 10, 8, 5}; +byte items[8] = {8, 2, 6, 9, 9, 10, 8, 5}; void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/ switch (CurrentTheme) { @@ -458,6 +458,7 @@ void BuildMenu() { 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][203], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16); switch (showrdserrors) { case 0: tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; @@ -474,6 +475,7 @@ void BuildMenu() { 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.fastps) tftPrint(1, myLanguage[language][42], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break; case FMSETTINGS: @@ -691,7 +693,7 @@ void BuildAdvancedRDS() { eonstringold = ""; afstringold = ""; rtplusstringold = ""; - + ShowMemoryPos(); } @@ -1097,6 +1099,12 @@ void MenuUp() { 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); break; + + case ITEM9: + if (radio.rds.fastps) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (radio.rds.fastps) radio.rds.fastps = false; else radio.rds.fastps = true; + if (radio.rds.fastps) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; @@ -1609,6 +1617,12 @@ void MenuDown() { 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); break; + + case ITEM9: + if (radio.rds.fastps) tftPrint(0, myLanguage[language][42], 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(0, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28); + if (radio.rds.fastps) radio.rds.fastps = false; else radio.rds.fastps = true; + if (radio.rds.fastps) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; @@ -2093,6 +2107,11 @@ void DoMenu() { tftPrint(0, myLanguage[language][196], 155, 78, ActiveColor, ActiveColorSmooth, 28); 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); break; + + case ITEM9: + tftPrint(0, myLanguage[language][203], 155, 78, ActiveColor, ActiveColorSmooth, 28); + if (radio.rds.fastps) tftPrint(0, myLanguage[language][42], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28); + break; } break; @@ -2249,7 +2268,7 @@ void DoMenu() { XDRGTK_key = XDRGTK_key_input.getValue(); EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key); EEPROM.commit(); - wifi = true; + wifi = true; tryWiFi(); delay(2000); menuopen = false; diff --git a/src/language.h b/src/language.h index 382ca62..2598acc 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][203] = { +static const char* const myLanguage[16][204] = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -203,7 +203,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Nederlands", // Dutch @@ -314,7 +315,7 @@ static const char* const myLanguage[16][203] = { "FM", // 105 "OIRT", // 106 "Rotating while screen off", // 107 - "Model selector", // 108 + "Model keuze", // 108 "Basis (ILI9341)", // 109 "Portable (ILI9341)", // 110 "Portable touch (ILI9341)", // 111 @@ -408,7 +409,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Laag", // 200 "Middel", // 201 - "Alles" // 202 + "Alles", // 202 + "Snelle PS" // 203 }, { "Polski", // Polish @@ -613,7 +615,8 @@ static const char* const myLanguage[16][203] = { "Deemfaza FM", // 199 "Male", // 200 "Duze", // 201 - "Wszystkie" // 202 + "Wszystkie", // 202 + "Fast PS" // 203 }, { "Hrvatski", // Croatian @@ -818,7 +821,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Ελληνικά", // Greek @@ -1023,7 +1027,8 @@ static const char* const myLanguage[16][203] = { "FM αποέμφαση", // 199 "Μικρό", // 200 "Μεγάλο", // 201 - "Όλα" // 202 + "Όλα", // 202 + "Fast PS" // 203 }, { "Romana", // Romanian @@ -1228,7 +1233,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Deutsch", // German @@ -1433,7 +1439,8 @@ static const char* const myLanguage[16][203] = { "UKW Deemphasis", // 199 "Gering", // 200 "Groß", // 201 - "Alles" // 202 + "Alles", // 202 + "Fast PS" // 203 }, { "Czech", // Czech @@ -1638,7 +1645,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Slovak", // Slovak @@ -1843,7 +1851,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Français", // French @@ -2048,7 +2057,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Български", // Bulgarian @@ -2253,7 +2263,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Русский", // Russian @@ -2458,7 +2469,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Українська", // Ukranian @@ -2663,7 +2675,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Italiano", // Italian @@ -2868,7 +2881,8 @@ static const char* const myLanguage[16][203] = { "FM deemphasis", // 199 "Small", // 200 "Large", // 201 - "All" // 202 + "All", // 202 + "Fast PS" // 203 }, { "Simplified Chinese", // Simplified Chinese @@ -3073,7 +3087,8 @@ static const char* const myLanguage[16][203] = { "FM去加重", // 199 "少量", // 200 "大量", // 201 - "全部" // 202 + "全部", // 202 + "Fast PS" // 203 }, { "Norsk", // Norwegian @@ -3278,7 +3293,8 @@ static const char* const myLanguage[16][203] = { "FM ettertrykkelse", // 199 "Lite", // 200 "Mye", // 201 - "Alt" // 202 + "Alt", // 202 + "Fast PS" // 203 } }; @@ -3568,4 +3584,4 @@ static const char* const myLanguages[] { "Bulgarian", // 51 "Armenian", // 52 "Arabic" // 53 -}; +}; \ No newline at end of file diff --git a/src/rds.cpp b/src/rds.cpp index 0789316..80980d4 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -209,14 +209,14 @@ void ShowAdvancedRDS() { if (TPold != radio.rds.hasTP) { if (!screenmute) { - if (radio.rds.hasTP == true) tftPrint(-1, "TP", 3, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TP", 3, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTP) tftPrint(-1, "TP", 3, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TP", 3, 51, GreyoutColor, BackgroundColor, 16); } TPold = radio.rds.hasTP; } if (TAold != radio.rds.hasTA) { if (!screenmute) { - if (radio.rds.hasTA == true) tftPrint(-1, "TA", 25, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TA", 25, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTA) tftPrint(-1, "TA", 25, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TA", 25, 51, GreyoutColor, BackgroundColor, 16); } TAold = radio.rds.hasTA; } @@ -265,7 +265,7 @@ void ShowAdvancedRDS() { if (hastmcold != radio.rds.hasTMC) { if (!screenmute) { - if (radio.rds.hasTMC == true) tftPrint(-1, "TMC", 89, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TMC", 89, 51, GreyoutColor, BackgroundColor, 16); + if (radio.rds.hasTMC) tftPrint(-1, "TMC", 89, 51, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, "TMC", 89, 51, GreyoutColor, BackgroundColor, 16); } hastmcold = radio.rds.hasTMC; } @@ -274,7 +274,7 @@ void ShowAdvancedRDS() { } void doAF() { - if (radio.af_counter != af_counterold && radio.rds.hasAF == true) { + if (radio.af_counter != af_counterold && radio.rds.hasAF) { if (wifi) { Udp.beginPacket(remoteip, 9030); Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";AF="); @@ -583,37 +583,33 @@ void readRds() { if (band < BAND_GAP) { RDSstatus = radio.rds.hasRDS; ShowRDSLogo(RDSstatus); - if (!screenmute) { - if (!afscreen) { - if (!RDSstatus) { - if (clearrds) { - if (advancedRDS) tftPrint(0, PIold, 275, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, SecondaryColor, SecondaryColorSmooth, 28); - if (advancedRDS) tftPrint(-1, PSold, 38, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, SecondaryColor, SecondaryColorSmooth, 28); - if (advancedRDS) tftPrint(-1, PTYold, 38, 109, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, SecondaryColor, SecondaryColorSmooth, 16); - if (advancedRDS) { - tft.fillCircle(86, 41, 5, SignificantColor); - tft.fillCircle(124, 41, 5, SignificantColor); - tft.fillCircle(162, 41, 5, SignificantColor); - tft.fillCircle(200, 41, 5, SignificantColor); - } - clearrds = false; + if (!screenmute && !afscreen) { + if (!RDSstatus) { + if (radio.rds.correctPI != 0) { + if (advancedRDS) tftPrint(0, PIold, 275, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, SecondaryColor, SecondaryColorSmooth, 28); + if (advancedRDS) tftPrint(-1, PSold, 38, 75, SecondaryColor, SecondaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, SecondaryColor, SecondaryColorSmooth, 28); + if (advancedRDS) tftPrint(-1, PTYold, 38, 109, SecondaryColor, SecondaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, SecondaryColor, SecondaryColorSmooth, 16); + if (advancedRDS) { + tft.fillCircle(86, 41, 5, SignificantColor); + tft.fillCircle(124, 41, 5, SignificantColor); + tft.fillCircle(162, 41, 5, SignificantColor); + tft.fillCircle(200, 41, 5, SignificantColor); } - if (radio.rds.correctPI != 0) dropout = true; - } else { - clearrds = true; - if (dropout == true) { - if (advancedRDS) tftPrint(0, PIold, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, PrimaryColor, PrimaryColorSmooth, 28); - if (advancedRDS) tftPrint(-1, PSold, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, PrimaryColor, PrimaryColorSmooth, 28); - if (advancedRDS) tftPrint(-1, PTYold, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, PrimaryColor, PrimaryColorSmooth, 16); - if (!advancedRDS) { - tft.fillCircle(314, 223, 2, GreyoutColor); - tft.fillCircle(314, 234, 2, GreyoutColor); - } else { - tft.fillCircle(203, 223, 2, GreyoutColor); - tft.fillCircle(203, 234, 2, GreyoutColor); - } - dropout = false; + dropout = true; + } + } else { + if (dropout) { + if (advancedRDS) tftPrint(0, PIold, 275, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, PIold, 275, 187, PrimaryColor, PrimaryColorSmooth, 28); + if (advancedRDS) tftPrint(-1, PSold, 38, 75, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(-1, PSold, 38, 187, PrimaryColor, PrimaryColorSmooth, 28); + if (advancedRDS) tftPrint(-1, PTYold, 38, 109, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(-1, PTYold, 38, 163, PrimaryColor, PrimaryColorSmooth, 16); + if (!advancedRDS) { + tft.fillCircle(314, 223, 2, GreyoutColor); + tft.fillCircle(314, 234, 2, GreyoutColor); + } else { + tft.fillCircle(203, 223, 2, GreyoutColor); + tft.fillCircle(203, 234, 2, GreyoutColor); } + dropout = false; } } } @@ -628,7 +624,7 @@ void readRds() { if (RDSSPYRDS != RDSSPYRDSold) { if (RDSSPYUSB) Serial.print(RDSSPYRDS); else RemoteClient.print(RDSSPYRDS); - RDSSPYRDSold = RDSSPYRDS; + RDSSPYRDSold = RDSSPYRDS; } } @@ -664,7 +660,7 @@ void readRds() { if (XDRGTKRDS != XDRGTKRDSold) { DataPrint(XDRGTKRDS); - XDRGTKRDSold = XDRGTKRDS; + XDRGTKRDSold = XDRGTKRDS; } } } @@ -852,7 +848,7 @@ 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 == true && !screenmute) tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); + if (afpage && !screenmute) tftPrint(1, String(afpagenr) + "/2", 315, 222, SecondaryColor, SecondaryColorSmooth, 16); } af_counterold = radio.af_counter; }