From 25920aa6eee0cc9ca7c98efe36a75a2cfcde4471 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Thu, 9 Nov 2023 21:19:18 +0100 Subject: [PATCH] Blue-out AF/EON/RT+ ticker on RDS loss --- TEF6686_ESP32.ino | 7 +-- src/gui.cpp | 3 -- src/gui.h | 3 -- src/rds.cpp | 108 +++++++++++++++++----------------------------- src/rds.h | 3 -- 5 files changed, 40 insertions(+), 84 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 3bd7257..c1997e6 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -256,13 +256,11 @@ int8_t CNold; int8_t VolSet; float batteryVold; IPAddress remoteip; -String afstringold; String AIDString; String cryptedpassword; String CurrentThemeString; String ECColdtxt; String eonpsold[20]; -String eonstringold; String LIColdString; String pinstringold; String PIold; @@ -274,7 +272,6 @@ String rds_clockold; String RDSSPYRDS; String RDSSPYRDSold; String RTold; -String rtplusstringold; String salt; String saltkey = " "; String stationIDold; @@ -2348,9 +2345,7 @@ void ShowFreq(int mode) { } attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_A), read_encoder, CHANGE); attachInterrupt(digitalPinToInterrupt(ROTARY_PIN_B), read_encoder, CHANGE); - rtplusstringold = ""; - eonstringold = ""; - afstringold = ""; + rdsreset = true; licold = 254; ECCold = 253; diff --git a/src/gui.cpp b/src/gui.cpp index d570923..96d41ac 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -710,9 +710,6 @@ void BuildAdvancedRDS() { BWreset = true; pinstringold = ""; hasrtplusold = false; - eonstringold = ""; - afstringold = ""; - rtplusstringold = ""; afmethodBold = false; rds_clockold = ""; ShowMemoryPos(); diff --git a/src/gui.h b/src/gui.h index 16b3196..4a9cd34 100644 --- a/src/gui.h +++ b/src/gui.h @@ -145,16 +145,13 @@ extern int16_t SStatus; extern int8_t LevelOffset; extern int8_t LowLevelSet; extern int8_t VolSet; -extern String afstringold; extern String CurrentThemeString; extern String eonpsold[20]; -extern String eonstringold; extern String PIold; extern String pinstringold; extern String PSold; extern String ptynold; extern String rds_clockold; -extern String rtplusstringold; extern String stationIDold; extern String stationStateold; extern String XDRGTK_key; diff --git a/src/rds.cpp b/src/rds.cpp index 07f983f..19b5d23 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -69,34 +69,23 @@ void ShowAdvancedRDS() { hasafold = radio.rds.hasAF; } - if (afstring.length() < 20) { - if (afstringold != afstring) { - xPos2 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(afstring, xPos2, 2); - RDSSprite.pushSprite(35, 197); - } - } else { - if (millis() - afticker >= 15) { - if (xPos2 == 0) { - if (millis() - aftickerhold >= 2000) { - xPos2 --; - aftickerhold = millis(); - } - } else { + if (millis() - afticker >= 15) { + if (xPos2 == 0) { + if (millis() - aftickerhold >= 2000) { xPos2 --; aftickerhold = millis(); } - if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(afstring, xPos2, 2); - RDSSprite.pushSprite(35, 197); - afticker = millis(); + } else { + xPos2 --; + aftickerhold = millis(); } + if (xPos2 < -tft.textWidth(afstring) + (charWidth * 14)) xPos2 = 0; + RDSSprite.fillSprite(BackgroundColor); + if (RDSstatus) RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else RDSSprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false); + RDSSprite.drawString(afstring, xPos2, 2); + RDSSprite.pushSprite(35, 197); + afticker = millis(); } - afstringold = afstring; String eonstring; if (radio.rds.hasEON) for (byte i = 0; i < radio.eon_counter; i++) eonstring += String(radio.eon[i].picode) + (radio.eon[i].ps.length() > 0 ? String(": " + String(radio.eon[i].ps)) : "") + (radio.eon[i].mappedfreq > 0 ? String(" " + String(radio.eon[i].mappedfreq / 100) + "." + String((radio.eon[i].mappedfreq % 100) / 10)) : "") + (radio.eon[i].mappedfreq2 > 0 ? String(" / " + String(radio.eon[i].mappedfreq2 / 100) + "." + String((radio.eon[i].mappedfreq2 % 100) / 10)) : "") + (radio.eon[i].mappedfreq3 > 0 ? String(" / " + String(radio.eon[i].mappedfreq3 / 100) + "." + String((radio.eon[i].mappedfreq3 % 100) / 10)) : "") + (i == radio.eon_counter - 1 ? " " : " | "); else eonstring = myLanguage[language][88]; @@ -106,34 +95,25 @@ void ShowAdvancedRDS() { } haseonold = radio.rds.hasEON; } - if (eonstring.length() < 20) { - if (eonstringold != eonstring) { - xPos3 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(eonstring, xPos3, 2); - RDSSprite.pushSprite(35, 172); - } - } else { - if (millis() - eonticker >= 15) { - if (xPos3 == 0) { - if (millis() - eontickerhold >= 2000) { - xPos3 --; - eontickerhold = millis(); - } - } else { + + if (millis() - eonticker >= 15) { + if (xPos3 == 0) { + if (millis() - eontickerhold >= 2000) { xPos3 --; eontickerhold = millis(); } - if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(eonstring, xPos3, 2); - RDSSprite.pushSprite(35, 172); - eonticker = millis(); + } else { + xPos3 --; + eontickerhold = millis(); } + if (xPos3 < -tft.textWidth(eonstring) + (charWidth * 14)) xPos3 = 0; + RDSSprite.fillSprite(BackgroundColor); + if (RDSstatus) RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else RDSSprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false); + RDSSprite.drawString(eonstring, xPos3, 2); + RDSSprite.pushSprite(35, 172); + eonticker = millis(); } - eonstringold = eonstring; + String rtplusstring; if (radio.rds.hasRDSplus) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(myLanguage[language][radio.rds.rdsplusTag1]) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(myLanguage[language][radio.rds.rdsplusTag2]) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = myLanguage[language][89]; @@ -143,34 +123,24 @@ void ShowAdvancedRDS() { } hasrtplusold = radio.rds.hasRDSplus; } - if (rtplusstring.length() < 20) { - if (rtplusstringold != rtplusstring) { - xPos4 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(rtplusstring, xPos4, 2); - RDSSprite.pushSprite(35, 146); - } - } else { - if (millis() - rtplusticker >= 15) { - if (xPos4 == 0) { - if (millis() - rtplustickerhold >= 2000) { - xPos4 --; - rtplustickerhold = millis(); - } - } else { + + if (millis() - rtplusticker >= 15) { + if (xPos4 == 0) { + if (millis() - rtplustickerhold >= 2000) { xPos4 --; rtplustickerhold = millis(); } - if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0; - RDSSprite.fillSprite(BackgroundColor); - RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - RDSSprite.drawString(rtplusstring, xPos4, 2); - RDSSprite.pushSprite(35, 146); - rtplusticker = millis(); + } else { + xPos4 --; + rtplustickerhold = millis(); } + if (xPos4 < -tft.textWidth(rtplusstring) + (charWidth * 14)) xPos4 = 0; + RDSSprite.fillSprite(BackgroundColor); + if (RDSstatus) RDSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); else RDSSprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false); + RDSSprite.drawString(rtplusstring, xPos4, 2); + RDSSprite.pushSprite(35, 146); + rtplusticker = millis(); } - rtplusstringold = rtplusstring; if (TPold != radio.rds.hasTP) { if (!screenmute) { diff --git a/src/rds.h b/src/rds.h index 44bf487..956cf44 100644 --- a/src/rds.h +++ b/src/rds.h @@ -71,11 +71,9 @@ extern int xPos2; extern int xPos3; extern int xPos4; extern IPAddress remoteip; -extern String afstringold; extern String AIDString; extern String ECColdtxt; extern String eonpsold[20]; -extern String eonstringold; extern String LIColdString; extern String pinstringold; extern String PIold; @@ -87,7 +85,6 @@ extern String rds_clockold; extern String RDSSPYRDS; extern String RDSSPYRDSold; extern String RTold; -extern String rtplusstringold; extern String stationIDold; extern String stationStateold; extern String XDRGTKRDS;