You've already forked TEF6686_ESP32
API update
Removed ASCII converter, since it was not working ;-) Hopefully fixed the CT when time is at midnight. Added option to hide RDS errors: showrdserrors = true Do show always showrdserrors = false Only show errorless RDS
This commit is contained in:
@@ -250,7 +250,7 @@ bool TEF6686::getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel,
|
||||
return modulation;
|
||||
}
|
||||
|
||||
bool TEF6686::readRDS()
|
||||
bool TEF6686::readRDS(bool showrdserrors)
|
||||
{
|
||||
char status;
|
||||
uint16_t rdsStat = 0, rdsErr = 65535, rdsErrA = 65535, rdsErrB = 65535, rdsErrC = 65535, rdsErrD = 65535;
|
||||
@@ -270,7 +270,9 @@ bool TEF6686::readRDS()
|
||||
rdsErrCheck = rdsErr == 0;
|
||||
rdsDataReady = ((rdsStat & (1 << 15)) && (rdsStat & (1 << 9)));
|
||||
rds.errors = rdsErr;
|
||||
if (rdsDataReady)
|
||||
bool x;
|
||||
if (showrdserrors == false) x = rdsErrCheck; else x = true;
|
||||
if (rdsDataReady && x)
|
||||
{
|
||||
//PI
|
||||
if (rds.stationID == 0) rds.stationID = rds.rdsA;
|
||||
@@ -294,8 +296,8 @@ bool TEF6686::readRDS()
|
||||
if ((offset == 0) && (ps_process == 0)) ps_process = 1;
|
||||
|
||||
if (ps_process == 1) {
|
||||
ps_buffer[(offset * 2) + 0] = ascii_converter(rds.rdsD >> 8);
|
||||
ps_buffer[(offset * 2) + 1] = ascii_converter(rds.rdsD & 0xFF);
|
||||
ps_buffer[(offset * 2) + 0] = rds.rdsD >> 8;
|
||||
ps_buffer[(offset * 2) + 1] = rds.rdsD & 0xFF;
|
||||
ps_buffer[(offset * 2) + 2] = 0;
|
||||
ps_process = strlen(ps_buffer) == 8 ? 2 : 1;
|
||||
}
|
||||
@@ -381,10 +383,10 @@ bool TEF6686::readRDS()
|
||||
if (rt_process == 1)
|
||||
{
|
||||
rds.stationTextOffset = offset;
|
||||
rt_buffer[offset + 0] = ascii_converter(rds.rdsC >> 8);
|
||||
rt_buffer[offset + 1] = ascii_converter(rds.rdsC & 0xff);
|
||||
rt_buffer[offset + 2] = ascii_converter(rds.rdsD >> 8);
|
||||
rt_buffer[offset + 3] = ascii_converter(rds.rdsD & 0xff);
|
||||
rt_buffer[offset + 0] = rds.rdsC >> 8;
|
||||
rt_buffer[offset + 1] = rds.rdsC & 0xff;
|
||||
rt_buffer[offset + 2] = rds.rdsD >> 8;
|
||||
rt_buffer[offset + 3] = rds.rdsD & 0xff;
|
||||
|
||||
if (offset > offsetold) offsetold = offset;
|
||||
|
||||
@@ -516,23 +518,6 @@ bool TEF6686::readRDS()
|
||||
return rdsDataReady;
|
||||
}
|
||||
|
||||
uint8_t TEF6686::ascii_converter (uint8_t src)
|
||||
{
|
||||
char dest = src;
|
||||
switch (src)
|
||||
{
|
||||
case 0x91: dest = 225; break; //ä
|
||||
case 0x97: dest = 239; break; //ö
|
||||
case 0x99: dest = 245; break; //ü
|
||||
case 0xD1: dest = 225; break; //Ä
|
||||
case 0xD7: dest = 239; break; //Ö
|
||||
case 0xD9: dest = 245; break; //Ü
|
||||
case 0x8D: dest = 226; break; //ß
|
||||
case 0xBB: dest = 223; break; //°
|
||||
}
|
||||
return (dest);
|
||||
}
|
||||
|
||||
bool TEF6686::checkDouble (uint16_t value)
|
||||
{
|
||||
for (int i = 0; i < 50; i++) if (af[i].frequency == value)return (true);
|
||||
|
||||
@@ -54,7 +54,7 @@ class TEF6686 {
|
||||
public:
|
||||
af_ af[50];
|
||||
rds_ rds;
|
||||
bool readRDS(void);
|
||||
bool readRDS(bool showrdserrors);
|
||||
void SetFreq(uint16_t frequency);
|
||||
void SetFreqAM(uint16_t frequency);
|
||||
bool getProcessing(uint16_t &highcut, uint16_t &stereo, uint16_t &sthiblend, uint8_t &stband_1, uint8_t &stband_2, uint8_t &stband_3, uint8_t &stband_4);
|
||||
@@ -97,8 +97,7 @@ class TEF6686 {
|
||||
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
|
||||
|
||||
private:
|
||||
uint8_t ascii_converter (uint8_t src);
|
||||
uint16_t rdsTimeOut = 32768;
|
||||
uint16_t rdsTimeOut = 32768;
|
||||
uint8_t ps_process;
|
||||
uint8_t rt_process;
|
||||
char ps_buffer[9];
|
||||
|
||||
Reference in New Issue
Block a user