You've already forked TEF6686_ESP32
Show errors in PS with other color
This commit is contained in:
@@ -602,9 +602,16 @@ void TEF6686::readRDS(byte showrdserrors) {
|
||||
case RDS_GROUP_0B:
|
||||
{
|
||||
//PS decoder
|
||||
if (showrdserrors == 3 || (!rdsBerrorThreshold && !rdsDerrorThreshold)) {
|
||||
if (showrdserrors == 3 || (!rdsBerrorThreshold && ((rds.rdsErr >> 8) & 0x03) < 3)) {
|
||||
offset = rds.rdsB & 0x03; // Let's get the character offset for PS
|
||||
|
||||
switch (offset) {
|
||||
case 0: if (((rds.rdsErr >> 8) & 0x03) > 1) rds.ps12error = true; else rds.ps12error = false; break;
|
||||
case 1: if (((rds.rdsErr >> 8) & 0x03) > 1) rds.ps34error = true; else rds.ps34error = false; break;
|
||||
case 2: if (((rds.rdsErr >> 8) & 0x03) > 1) rds.ps56error = true; else rds.ps56error = false; break;
|
||||
case 3: if (((rds.rdsErr >> 8) & 0x03) > 1) rds.ps78error = true; else rds.ps78error = false; break;
|
||||
}
|
||||
|
||||
ps_buffer2[(offset * 2) + 0] = ps_buffer[(offset * 2) + 0]; // Make a copy of the PS buffer
|
||||
ps_buffer2[(offset * 2) + 1] = ps_buffer[(offset * 2) + 1];
|
||||
ps_buffer2[8] = '\0'; // Endmarker
|
||||
@@ -1839,6 +1846,10 @@ void TEF6686::clearRDS (bool fullsearchrds) {
|
||||
correctPIold = 0;
|
||||
af_number = 0;
|
||||
_hasEnhancedRT = false;
|
||||
rds.ps12error = true;
|
||||
rds.ps34error = true;
|
||||
rds.ps56error = true;
|
||||
rds.ps78error = true;
|
||||
}
|
||||
|
||||
void TEF6686::tone(uint16_t time, int16_t amplitude, uint16_t frequency) {
|
||||
|
||||
@@ -579,6 +579,7 @@ typedef struct _rds_ {
|
||||
char dabafeid[5];
|
||||
char dabafchannel[4];
|
||||
uint16_t rdsA, rdsB, rdsC, rdsD, rdsErr, rdsStat, correctPI, rdsplusTag1, rdsplusTag2;
|
||||
bool ps12error, ps34error, ps56error, ps78error;
|
||||
time_t time;
|
||||
int32_t offset;
|
||||
uint16_t aid[10];
|
||||
|
||||
52
src/rds.cpp
52
src/rds.cpp
@@ -12,6 +12,9 @@ int AIDWidth;
|
||||
int afstringWidth;
|
||||
int eonstringWidth;
|
||||
int rtplusstringWidth;
|
||||
int length12;
|
||||
int length34;
|
||||
int length56;
|
||||
|
||||
String afstringold;
|
||||
String eonstringold;
|
||||
@@ -19,6 +22,11 @@ String rtplusstringold;
|
||||
String stationNameLongOld;
|
||||
String AIDStringold;
|
||||
|
||||
bool ps12errorold;
|
||||
bool ps34errorold;
|
||||
bool ps56errorold;
|
||||
bool ps78errorold;
|
||||
|
||||
void ShowAdvancedRDS() {
|
||||
if (!dropout) {
|
||||
if (radio.rds.rdsAerror) tft.fillCircle(86, 41, 5, SignificantColor); else tft.fillCircle(86, 41, 5, InsignificantColor);
|
||||
@@ -344,7 +352,10 @@ void readRds() {
|
||||
if (!radio.rds.hasLongPS) {
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
PSSprite.drawString(PSold, 0, 2);
|
||||
PSSprite.drawString(PSold.substring(0, 2), 0, 2);
|
||||
PSSprite.drawString(PSold.substring(2, 4), length12, 2);
|
||||
PSSprite.drawString(PSold.substring(4, 6), length34, 2);
|
||||
PSSprite.drawString(PSold.substring(6, 8), length56, 2);
|
||||
|
||||
if (advancedRDS) {
|
||||
PSSprite.pushSprite(36, 72);
|
||||
@@ -399,8 +410,14 @@ void readRds() {
|
||||
|
||||
if (!radio.rds.hasLongPS) {
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(PSold, 0, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps12error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(PSold.substring(0, 2), 0, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps34error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(PSold.substring(2, 4), length12, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps56error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(PSold.substring(4, 6), length34, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps78error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(PSold.substring(6, 8), length56, 2);
|
||||
|
||||
if (advancedRDS) {
|
||||
PSSprite.pushSprite(36, 72);
|
||||
@@ -668,7 +685,7 @@ void showPTY() {
|
||||
}
|
||||
|
||||
void showPS() {
|
||||
if (radio.rds.stationName != PSold || (radio.rds.hasLongPS && showlongps)) {
|
||||
if (radio.rds.stationName != PSold || (RDSstatus && (!radio.rds.hasLongPS && showlongps) && (ps12errorold != radio.rds.ps12error || ps34errorold != radio.rds.ps34error || ps56errorold != radio.rds.ps56error || ps78errorold != radio.rds.ps78error)) || (radio.rds.hasLongPS && showlongps)) {
|
||||
if (afscreen) {
|
||||
if (!screenmute) tftReplace(0, PSold, radio.rds.stationName, 160, 201, BWAutoColor, BWAutoColorSmooth, BackgroundColor, 16);
|
||||
} else {
|
||||
@@ -706,8 +723,31 @@ void showPS() {
|
||||
} else {
|
||||
xPos5 = 0;
|
||||
PSSprite.fillSprite(BackgroundColor);
|
||||
if (!RDSstatus || band > BAND_GAP) PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false); else PSSprite.setTextColor(RDSColor, RDSColorSmooth, false);
|
||||
PSSprite.drawString(radio.rds.stationName, 0, 2);
|
||||
length12 = PSSprite.textWidth(radio.rds.stationName.substring(0, 2));
|
||||
length34 = PSSprite.textWidth(radio.rds.stationName.substring(2, 4)) + length12;
|
||||
length56 = PSSprite.textWidth(radio.rds.stationName.substring(4, 6)) + length34;
|
||||
|
||||
if (!RDSstatus || band > BAND_GAP) {
|
||||
PSSprite.setTextColor(RDSDropoutColor, RDSDropoutColorSmooth, false);
|
||||
} else {
|
||||
PSSprite.setTextColor((radio.rds.ps12error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(0, 2), 0, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps34error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(2, 4), length12, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps56error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(4, 6), length34, 2);
|
||||
PSSprite.setTextColor((radio.rds.ps78error ? RDSDropoutColor : RDSColor), (radio.rds.ps12error ? RDSDropoutColorSmooth : RDSColorSmooth), false);
|
||||
PSSprite.drawString(radio.rds.stationName.substring(6, 8), length56, 2);
|
||||
}
|
||||
|
||||
if (PSold.substring(0, 2) != radio.rds.stationName.substring(0, 2)) ps12errorold = true;
|
||||
if (PSold.substring(2, 4) != radio.rds.stationName.substring(2, 4)) ps34errorold = true;
|
||||
if (PSold.substring(4, 6) != radio.rds.stationName.substring(4, 6)) ps56errorold = true;
|
||||
if (PSold.substring(6, 8) != radio.rds.stationName.substring(6, 8)) ps78errorold = true;
|
||||
if (ps12errorold && PSold.substring(0, 2) != radio.rds.stationName.substring(0, 2)) ps12errorold = radio.rds.ps12error;
|
||||
if (ps34errorold && PSold.substring(2, 4) != radio.rds.stationName.substring(2, 4)) ps34errorold = radio.rds.ps34error;
|
||||
if (ps56errorold && PSold.substring(4, 6) != radio.rds.stationName.substring(4, 6)) ps56errorold = radio.rds.ps56error;
|
||||
if (ps78errorold && PSold.substring(6, 8) != radio.rds.stationName.substring(6, 8)) ps78errorold = radio.rds.ps78error;
|
||||
}
|
||||
if (!screenmute) {
|
||||
if (advancedRDS) {
|
||||
|
||||
Reference in New Issue
Block a user