From 279fc96c9a9f68091e1f1244a11c2baabe60c925 Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Sat, 22 Jul 2023 00:12:36 +0200 Subject: [PATCH] Changes for XDRGTK - Changed bandscanner - Enabled Advanced RDS viewer --- TEF6686_ESP32.ino | 22 +++++++++------------- src/TEF6686.cpp | 19 +++++++++++++++++++ src/TEF6686.h | 1 + 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index 31e5f3a..c59c825 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -609,7 +609,7 @@ void setup() { } void loop() { - if (digitalRead(BANDBUTTON) == LOW && XDRGTKUSB == false && XDRGTKTCP == false) BANDBUTTONPress(); + if (digitalRead(BANDBUTTON) == LOW ) BANDBUTTONPress(); if (power == true) { Communication(); @@ -1409,7 +1409,7 @@ void doStereoToggle() { tft.drawSmoothCircle(81, 15, 9, BackgroundColor, BackgroundColor); tft.drawSmoothCircle(91, 15, 10, BackgroundColor, BackgroundColor); tft.drawSmoothCircle(91, 15, 9, BackgroundColor, BackgroundColor); - tft.drawSmoothCircle(86, 15, 10, SecondaryColor,SecondaryColorSmooth); + tft.drawSmoothCircle(86, 15, 10, SecondaryColor, SecondaryColorSmooth); tft.drawSmoothCircle(86, 15, 9, SecondaryColor, SecondaryColorSmooth); } radio.setMono(true); @@ -4996,6 +4996,8 @@ void XDRGTKRoutine() { radio.clearRDS(fullsearchrds); RDSstatus = false; store = true; + aftest = true; + aftimer = millis(); break; case 'Q': @@ -5020,7 +5022,6 @@ void XDRGTKRoutine() { scanner_filter = atol(buff + 2); } else if (scanner_start > 0 && scanner_end > 0 && scanner_step > 0 && scanner_filter >= 0) { frequencyold = frequency; - radio.SetFreq(scanner_start); DataPrint("U"); if (scanner_filter < 0) { BWset = 0; @@ -5059,26 +5060,21 @@ void XDRGTKRoutine() { } doBW(); if (screenmute == false) { - ShowFreq(1); - tftPrint(0, myLanguage[language][34], 140, 68, ActiveColor, ActiveColorSmooth, FONT28); + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + tftPrint(0, myLanguage[language][34], 160, 100, ActiveColor, ActiveColorSmooth, FONT28); } frequencyold = frequency; for (freq_scan = scanner_start; freq_scan <= scanner_end; freq_scan += scanner_step) { - radio.SetFreq(freq_scan); DataPrint(String(freq_scan * 10, DEC)); DataPrint(" = "); - delay(10); if (band == BAND_FM) radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); else radio.getStatusAM(SStatus, USN, WAM, OStatus, BW, MStatus, SNR); - DataPrint(String((SStatus / 10) + 10, DEC)); + DataPrint(String((radio.CheckSignal(freq_scan) / 10) + 10, DEC)); DataPrint(", "); } DataPrint("\n"); - if (screenmute == false) { - tft.setTextColor(BackgroundColor); - tftPrint(0, myLanguage[language][34], 140, 68, InsignificantColor, InsignificantColorSmooth, FONT28); - } radio.SetFreq(frequencyold); - ShowFreq(0); + BuildDisplay(); radio.setFMABandw(); BWset = 0; } diff --git a/src/TEF6686.cpp b/src/TEF6686.cpp index 9a0dd7a..b984503 100644 --- a/src/TEF6686.cpp +++ b/src/TEF6686.cpp @@ -50,6 +50,25 @@ void TEF6686::TestAFEON() { if (!mute) devTEF_Audio_Set_Mute(0); } +uint16_t TEF6686::CheckSignal(uint16_t frequency) { + uint16_t status; + uint16_t rdsStat; + uint16_t dummy1; + uint16_t dummy2; + uint8_t dummy3; + int16_t level; + uint16_t usn; + uint16_t wam; + int16_t offset; + byte timing = 0; + devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 7, 3, frequency); + while (timing == 0 && !bitRead(timing, 15)) { + devTEF_Radio_Get_Quality_Status(&status, &level, &usn, &wam, &offset, &dummy1, &dummy2, &dummy3); + timing = lowByte(status); + } + return level; +} + uint16_t TEF6686::TestAF() { if (af_counter != 0) { uint16_t status; diff --git a/src/TEF6686.h b/src/TEF6686.h index 9a5ce79..7afb607 100644 --- a/src/TEF6686.h +++ b/src/TEF6686.h @@ -175,6 +175,7 @@ class TEF6686 { eon_ eon[20]; rds_ rds; logbook_ logbook[22]; + uint16_t CheckSignal(uint16_t frequency); uint16_t TestAF(); void TestAFEON(); void readRDS(bool showrdserrors);