Added check for AF method B

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-09-06 16:31:31 +02:00
parent 7472c96df4
commit 7e3b9b72a7
3 changed files with 22 additions and 6 deletions
+17 -3
View File
@@ -529,6 +529,12 @@ void TEF6686::readRDS(byte showrdserrors)
if (!rdsCerrorThreshold) {
//AF decoder
if (rdsblock == 0) { // Only when in GROUP 0A
if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250) {
if (afmethodcounter > 2) afmethodB == true;
afmethodcounter = 0;
}
if (((rds.rdsC >> 8) > 0 && (rds.rdsC >> 8) > 224) && ((rds.rdsC >> 8) > 0 && (rds.rdsC >> 8) < 250)) afinit = true;
if (afinit) {
if ((rds.rdsB >> 11) == 0 && af_counter < 50) {
@@ -549,7 +555,10 @@ void TEF6686::readRDS(byte showrdserrors)
if (!isValuePresent) {
af[af_counter].frequency = buffer0;
if (buffer1 == currentfreq && buffer0 > buffer1) af[af_counter].regional = true;
if (buffer1 == currentfreq && buffer0 > buffer1) {
af[af_counter].regional = true;
afmethodcounter++;
}
if (af_counter < 50) af_counter++;
}
@@ -563,7 +572,10 @@ void TEF6686::readRDS(byte showrdserrors)
if (!isValuePresent) {
af[af_counter].frequency = buffer1;
if (buffer0 == currentfreq && buffer0 < buffer1) af[af_counter].regional = true;
if (buffer0 == currentfreq && buffer0 < buffer1) {
af[af_counter].regional = true;
afmethodcounter++;
}
if (af_counter < 50) af_counter++;
}
@@ -602,7 +614,7 @@ void TEF6686::readRDS(byte showrdserrors)
rds.hasECC = true;
}
if (rds.rdsC >> 12 == 3) { // ECC code readout
if (rds.rdsC >> 12 == 3) { // LIC code readout
rds.LIC = rds.rdsC & 0xff;
rds.hasLIC = true;
}
@@ -980,6 +992,8 @@ void TEF6686::clearRDS (bool fullsearchrds)
rds.rdsplusTag2 = 169;
afinit = false;
errorfreepi = false;
afmethodB = false;
afmethodcounter = 0;
}
void TEF6686::tone(uint16_t time, int16_t amplitude, uint16_t frequency) {
+2
View File
@@ -256,6 +256,7 @@ class TEF6686 {
uint8_t rdsblock;
uint8_t rtplusblock;
bool mute;
bool afmethodB;
private:
void RDScharConverter(const char* input, wchar_t* output, size_t size, bool under);
@@ -297,6 +298,7 @@ class TEF6686 {
bool rdsBerrorThreshold;
bool rdsCerrorThreshold;
bool rdsDerrorThreshold;
byte afmethodcounter;
};
#endif
+3 -3
View File
@@ -809,11 +809,11 @@ void ShowAFEON() {
for (byte i = 0; i < radio.af_counter; i++) {
byte x = i - (afpagenr == 2 ? 30 : 0);
if (radio.af[i].checked) {
if (!screenmute) tftPrint(1, (radio.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16);
if (!screenmute) tftPrint(1, (radio.af[i].regional && radio.afmethodB ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), InsignificantColor, InsignificantColorSmooth, 16);
} else if (!radio.af[i].afvalid) {
if (!screenmute) tftPrint(1, (radio.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16);
if (!screenmute) tftPrint(1, (radio.af[i].regional && radio.afmethodB ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), SignificantColor, SignificantColorSmooth, 16);
} else {
if (!screenmute) tftPrint(1, (radio.af[i].regional ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), PrimaryColor, PrimaryColorSmooth, 16);
if (!screenmute) tftPrint(1, (radio.af[i].regional && radio.afmethodB ? "R " : "") + String(radio.af[i].frequency / 100) + "." + String((radio.af[i].frequency % 100) / 10), 50 + (x > 9 ? 54 : 0) + (x > 19 ? 54 : 0), 48 + (15 * x) - (x > 9 ? 150 : 0) - (x > 19 ? 150 : 0), PrimaryColor, PrimaryColorSmooth, 16);
}
if (i == 29 + (afpagenr == 2 ? 30 : 0)) i = 254;
}