Added RDS filter option

You can now select RDS filter on/off in the menu.

Off: RDS data can be dirty, but is very fast.

On: RDS data is buffered and filtered by the TEF668x.
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-06-18 23:03:37 +02:00
parent f0205d785b
commit abf5dd1256
6 changed files with 93 additions and 27 deletions
+18 -4
View File
@@ -2,6 +2,7 @@
#include <map>
#include <Arduino.h>
unsigned long rdstimer = 0;
void TEF6686::init(byte TEF) {
uint8_t bootstatus;
@@ -221,9 +222,21 @@ bool TEF6686::getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel,
void TEF6686::readRDS(bool showrdserrors)
{
uint16_t rdsStat;
uint16_t result = devTEF_Radio_Get_RDS_Data(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
uint8_t offset;
bool rdsReady;
if (rds.filter) {
devTEF_Radio_Get_RDS_Status(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
} else {
if (millis() >= rdstimer + 87) {
rdstimer += 87;
devTEF_Radio_Get_RDS_Data(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
if ((rdsStat & (1 << 14))) {
for (int i = 0; i < 22; i++) devTEF_Radio_Get_RDS_Data(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
}
}
}
if (rds.rdsB != rdsBprevious && rds.rdsC != rdsCprevious && rds.rdsD != rdsDprevious) {
rds.correct = false;
rds.hasRDS = false;
@@ -233,9 +246,10 @@ void TEF6686::readRDS(bool showrdserrors)
if (((rds.rdsErr >> 10) & 0x02) > 1) rds.rdsCerror = true; else rds.rdsCerror = false; // Any errors in Block C?
if (((rds.rdsErr >> 8) & 0x02) > 1) rds.rdsDerror = true; else rds.rdsDerror = false; // Any errors in Block D?
if (!rds.rdsAerror && !rds.rdsBerror && !rds.rdsCerror && !rds.rdsDerror) rds.correct = true; // Any errors in all blocks?
if ((rdsStat & (1 << 15)) && (rdsStat & (1 << 9))) rds.hasRDS = true; // RDS decoder synchronized and data available
if ((rdsStat & (1 << 9))) rds.hasRDS = true; // RDS decoder synchronized and data available
if ((rdsStat & (1 << 15))) rdsReady = true;
if (rds.hasRDS) { // We have all data to decode... let's go...
if (rdsReady) { // We have all data to decode... let's go...
//PI decoder
if (rds.region == 0 && !correctpi) {
+1
View File
@@ -193,6 +193,7 @@ typedef struct _rds_ {
bool hasCT;
bool rtAB;
bool correct;
bool filter;
bool underscore;
bool rdsreset;
} rds_;
+13 -1
View File
@@ -229,7 +229,7 @@ bool devTEF_Radio_Get_Quality_Status_AM (int16_t *level, uint16_t *noise, uint16
}
bool devTEF_Radio_Get_RDS_Data (uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error) {
bool devTEF_Radio_Get_RDS_Status (uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error) {
uint8_t buf[12];
uint8_t r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_RDS_Status, buf, sizeof(buf));
*status = Convert8bto16b(buf);
@@ -241,6 +241,18 @@ bool devTEF_Radio_Get_RDS_Data (uint16_t *status, uint16_t *A_block, uint16_t *B
return r;
}
bool devTEF_Radio_Get_RDS_Data (uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error) {
uint8_t buf[12];
uint8_t r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_RDS_Data, buf, sizeof(buf));
*status = Convert8bto16b(buf);
*A_block = Convert8bto16b(buf + 2);
*B_block = Convert8bto16b(buf + 4);
*C_block = Convert8bto16b(buf + 6);
*D_block = Convert8bto16b(buf + 8);
*dec_error = Convert8bto16b(buf + 10);
return r;
}
bool devTEF_Radio_Get_Stereo_Status(uint16_t *status) {
uint8_t buf[2];
uint16_t r = devTEF_Get_Cmd(TEF_FM, Cmd_Get_Signal_Status, buf, sizeof(buf));
+2
View File
@@ -39,6 +39,7 @@ typedef enum {
Cmd_Get_Quality_Status = 128,
Cmd_Get_Quality_Data = 129,
Cmd_Get_RDS_Status = 130,
Cmd_Get_RDS_Data = 131,
Cmd_Get_Signal_Status = 133,
Cmd_Get_Processing_Status = 134
} TEF_RADIO_COMMAND;
@@ -71,6 +72,7 @@ bool devTEF_Audio_Set_Mute(uint8_t mode);
bool devTEF_Audio_Set_Volume(int16_t volume);
bool devTEF_Radio_Get_Stereo_Status(uint16_t *status);
bool devTEF_APPL_Set_OperationMode(bool mode);
bool devTEF_Radio_Get_RDS_Status(uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error);
bool devTEF_Radio_Get_RDS_Data(uint16_t *status, uint16_t *A_block, uint16_t *B_block, uint16_t *C_block, uint16_t *D_block, uint16_t *dec_error);
bool devTEF_Radio_Set_Bandwidth(uint8_t mode, uint16_t bandwidth, uint16_t control_sensitivity, uint16_t low_level_sensitivity);
bool devTEF_Radio_Set_BandwidthAM(uint8_t mode, uint16_t bandwidth, uint16_t control_sensitivity, uint16_t low_level_sensitivity);
+28 -19
View File
@@ -1,6 +1,6 @@
// [number of languages][number of texts][max. length of text]
static const char myLanguage[9][60][78] = {
static const char myLanguage[9][61][78] = {
{ "English", // English
"Rotary direction changed",
"Please release button",
@@ -59,8 +59,9 @@ static const char myLanguage[9][60][78] = {
"Trying to connect with Wi-Fi",
"FAILED.. WiFi disabled",
"CONNECTED!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Nederlands", // Dutch
@@ -121,8 +122,9 @@ static const char myLanguage[9][60][78] = {
"Verbinden met Wi-Fi...",
"MISLUKT.. WiFi uitgeschakeld",
"VERBONDEN!",
"Stationlist client IP",
"Toon SW golflengte"
"Stationlist client IP",
"Toon SW golflengte",
"RDS filter"
},
{ "Polski", // Polish
@@ -183,8 +185,9 @@ static const char myLanguage[9][60][78] = {
"Proba polaczenia z Wi-Fi",
"BLAD.. WiFi wylaczone",
"POLACZONO!",
"IP klienta Stationlist",
"Pokaz dlugosci fal SW"
"IP klienta Stationlist",
"Pokaz dlugosci fal SW",
"RDS filter"
},
{ "Hrvatski", // Croatian
@@ -245,8 +248,9 @@ static const char myLanguage[9][60][78] = {
"Spajanje s Wi-Fi mrežom..",
"NEUSPJEŠNO.. Wi-Fi onemogućen",
"SPOJENO!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Ελληνικά", // Greek
@@ -307,8 +311,9 @@ static const char myLanguage[9][60][78] = {
"Προσπάθεια σύνδεσης με το Wi-Fi",
"ΑΠΟΤΥΧΙΑ.. WiFi ανενεργό",
"ΣΕ ΣΥΝΔΕΣΗ!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Romana", // Romanian
@@ -369,8 +374,9 @@ static const char myLanguage[9][60][78] = {
"Trying to connect with Wi-Fi",
"FAILED.. WiFi disabled",
"CONNECTED!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Deutsch", // German
@@ -431,8 +437,9 @@ static const char myLanguage[9][60][78] = {
"Versuche WLAN zu verbinden",
"FEHLER.. WLAN deaktiviert",
"VERBUNDEN!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Czech", // Czech
"Směr enkóderu byl změněn",
@@ -492,8 +499,9 @@ static const char myLanguage[9][60][78] = {
"Trying to connect with Wi-Fi",
"FAILED.. WiFi disabled",
"CONNECTED!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
{ "Slovak", // Slovak
"Smer enkóderu bol zmenený",
@@ -553,7 +561,8 @@ static const char myLanguage[9][60][78] = {
"Trying to connect with Wi-Fi",
"FAILED.. WiFi disabled",
"CONNECTED!",
"Stationlist client IP",
"Show SW wavelength"
"Stationlist client IP",
"Show SW wavelength",
"RDS filter"
},
};