fix graphics

This commit is contained in:
2026-01-08 18:03:51 +01:00
parent b66f821e84
commit 67109d544d
11 changed files with 79 additions and 115 deletions
+3 -2
View File
@@ -1386,7 +1386,7 @@ void TEF6686::readRDS(byte showrdserrors) {
case RDS_GROUP_14A: {
if (!rdsAerrorThreshold && !rdsBerrorThreshold && !rdsCerrorThreshold && !rdsDerrorThreshold) {
rds.hasEON = true;
rds.hasEON.set(true);
bool isValuePresent = false;
int eonIndex = -1;
@@ -1602,10 +1602,11 @@ void TEF6686::clearRDS(bool fullsearchrds) {
rds.PTY.set(0);
rds.hasECC = rds.hasRT = rds.hasRDS = false;
rds.TP = rds.hasAF = rds.hasTA = false;
rds.hasEON = rds.hasCT = false;
rds.hasCT = false;
rds.hasAID = rds.hasPTYN = rds.hasLongPS = false;
rds.hasRTplus.set(false);
rds.hasTMC.set(false);
rds.hasEON.set(false);
rds.hasDABAF = rds.hasEnhancedRT = false;
rt_process = ps_process = pslong_process = false;
rds.rdsreset = true;
+12 -3
View File
@@ -362,6 +362,14 @@ mem presets[EE_PRESETS_CNT];
TEF6686 radio;
ESP32Time rtc(0);
// FrequencySprite.createSprite(200, 50);
// RDSSprite.createSprite(165, 19);
// PSSprite.createSprite(150, 32);
// SquelchSprite.createSprite(27, 19);
// FullLineSprite.createSprite(308, 19);
// OneBigLineSprite.createSprite(270, 30);
TFT_eSprite FrequencySprite = TFT_eSprite(&tft);
TFT_eSprite RDSSprite = TFT_eSprite(&tft);
TFT_eSprite SquelchSprite = TFT_eSprite(&tft);
@@ -376,6 +384,7 @@ WiFiClient RemoteClient;
WiFiUDP Udp;
WebServer webserver(80);
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 146, 170);
ScrollingTextDisplay eonDisplay(&RDSSprite, 172, 170);
ScrollingTextDisplay eccDisplay(&FullLineSprite, 199, 270);
ScrollingTextDisplay rtplusDisplay(&RDSSprite, 147, 180);
ScrollingTextDisplay eonDisplay(&RDSSprite, 174, 180);
ScrollingTextDisplay eccDisplay(&FullLineSprite, 198, 270);
ScrollingTextDisplay rtDisplay(&FullLineSprite, 220, 270);
+5 -4
View File
@@ -588,7 +588,7 @@ void BuildAFScreen() {
if (afpagenr == 1) {
if (!radio.rds.hasAF) tftPrint(ALEFT, textUI(87), 6, 48, PrimaryColor, PrimaryColorSmooth, 16);
} else if (afpagenr == 2) {
if (!radio.rds.hasEON) tftPrint(ALEFT, textUI(88), 6, 48, PrimaryColor, PrimaryColorSmooth, 16);
if (!radio.rds.hasEON.get()) tftPrint(ALEFT, textUI(88), 6, 48, PrimaryColor, PrimaryColorSmooth, 16);
}
RDSstatusold = !RDSstatusold;
ShowFreq(0);
@@ -608,7 +608,6 @@ void BuildAFScreen() {
rds_clockold = "";
dropout = false;
rdsreset = true;
xPos = 0;
rtplusDisplay.reset();
eonDisplay.reset();
eccDisplay.reset();
@@ -2993,10 +2992,11 @@ void BuildAdvancedRDS() {
rdsreset = true;
ShowMemoryPos();
xPos = 0;
xPos2 = 0;
rtplusDisplay.reset();
eonDisplay.reset();
eccDisplay.reset();
xPos2 = 0;
rtDisplay.reset();
}
void BuildDisplay() {
@@ -3112,10 +3112,11 @@ void BuildDisplay() {
stationStateold = " ";
BWreset = true;
dropout = false;
xPos = 0;
rtplusDisplay.reset();
eonDisplay.reset();
eccDisplay.reset();
rtDisplay.reset();
xPos = 0;
xPos2 = 0;
MPold = 99;
USold = 99;
+13
View File
@@ -1721,6 +1721,19 @@ void setup() {
SelectBand();
if (tunemode == TUNE_MEM) DoMemoryPosTune();
eccDisplay.setPostDrawCallback([&](TFT_eSprite* sprite, bool scrolling) {
sprite->fillRect(275, 0, 8, 19, BackgroundColor);
sprite->drawLine(284, 0, 284, 19, FrameColor);
});
rtDisplay.setPostDrawCallback([&](TFT_eSprite* sprite, bool scrolling) {
sprite->fillRect(275, 0, 8, 19, BackgroundColor);
sprite->drawLine(284, 0, 284, 19, FrameColor);
if (radio.rds.hasRT) {
FullLineSprite.fillCircle(278, 3, 2, radio.rds.rtAB ? GreyoutColor : InsignificantColor);
FullLineSprite.fillCircle(278, 14, 2, radio.rds.rtAB ? InsignificantColor : GreyoutColor);
}
});
setupmode = false;
if (edgebeep) radio.tone(50, -5, 2000);
+8 -80
View File
@@ -6,8 +6,8 @@
String HexStringold;
float smoothBER = 0;
int RadiotextWidth, PSLongWidth, AIDWidth, afstringWidth, eccstringWidth, eonstringWidth, rtplusstringWidth, lengths[7];
String afstringold, eonstringold, rtplusstringold, stationNameLongOld, AIDStringold;
int PSLongWidth, AIDWidth, lengths[7];
String stationNameLongOld, AIDStringold;
bool rtABold, ps12errorold, ps34errorold, ps56errorold, ps78errorold;
void ShowAdvancedRDS() {
@@ -60,8 +60,6 @@ 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";
tftPrint(ALEFT, "N/A", 35, 199, BackgroundColor, BackgroundColor, 16);
eccstringWidth = RDSSprite.textWidth(ECCString);
}
if (wifi) {
@@ -72,23 +70,17 @@ void ShowAdvancedRDS() {
Udp.endPacket();
}
}
if(!screenmute) eccDisplay.update(ECCString, eccstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
if(!screenmute) eccDisplay.update(ECCString, 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);
if (haseonold != radio.rds.hasEON) {
if (radio.rds.hasEON.changed(0)) {
if (!screenmute) {
if (radio.eon_counter > 0) tftPrint(ALEFT, "EON", 153, 51, RDSColor, RDSColorSmooth, 16); else tftPrint(ALEFT, "EON", 153, 51, GreyoutColor, BackgroundColor, 16);
}
haseonold = radio.rds.hasEON;
}
if (eonstring != eonstringold) {
eonstringWidth = RDSSprite.textWidth(eonstring);
eonstringold = eonstring;
}
if(!screenmute) eonDisplay.update(eonstring, eonstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
if(!screenmute) eonDisplay.update(eonstring, 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);
@@ -98,12 +90,7 @@ void ShowAdvancedRDS() {
}
}
if (rtplusstring != rtplusstringold) {
rtplusstringWidth = RDSSprite.textWidth(rtplusstring);
rtplusstringold = rtplusstring;
}
if(!screenmute) rtplusDisplay.update(rtplusstring, rtplusstringWidth, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
if(!screenmute) rtplusDisplay.update(rtplusstring, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
if (TPold != radio.rds.TP) {
if (!screenmute) {
@@ -610,73 +597,14 @@ void showRadioText() {
String RTString = String(radio.rds.stationText + (radio.rds.stationText.length() > 0 ? " " : "") + radio.rds.stationText32 + (radio.rds.hasEnhancedRT ? " eRT: " + String(radio.rds.enhancedRTtext) : "") + " ");
if (radio.rds.hasRT && radio.rds.rtAB != rtABold) {
xPos = 0;
rtDisplay.reset();
rttickerhold = millis();
rtABold = radio.rds.rtAB;
}
if (!screenmute) {
if (radio.rds.hasRT &&
(radio.rds.stationText.length() > 0 || radio.rds.stationText32.length() > 0)) {
if (RDSSprite.textWidth(trimTrailingSpaces(RTString)) < 270) {
xPos = 0;
FullLineSprite.fillSprite(BackgroundColor);
FullLineSprite.setTextDatum(TL_DATUM);
FullLineSprite.setTextColor(
RDSstatus ? RDSColor : RDSDropoutColor,
RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth,
false
);
FullLineSprite.drawString(RTString, xPos, 2);
FullLineSprite.fillRect(275, 0, 8, 19, BackgroundColor);
FullLineSprite.drawLine(283, 0, 283, 19, FrameColor);
if (radio.rds.hasRT) {
FullLineSprite.fillCircle(278, 3, 2, radio.rds.rtAB ? GreyoutColor : InsignificantColor);
FullLineSprite.fillCircle(278, 14, 2, radio.rds.rtAB ? InsignificantColor : GreyoutColor);
}
FullLineSprite.pushSprite(36, 220);
} else {
// Handle scrolling text
if (millis() - rtticker >= 15) {
if (xPos == 0 && millis() - rttickerhold < 1000) {
// Wait for a moment before scrolling
} else {
xPos--;
rttickerhold = millis(); // Update hold time only when xPos changes
}
if (xPos < -RadiotextWidth) xPos = 0; // Reset position if scrolled off
FullLineSprite.fillSprite(BackgroundColor);
FullLineSprite.setTextDatum(TL_DATUM);
FullLineSprite.setTextColor(
RDSstatus ? RDSColor : RDSDropoutColor,
RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth,
false
);
FullLineSprite.drawString(RTString, xPos, 2);
FullLineSprite.drawString(RTString, xPos + RadiotextWidth, 2);
FullLineSprite.fillRect(275, 0, 8, 19, BackgroundColor);
FullLineSprite.drawLine(283, 0, 283, 19, FrameColor);
if (radio.rds.hasRT) {
FullLineSprite.fillCircle(278, 3, 2, radio.rds.rtAB ? GreyoutColor : InsignificantColor);
FullLineSprite.fillCircle(278, 14, 2, radio.rds.rtAB ? InsignificantColor : GreyoutColor);
}
FullLineSprite.pushSprite(36, 220);
rtticker = millis();
}
}
}
}
if (!screenmute && radio.rds.hasRT && (radio.rds.stationText.length() > 0 || radio.rds.stationText32.length() > 0)) rtDisplay.update(RTString, RDSstatus, RDSColor, RDSColorSmooth, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor);
if (RTold != RTString) {
RadiotextWidth = FullLineSprite.textWidth(RTString);
if (wifi) {
Udp.beginPacket(remoteip, 9030);
Udp.print("from=TEF_tuner_" + String(stationlistid, DEC) + ";RT1=");