sorta fix ecc and others, more tomorrow
This commit is contained in:
@@ -8,7 +8,6 @@ private:
|
|||||||
TFT_eSprite* sprite;
|
TFT_eSprite* sprite;
|
||||||
int yPos;
|
int yPos;
|
||||||
int maxWidth;
|
int maxWidth;
|
||||||
uint16_t backgroundColor;
|
|
||||||
int xPos;
|
int xPos;
|
||||||
int textWidth;
|
int textWidth;
|
||||||
unsigned long lastTick;
|
unsigned long lastTick;
|
||||||
@@ -19,18 +18,18 @@ private:
|
|||||||
static const unsigned long HOLD_DURATION = 2000;
|
static const unsigned long HOLD_DURATION = 2000;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW, uint16_t bgColor)
|
ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW)
|
||||||
: sprite(spr), yPos(y), maxWidth(maxW), backgroundColor(bgColor),
|
: sprite(spr), yPos(y), maxWidth(maxW),
|
||||||
xPos(0), textWidth(0), lastTick(0), holdTick(0), isScrolling(false) {}
|
xPos(0), textWidth(0), lastTick(0), holdTick(0), isScrolling(false) {}
|
||||||
|
|
||||||
// Update the display with new text
|
// 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;
|
textWidth = width;
|
||||||
|
|
||||||
if (textWidth < maxWidth) {
|
if (textWidth < maxWidth) {
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
isScrolling = false;
|
isScrolling = false;
|
||||||
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth);
|
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor);
|
||||||
} else {
|
} else {
|
||||||
isScrolling = true;
|
isScrolling = true;
|
||||||
if (millis() - lastTick >= SCROLL_INTERVAL) {
|
if (millis() - lastTick >= SCROLL_INTERVAL) {
|
||||||
@@ -46,7 +45,7 @@ public:
|
|||||||
holdTick = millis();
|
holdTick = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawScrollingText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth);
|
drawScrollingText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor);
|
||||||
lastTick = millis();
|
lastTick = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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);
|
sprite->fillSprite(backgroundColor);
|
||||||
if (status) sprite->setTextColor(activeColor, activeSmooth, false);
|
if (status) sprite->setTextColor(activeColor, activeSmooth, false);
|
||||||
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
|
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
|
||||||
@@ -75,7 +74,7 @@ private:
|
|||||||
sprite->pushSprite(35, yPos);
|
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);
|
sprite->fillSprite(backgroundColor);
|
||||||
if (status) sprite->setTextColor(activeColor, activeSmooth, false);
|
if (status) sprite->setTextColor(activeColor, activeSmooth, false);
|
||||||
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
|
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
|
||||||
|
|||||||
+3
-3
@@ -376,6 +376,6 @@ WiFiClient RemoteClient;
|
|||||||
WiFiUDP Udp;
|
WiFiUDP Udp;
|
||||||
WebServer webserver(80);
|
WebServer webserver(80);
|
||||||
|
|
||||||
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 165, BackgroundColor);
|
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 170);
|
||||||
ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 165, BackgroundColor);
|
ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 170);
|
||||||
ScrollingTextDisplay eccDisplay(&RDSSprite, 199, 270, BackgroundColor);
|
ScrollingTextDisplay eccDisplay(&FullLineSprite, 199, 270);
|
||||||
+3
-8
@@ -60,16 +60,10 @@ void ShowAdvancedRDS() {
|
|||||||
if (radio.rds.ECC.changed(0)) {
|
if (radio.rds.ECC.changed(0)) {
|
||||||
if (!screenmute) {
|
if (!screenmute) {
|
||||||
if (radio.rds.hasECC) ECCString = (radio.rds.ECCtext.length() == 0 ? textUI(73) : radio.rds.ECCtext); else ECCString = "N/A";
|
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, "N/A", 35, 199, BackgroundColor, BackgroundColor, 16);
|
||||||
tftPrint(ALEFT, ECColdString, 35, 199, BackgroundColor, BackgroundColor, 16);
|
|
||||||
eccstringWidth = RDSSprite.textWidth(ECCString);
|
eccstringWidth = RDSSprite.textWidth(ECCString);
|
||||||
}
|
}
|
||||||
|
|
||||||
eccDisplay.update(ECCString, eccstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth);
|
|
||||||
}
|
|
||||||
ECColdString = ECCString;
|
|
||||||
|
|
||||||
if (wifi) {
|
if (wifi) {
|
||||||
Udp.beginPacket(remoteip, 9030);
|
Udp.beginPacket(remoteip, 9030);
|
||||||
Udp.print("from=TEF_tuner_" + String(stationlistid, DEC) + ";ECC=");
|
Udp.print("from=TEF_tuner_" + String(stationlistid, DEC) + ";ECC=");
|
||||||
@@ -78,6 +72,7 @@ void ShowAdvancedRDS() {
|
|||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!screenmute) eccDisplay.update(ECCString, eccstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
|
||||||
|
|
||||||
String eonstring;
|
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);
|
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;
|
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;
|
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);
|
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;
|
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 (TPold != radio.rds.TP) {
|
||||||
if (!screenmute) {
|
if (!screenmute) {
|
||||||
|
|||||||
Reference in New Issue
Block a user