From 3ca589788bf04e171b8fbfb3c598d518ae2bf8b4 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Thu, 23 Nov 2023 21:57:30 +0100 Subject: [PATCH] Improvement AF method B detector --- src/TEF6686.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 62ec32b..534798d 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -629,6 +629,18 @@ void TEF6686::readRDS(byte showrdserrors) } if (afinit) { + /* Debug info + if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250) { + Serial.print("#"); + Serial.print((rds.rdsC >> 8) - 224); + Serial.print("\t"); + Serial.println((rds.rdsC & 0xFF) * 10 + 8750); + } else { + Serial.print((rds.rdsC >> 8) * 10 + 8750); + Serial.print("\t"); + Serial.println((rds.rdsC & 0xFF) * 10 + 8750); + } + */ if ((rds.rdsC >> 8) > 224 && (rds.rdsC >> 8) < 250 && ((rds.rdsC & 0xFF) * 10 + 8750) == currentfreq && rds.hasAF) { if (afmethodBtrigger) afmethodB = true; // Check for AF method B afmethodBprobe = true; @@ -660,7 +672,7 @@ void TEF6686::readRDS(byte showrdserrors) if ((rds.rdsC & 0xFF) > 0 && (rds.rdsC & 0xFF) < 205) buffer1 = (rds.rdsC & 0xFF) * 10 + 8750; else buffer1 = 0; if (((rds.rdsC >> 8) > 0 && (rds.rdsC >> 8) < 205) && (buffer0 == doubletestfreq || buffer1 == doubletestfreq)) doublecounter++; - if (doublecounter > (af_number / 2 - 2)) afmethodB = true; // If signed frequency also appears more than once in the AF list, AF Method B detected + if (doublecounter > (af_number / 2)) afmethodB = true; // If signed frequency also appears more than once in the AF list, AF Method B detected if (afmethodBprobe && af_counterbcheck > af_counterb) afmethodBprobe = false; // If more than counter received disable probe flag