From db9e4711176907c69f7a8ef54a94ce400fd79910 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Fri, 6 Oct 2023 15:43:25 +0200 Subject: [PATCH] Improved TMC detection --- TEF6686_ESP32.ino | 10 ++++++---- src/TEF6686.cpp | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index e2a7f3c..4f46737 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -2722,8 +2722,11 @@ void doTuneMode() { switch (tunemode) { case TUNE_MAN: if (band == BAND_SW) { - if (showSWMIBand && nowToggleSWMIBand) tunemode = TUNE_MI_BAND; - else tunemode = TUNE_AUTO; + if (showSWMIBand && nowToggleSWMIBand) { + tunemode = TUNE_MI_BAND; + } else { + tunemode = TUNE_AUTO; + } } else { tunemode = TUNE_AUTO; } @@ -2733,6 +2736,7 @@ void doTuneMode() { ShowStepSize(); } break; + case TUNE_MI_BAND: case TUNE_AUTO: tunemode = TUNE_MEM; @@ -2754,12 +2758,10 @@ void ShowTuneMode() { case TUNE_MAN: if (band == BAND_SW && nowToggleSWMIBand) { tftPrint(0, "AUTO", 22, 60, BackgroundColor, BackgroundColor, 16); - tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tftPrint(0, "BAND", 22, 60, GreyoutColor, BackgroundColor, 16); } else { tftPrint(0, "BAND", 22, 60, BackgroundColor, BackgroundColor, 16); - tft.drawRoundRect(1, 57, 42, 20, 5, GreyoutColor); tftPrint(0, "AUTO", 22, 60, GreyoutColor, BackgroundColor, 16); } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index df27bc1..1868226 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -618,6 +618,8 @@ void TEF6686::readRDS(byte showrdserrors) } } + if (rds.rdsC >> 12 == 1) rds.hasTMC = true; // TMC flag + if (!rdsDerrorThreshold) { if (rds.rdsD != 0) { // PIN decoder rds.hasPIN = true; @@ -812,7 +814,7 @@ void TEF6686::readRDS(byte showrdserrors) rds.RTContent2 = convertToUTF8(RTtext2); // Convert RDS characterset to ASCII rds.RTContent2 = extractUTF8Substring(rds.RTContent2, 0, 44, false); // Make sure RT does not exceed 32 characters } - if (!rdsBerrorThreshold && rdsblock == 16 && (rds.rdsB & (1 << 4))) rds.hasTMC = true; // TMC flag + if (!rdsBerrorThreshold && rdsblock == 16 && (bitRead(rds.rdsB, 15))) rds.hasTMC = true; // TMC flag } break;