You've already forked TEF6686_ESP32
Reset RT position on AB change
This commit is contained in:
57
src/rds.cpp
57
src/rds.cpp
@@ -5,6 +5,7 @@
|
||||
#include "constants.h"
|
||||
#include <TimeLib.h>
|
||||
|
||||
bool rtABold;
|
||||
int RadiotextWidth;
|
||||
int PSLongWidth;
|
||||
int AIDWidth;
|
||||
@@ -793,69 +794,63 @@ void showCT() {
|
||||
void showRadioText() {
|
||||
String RTString = String(radio.rds.stationText + " " + radio.rds.stationText32 + (radio.rds.hasEnhancedRT ? " eRT: " + String(radio.rds.enhancedRTtext) : "") + " ");
|
||||
|
||||
if (radio.rds.hasRT && radio.rds.rtAB != rtABold) {
|
||||
xPos = 0;
|
||||
rttickerhold = millis();
|
||||
rtABold = radio.rds.rtAB;
|
||||
}
|
||||
|
||||
if (!screenmute) {
|
||||
if (radio.rds.hasRT && radio.rds.stationText.length() > 0) {
|
||||
if (advancedRDS && RDSSprite.textWidth(radio.trimTrailingSpaces(RTString)) < 165) {
|
||||
xPos = 0;
|
||||
RDSSprite.fillSprite(BackgroundColor);
|
||||
RDSSprite.setTextDatum(TL_DATUM);
|
||||
if (RDSstatus) RDSSprite.setTextColor(RDSColor, RDSColorSmooth, false); else RDSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
RDSSprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
RDSSprite.drawString(RTString, xPos, 2);
|
||||
RDSSprite.pushSprite(36, 220);
|
||||
} else if (!advancedRDS && RDSSprite.textWidth(radio.trimTrailingSpaces(RTString)) < 270) {
|
||||
xPos = 0;
|
||||
FullLineSprite.fillSprite(BackgroundColor);
|
||||
FullLineSprite.setTextDatum(TL_DATUM);
|
||||
if (RDSstatus) FullLineSprite.setTextColor(RDSColor, RDSColorSmooth, false); else FullLineSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
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) {
|
||||
if (radio.rds.rtAB) {
|
||||
FullLineSprite.fillCircle(278, 3, 2, GreyoutColor);
|
||||
FullLineSprite.fillCircle(278, 14, 2, InsignificantColor);
|
||||
} else {
|
||||
FullLineSprite.fillCircle(278, 3, 2, InsignificantColor);
|
||||
FullLineSprite.fillCircle(278, 14, 2, GreyoutColor);
|
||||
}
|
||||
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 {
|
||||
if (millis() - rtticker >= (advancedRDS ? 5 : 15)) {
|
||||
if (xPos == 0) {
|
||||
if (millis() - rttickerhold >= 1000) {
|
||||
xPos --;
|
||||
rttickerhold = millis();
|
||||
}
|
||||
if (xPos == 0 && millis() - rttickerhold < 1000) {
|
||||
// Do nothing, just wait
|
||||
} else {
|
||||
xPos --;
|
||||
rttickerhold = millis();
|
||||
xPos--;
|
||||
rttickerhold = millis(); // Update hold time only when xPos changes
|
||||
}
|
||||
|
||||
if (xPos < -RadiotextWidth) xPos = 0;
|
||||
|
||||
if (advancedRDS) {
|
||||
RDSSprite.fillSprite(BackgroundColor);
|
||||
RDSSprite.setTextDatum(TL_DATUM);
|
||||
if (RDSstatus) RDSSprite.setTextColor(RDSColor, RDSColorSmooth, false); else RDSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
RDSSprite.setTextColor(RDSstatus ? RDSColor : RDSDropoutColor, RDSstatus ? RDSColorSmooth : RDSDropoutColorSmooth, false);
|
||||
RDSSprite.drawString(RTString, xPos, 2);
|
||||
RDSSprite.drawString(RTString, xPos + RadiotextWidth, 2);
|
||||
RDSSprite.pushSprite(36, 220);
|
||||
} else {
|
||||
FullLineSprite.fillSprite(BackgroundColor);
|
||||
FullLineSprite.setTextDatum(TL_DATUM);
|
||||
if (RDSstatus) FullLineSprite.setTextColor(RDSColor, RDSColorSmooth, false); else FullLineSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
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) {
|
||||
if (radio.rds.rtAB) {
|
||||
FullLineSprite.fillCircle(278, 3, 2, GreyoutColor);
|
||||
FullLineSprite.fillCircle(278, 14, 2, InsignificantColor);
|
||||
} else {
|
||||
FullLineSprite.fillCircle(278, 3, 2, InsignificantColor);
|
||||
FullLineSprite.fillCircle(278, 14, 2, GreyoutColor);
|
||||
}
|
||||
FullLineSprite.fillCircle(278, 3, 2, radio.rds.rtAB ? GreyoutColor : InsignificantColor);
|
||||
FullLineSprite.fillCircle(278, 14, 2, radio.rds.rtAB ? InsignificantColor : GreyoutColor);
|
||||
}
|
||||
FullLineSprite.pushSprite(36, 220);
|
||||
}
|
||||
@@ -865,13 +860,8 @@ void showRadioText() {
|
||||
}
|
||||
|
||||
if (radio.rds.hasRT && advancedRDS) {
|
||||
if (radio.rds.rtAB) {
|
||||
tft.fillCircle(203, 223, 2, GreyoutColor);
|
||||
tft.fillCircle(203, 234, 2, InsignificantColor);
|
||||
} else {
|
||||
tft.fillCircle(203, 223, 2, InsignificantColor);
|
||||
tft.fillCircle(203, 234, 2, GreyoutColor);
|
||||
}
|
||||
tft.fillCircle(203, 223, 2, radio.rds.rtAB ? GreyoutColor : InsignificantColor);
|
||||
tft.fillCircle(203, 234, 2, radio.rds.rtAB ? InsignificantColor : GreyoutColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,8 +873,7 @@ void showRadioText() {
|
||||
Udp.print("from=TEF_tuner " + String(stationlistid, DEC) + ";RT1=");
|
||||
char RThex[65];
|
||||
radio.rds.stationText.toCharArray(RThex, 65);
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if (RThex[i] < 0x10) Udp.print("0");
|
||||
if (RThex[i] == ' ') RThex[i] = '_';
|
||||
Udp.print(String(RThex[i], HEX));
|
||||
|
||||
Reference in New Issue
Block a user