From b66f821e84b61569a462e3d1190abf6b718a7d48 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Wed, 7 Jan 2026 23:23:26 +0100 Subject: [PATCH] sorta fix ecc and others, more tomorrow --- include/scrolling_text.h | 15 +++++++-------- src/globals.cpp | 6 +++--- src/rds.cpp | 15 +++++---------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/include/scrolling_text.h b/include/scrolling_text.h index 3520c24..2a8a325 100644 --- a/include/scrolling_text.h +++ b/include/scrolling_text.h @@ -8,7 +8,6 @@ private: TFT_eSprite* sprite; int yPos; int maxWidth; - uint16_t backgroundColor; int xPos; int textWidth; unsigned long lastTick; @@ -19,18 +18,18 @@ private: static const unsigned long HOLD_DURATION = 2000; public: - ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW, uint16_t bgColor) - : sprite(spr), yPos(y), maxWidth(maxW), backgroundColor(bgColor), + ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW) + : sprite(spr), yPos(y), maxWidth(maxW), xPos(0), textWidth(0), lastTick(0), holdTick(0), isScrolling(false) {} // Update the display with new text - void update(const String& text, int width, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth) { + void update(const String& text, int width, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) { textWidth = width; if (textWidth < maxWidth) { xPos = 0; isScrolling = false; - drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth); + drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor); } else { isScrolling = true; if (millis() - lastTick >= SCROLL_INTERVAL) { @@ -46,7 +45,7 @@ public: holdTick = millis(); } - drawScrollingText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth); + drawScrollingText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor); lastTick = millis(); } } @@ -67,7 +66,7 @@ public: } private: - void drawText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth) { + void drawText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) { sprite->fillSprite(backgroundColor); if (status) sprite->setTextColor(activeColor, activeSmooth, false); else sprite->setTextColor(dropoutColor, dropoutSmooth, false); @@ -75,7 +74,7 @@ private: sprite->pushSprite(35, yPos); } - void drawScrollingText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth) { + void drawScrollingText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) { sprite->fillSprite(backgroundColor); if (status) sprite->setTextColor(activeColor, activeSmooth, false); else sprite->setTextColor(dropoutColor, dropoutSmooth, false); diff --git a/src/globals.cpp b/src/globals.cpp index 63b954d..1a6a1d5 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -376,6 +376,6 @@ WiFiClient RemoteClient; WiFiUDP Udp; WebServer webserver(80); -ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 165, BackgroundColor); -ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 165, BackgroundColor); -ScrollingTextDisplay eccDisplay(&RDSSprite, 199, 270, BackgroundColor); \ No newline at end of file +ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 170); +ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 170); +ScrollingTextDisplay eccDisplay(&FullLineSprite, 199, 270); \ No newline at end of file diff --git a/src/rds.cpp b/src/rds.cpp index 17d53b7..b759b3b 100644 --- a/src/rds.cpp +++ b/src/rds.cpp @@ -60,15 +60,9 @@ void ShowAdvancedRDS() { if (radio.rds.ECC.changed(0)) { if (!screenmute) { if (radio.rds.hasECC) ECCString = (radio.rds.ECCtext.length() == 0 ? textUI(73) : radio.rds.ECCtext); else ECCString = "N/A"; - if (ECCString != ECColdString) { - tftPrint(ALEFT, "N/A", 35, 199, BackgroundColor, BackgroundColor, 16); - tftPrint(ALEFT, ECColdString, 35, 199, BackgroundColor, BackgroundColor, 16); - eccstringWidth = RDSSprite.textWidth(ECCString); - } - - eccDisplay.update(ECCString, eccstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth); + tftPrint(ALEFT, "N/A", 35, 199, BackgroundColor, BackgroundColor, 16); + eccstringWidth = RDSSprite.textWidth(ECCString); } - ECColdString = ECCString; if (wifi) { Udp.beginPacket(remoteip, 9030); @@ -78,6 +72,7 @@ void ShowAdvancedRDS() { Udp.endPacket(); } } + if(!screenmute) eccDisplay.update(ECCString, eccstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor); String eonstring; if (radio.eon_counter > 0) 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 = textUI(88); @@ -93,7 +88,7 @@ void ShowAdvancedRDS() { eonstringold = eonstring; } - eonDisplay.update(eonstring, eonstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth); + if(!screenmute) eonDisplay.update(eonstring, eonstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor); String rtplusstring; if (radio.rds.hasRTplus.get()) rtplusstring = (radio.rds.rdsplusTag1 != 169 ? String(textUI(radio.rds.rdsplusTag1)) + ": " + String(radio.rds.RTContent1) : "") + (radio.rds.rdsplusTag2 != 169 ? " - " + String(textUI(radio.rds.rdsplusTag2)) + ": " + String(radio.rds.RTContent2) : "") + " "; else rtplusstring = textUI(89); @@ -108,7 +103,7 @@ void ShowAdvancedRDS() { rtplusstringold = rtplusstring; } - rtplusDisplay.update(rtplusstring, rtplusstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth); + if(!screenmute) rtplusDisplay.update(rtplusstring, rtplusstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor); if (TPold != radio.rds.TP) { if (!screenmute) {