Added PIN, extended EON to 20 positions
This commit is contained in:
+16
-8
@@ -394,11 +394,9 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
|
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
for (int j = 0; j < 50 - i; j++) {
|
for (int j = 0; j < 50 - i; j++) {
|
||||||
// Ignore elements with value 0
|
|
||||||
if (af[j].frequency == 0) continue;
|
if (af[j].frequency == 0) continue;
|
||||||
|
|
||||||
if (af[j].frequency > af[j + 1].frequency && af[j + 1].frequency != 0) {
|
if (af[j].frequency > af[j + 1].frequency && af[j + 1].frequency != 0) {
|
||||||
// Swap the elements
|
|
||||||
uint16_t temp = af[j].frequency;
|
uint16_t temp = af[j].frequency;
|
||||||
bool temp2 = af[j].filler;
|
bool temp2 = af[j].filler;
|
||||||
af[j].frequency = af[j + 1].frequency;
|
af[j].frequency = af[j + 1].frequency;
|
||||||
@@ -414,15 +412,22 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
|
|
||||||
case RDS_GROUP_1A: {
|
case RDS_GROUP_1A: {
|
||||||
if (rds.correct) {
|
if (rds.correct) {
|
||||||
if (rds.rdsC >> 12 == 0) { // ECC code readout
|
if (rds.rdsC >> 12 == 0) { // ECC code readout
|
||||||
rds.ECC = rds.rdsC & 0xff;
|
rds.ECC = rds.rdsC & 0xff;
|
||||||
rds.hasECC = true;
|
rds.hasECC = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rds.rdsC >> 12 == 3) { // ECC code readout
|
if (rds.rdsC >> 12 == 3) { // ECC code readout
|
||||||
rds.LIC = rds.rdsC & 0xff;
|
rds.LIC = rds.rdsC & 0xff;
|
||||||
rds.hasLIC = true;
|
rds.hasLIC = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rds.rdsD != 0) { // PIN decoder
|
||||||
|
rds.hasPIN = true;
|
||||||
|
rds.pinMin = rds.rdsD & 0x3f;
|
||||||
|
rds.pinHour = rds.rdsD >> 6 & 0x1f;
|
||||||
|
rds.pinDay = rds.rdsD >> 11 & 0x1f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@@ -601,7 +606,7 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
rds.hasEON = true; // Group is there, so we have EON
|
rds.hasEON = true; // Group is there, so we have EON
|
||||||
|
|
||||||
bool isValuePresent = false;
|
bool isValuePresent = false;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
if (eon[i].pi == rds.rdsD) { // Check if EON is already in array
|
if (eon[i].pi == rds.rdsD) { // Check if EON is already in array
|
||||||
isValuePresent = true;
|
isValuePresent = true;
|
||||||
break;
|
break;
|
||||||
@@ -610,14 +615,14 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
|
|
||||||
if (!isValuePresent) {
|
if (!isValuePresent) {
|
||||||
eon[eon_counter].pi = rds.rdsD; // Store PI on next array
|
eon[eon_counter].pi = rds.rdsD; // Store PI on next array
|
||||||
if (eon_counter < 5) eon_counter++;
|
if (eon_counter < 20) eon_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = rds.rdsB & 0x0F; // Read offset
|
offset = rds.rdsB & 0x0F; // Read offset
|
||||||
|
|
||||||
if (offset < 4) {
|
if (offset < 4) {
|
||||||
byte position;
|
byte position;
|
||||||
for (position = 0; position < 5; position++) {
|
for (position = 0; position < 20; position++) {
|
||||||
if (eon[position].pi == rds.rdsD) { // Find position in array
|
if (eon[position].pi == rds.rdsD) { // Find position in array
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -643,7 +648,6 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
eon[position].mappedfreq = ((rds.rdsC & 0xFF) * 10 + 8750); // Add mapped frequency to array
|
eon[position].mappedfreq = ((rds.rdsC & 0xFF) * 10 + 8750); // Add mapped frequency to array
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -699,7 +703,11 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
|||||||
|
|
||||||
rds.ECC = 0;
|
rds.ECC = 0;
|
||||||
rds.LIC = 0;
|
rds.LIC = 0;
|
||||||
|
rds.pinHour = 0;
|
||||||
|
rds.pinMin = 0;
|
||||||
|
rds.pinDay = 0;
|
||||||
rds.stationTypeCode = 32;
|
rds.stationTypeCode = 32;
|
||||||
|
rds.hasPIN = false;
|
||||||
rds.hasECC = false;
|
rds.hasECC = false;
|
||||||
rds.hasLIC = false;
|
rds.hasLIC = false;
|
||||||
rds.hasRT = false;
|
rds.hasRT = false;
|
||||||
|
|||||||
+6
-2
@@ -108,6 +108,9 @@ typedef struct _rds_ {
|
|||||||
int8_t offset;
|
int8_t offset;
|
||||||
unsigned int ECC;
|
unsigned int ECC;
|
||||||
unsigned int LIC;
|
unsigned int LIC;
|
||||||
|
byte pinMin;
|
||||||
|
byte pinHour;
|
||||||
|
byte pinDay;
|
||||||
bool rdsAerror;
|
bool rdsAerror;
|
||||||
bool rdsBerror;
|
bool rdsBerror;
|
||||||
bool rdsCerror;
|
bool rdsCerror;
|
||||||
@@ -117,6 +120,7 @@ typedef struct _rds_ {
|
|||||||
bool hasDynamicPTY;
|
bool hasDynamicPTY;
|
||||||
bool hasStereo;
|
bool hasStereo;
|
||||||
bool hasRDS;
|
bool hasRDS;
|
||||||
|
bool hasPIN;
|
||||||
bool hasECC;
|
bool hasECC;
|
||||||
bool hasLIC;
|
bool hasLIC;
|
||||||
bool hasRT;
|
bool hasRT;
|
||||||
@@ -153,7 +157,7 @@ typedef struct _eon_ {
|
|||||||
class TEF6686 {
|
class TEF6686 {
|
||||||
public:
|
public:
|
||||||
af_ af[50];
|
af_ af[50];
|
||||||
eon_ eon[5];
|
eon_ eon[20];
|
||||||
rds_ rds;
|
rds_ rds;
|
||||||
void readRDS(bool showrdserrors);
|
void readRDS(bool showrdserrors);
|
||||||
void SetFreq(uint16_t frequency);
|
void SetFreq(uint16_t frequency);
|
||||||
@@ -196,6 +200,7 @@ class TEF6686 {
|
|||||||
void setVolume(int8_t volume);
|
void setVolume(int8_t volume);
|
||||||
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
|
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
|
||||||
uint8_t af_counter;
|
uint8_t af_counter;
|
||||||
|
uint8_t eon_counter;
|
||||||
bool mute;
|
bool mute;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -212,7 +217,6 @@ class TEF6686 {
|
|||||||
char rt_buffer[65];
|
char rt_buffer[65];
|
||||||
char rt_buffer2[65];
|
char rt_buffer2[65];
|
||||||
bool useRTPlus = true;
|
bool useRTPlus = true;
|
||||||
byte eon_counter;
|
|
||||||
bool ABold;
|
bool ABold;
|
||||||
char stationTextBuffer[65];
|
char stationTextBuffer[65];
|
||||||
uint64_t doublecheck;
|
uint64_t doublecheck;
|
||||||
|
|||||||
Reference in New Issue
Block a user