More work on EON in API
This commit is contained in:
+51
-33
@@ -31,6 +31,7 @@ void TEF6686::power(bool mode) {
|
|||||||
|
|
||||||
void TEF6686::SetFreq(uint16_t frequency) {
|
void TEF6686::SetFreq(uint16_t frequency) {
|
||||||
devTEF_Radio_Tune_To(frequency);
|
devTEF_Radio_Tune_To(frequency);
|
||||||
|
currentfreq = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEF6686::SetFreqAM(uint16_t frequency) {
|
void TEF6686::SetFreqAM(uint16_t frequency) {
|
||||||
@@ -561,42 +562,47 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
|
|
||||||
case RDS_GROUP_14A: {
|
case RDS_GROUP_14A: {
|
||||||
if (rds.correct) rds.hasEON = true; // Group is there, so we have EON
|
if (rds.correct) rds.hasEON = true; // Group is there, so we have EON
|
||||||
}
|
|
||||||
/* offset = rds.rdsB & 0x0F; // Let's get the character offset for PS
|
bool isValuePresent = false;
|
||||||
if (offset < 4 && rds.rdsD == 0x8202) {
|
for (int i = 0; i < 5; i++) {
|
||||||
eon_buffer[(offset * 2) + 0] = rds.rdsC >> 8; // First character of segment
|
if (eon[i].pi == rds.rdsD) {
|
||||||
eon_buffer[(offset * 2) + 1] = rds.rdsC & 0xFF; // Second character of segment
|
isValuePresent = true;
|
||||||
eon_buffer[(offset * 2) + 2] = '\0'; // Endmarker of segment
|
break;
|
||||||
// Serial.println(eon_buffer);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset == 4 && rds.rdsD == 0x8202) {
|
if (!isValuePresent) {
|
||||||
uint8_t af_controlCode = rds.rdsC >> 8;
|
eon[eon_counter].pi = rds.rdsD;
|
||||||
if ((af_controlCode < 224) && (af_counter < 50)) {
|
eon_counter++;
|
||||||
uint16_t buffer0 = (rds.rdsC >> 8);
|
|
||||||
uint16_t buffer1 = (rds.rdsC & 0xFF);
|
|
||||||
rds.hasAF = true;
|
|
||||||
if (buffer0 != 0 && buffer1 != 0) {
|
|
||||||
buffer0 = buffer0 * 10 + 8750;
|
|
||||||
buffer1 = buffer1 * 10 + 8750;
|
|
||||||
bool isDouble = false;
|
|
||||||
isDouble = checkDouble(buffer0);
|
|
||||||
if (!isDouble && buffer0 != 0) {
|
|
||||||
af[af_counter].frequency = buffer0;
|
|
||||||
af_counter++;
|
|
||||||
}
|
|
||||||
isDouble = checkDouble(buffer1);
|
|
||||||
if (!isDouble && buffer1 != 0) {
|
|
||||||
af[af_counter].frequency = buffer1;
|
|
||||||
af_counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Serial.println(String(af[0].frequency));
|
|
||||||
Serial.println(String(af[1].frequency));
|
|
||||||
Serial.println(String(af[2].frequency));
|
|
||||||
}
|
}
|
||||||
*/ break;
|
|
||||||
|
offset = rds.rdsB & 0x0F;
|
||||||
|
if (offset < 4) {
|
||||||
|
byte position;
|
||||||
|
for (position = 0; position < 5; position++) {
|
||||||
|
if (eon[position].pi == rds.rdsD) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eon[position].ps[(offset * 2) + 0] = rds.rdsC >> 8; // First character of segment
|
||||||
|
eon[position].ps[(offset * 2) + 1] = rds.rdsC & 0xFF; // Second character of segment
|
||||||
|
eon[position].ps[(offset * 2) + 2] = '\0'; // Endmarker of segment
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (offset == 5 && rds.rdsD == 0xF202) {
|
||||||
|
// if (((rds.rdsC >> 8) * 10 +8750) == currentfreq) {
|
||||||
|
// uint16_t mapped = ((rds.rdsC & 0xFF) * 10 + 8750);
|
||||||
|
// Serial.print(currentfreq);
|
||||||
|
// Serial.print("\t");
|
||||||
|
// Serial.println(mapped);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for (int i = 0; i < 5; i++) Serial.println(String(i) + "\t" + String(eon[i].pi,HEX) + "\t" + String(eon[i].ps));
|
||||||
|
// Serial.println("----");
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rdsBprevious = rds.rdsB;
|
rdsBprevious = rds.rdsB;
|
||||||
@@ -611,6 +617,12 @@ bool TEF6686::checkDouble (uint16_t value)
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TEF6686::checkDoubleEON (uint16_t value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 5; i++) if (eon[i].pi == value)return (true);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
void TEF6686::clearRDS (bool fullsearchrds)
|
void TEF6686::clearRDS (bool fullsearchrds)
|
||||||
{
|
{
|
||||||
devTEF_Radio_Set_RDS(fullsearchrds);
|
devTEF_Radio_Set_RDS(fullsearchrds);
|
||||||
@@ -632,6 +644,11 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
|||||||
for (i = 0; i < 6; i++) rds.picode[i] = 0;
|
for (i = 0; i < 6; i++) rds.picode[i] = 0;
|
||||||
for (i = 0; i < 50; i++) af[i].frequency = 0;
|
for (i = 0; i < 50; i++) af[i].frequency = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
eon[i].pi = 0;
|
||||||
|
for (int y = 0; y < 9; y++) eon[i].ps[y] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 45; i++) {
|
for (i = 0; i < 45; i++) {
|
||||||
musicArtist[i] = 0;
|
musicArtist[i] = 0;
|
||||||
musicTitle[i] = 0;
|
musicTitle[i] = 0;
|
||||||
@@ -662,6 +679,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
|||||||
rds.hasStereo = false;
|
rds.hasStereo = false;
|
||||||
ps_counter = 0;
|
ps_counter = 0;
|
||||||
af_counter = 0;
|
af_counter = 0;
|
||||||
|
eon_counter = 0;
|
||||||
rds.MS = 0;
|
rds.MS = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,10 +140,17 @@ typedef struct _af_ {
|
|||||||
uint16_t frequency;
|
uint16_t frequency;
|
||||||
} af_;
|
} af_;
|
||||||
|
|
||||||
|
typedef struct _eon_ {
|
||||||
|
uint16_t mappedfreq;
|
||||||
|
uint16_t pi;
|
||||||
|
char ps[9];
|
||||||
|
} eon_;
|
||||||
|
|
||||||
|
|
||||||
class TEF6686 {
|
class TEF6686 {
|
||||||
public:
|
public:
|
||||||
af_ af[50];
|
af_ af[50];
|
||||||
|
eon_ eon[5];
|
||||||
rds_ rds;
|
rds_ rds;
|
||||||
void readRDS(bool showrdserrors);
|
void readRDS(bool showrdserrors);
|
||||||
void SetFreq(uint16_t frequency);
|
void SetFreq(uint16_t frequency);
|
||||||
@@ -202,6 +209,8 @@ class TEF6686 {
|
|||||||
char rt_buffer2[65];
|
char rt_buffer2[65];
|
||||||
bool useRTPlus = true;
|
bool useRTPlus = true;
|
||||||
bool checkDouble (uint16_t value);
|
bool checkDouble (uint16_t value);
|
||||||
|
bool checkDoubleEON (uint16_t value);
|
||||||
|
byte eon_counter;
|
||||||
bool ABold;
|
bool ABold;
|
||||||
char stationTextBuffer[65];
|
char stationTextBuffer[65];
|
||||||
uint64_t doublecheck;
|
uint64_t doublecheck;
|
||||||
@@ -216,4 +225,5 @@ class TEF6686 {
|
|||||||
char musicTitle[45];
|
char musicTitle[45];
|
||||||
char stationHost[45];
|
char stationHost[45];
|
||||||
char stationEvent[45];
|
char stationEvent[45];
|
||||||
|
uint16_t currentfreq;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user