sorta fix ecc and others, more tomorrow

This commit is contained in:
2026-01-07 23:23:26 +01:00
parent 4a6a1a1849
commit b66f821e84
3 changed files with 15 additions and 21 deletions

View File

@@ -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);

View File

@@ -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);
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 170);
ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 170);
ScrollingTextDisplay eccDisplay(&FullLineSprite, 199, 270);

View File

@@ -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) {