You've already forked TEF6686_ESP32
Fixed theme selector
Also finished EON in API
This commit is contained in:
@@ -420,8 +420,7 @@ void TEF6686::readRDS(bool showrdserrors)
|
||||
}
|
||||
} break;
|
||||
|
||||
case RDS_GROUP_4A:
|
||||
case RDS_GROUP_4B: {
|
||||
case RDS_GROUP_4A: {
|
||||
if (rds.correct) {
|
||||
// CT
|
||||
uint32_t mjd;
|
||||
@@ -561,47 +560,57 @@ void TEF6686::readRDS(bool showrdserrors)
|
||||
break;
|
||||
|
||||
case RDS_GROUP_14A: {
|
||||
if (rds.correct) rds.hasEON = true; // Group is there, so we have EON
|
||||
// EON
|
||||
if (rds.correct) {
|
||||
rds.hasEON = true; // Group is there, so we have EON
|
||||
|
||||
bool isValuePresent = false;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (eon[i].pi == rds.rdsD) {
|
||||
isValuePresent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isValuePresent = false;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (eon[i].pi == rds.rdsD) { // Check if EON is already in array
|
||||
isValuePresent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isValuePresent) {
|
||||
eon[eon_counter].pi = rds.rdsD;
|
||||
eon_counter++;
|
||||
}
|
||||
|
||||
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 (!isValuePresent) {
|
||||
eon[eon_counter].pi = rds.rdsD; // Store PI on next array
|
||||
eon_counter++;
|
||||
}
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
offset = rds.rdsB & 0x0F; // Read offset
|
||||
|
||||
// for (int i = 0; i < 5; i++) Serial.println(String(i) + "\t" + String(eon[i].pi,HEX) + "\t" + String(eon[i].ps));
|
||||
// Serial.println("----");
|
||||
|
||||
}
|
||||
if (offset < 4) {
|
||||
byte position;
|
||||
for (position = 0; position < 5; position++) {
|
||||
if (eon[position].pi == rds.rdsD) { // Find position in array
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
eon_buffer2[position][(offset * 2) + 0] = eon_buffer[position][(offset * 2) + 0]; // Make a copy of the PS buffer
|
||||
eon_buffer2[position][(offset * 2) + 1] = eon_buffer[position][(offset * 2) + 1];
|
||||
|
||||
eon_buffer[position][(offset * 2) + 0] = rds.rdsC >> 8; // First character of segment
|
||||
eon_buffer[position][(offset * 2) + 1] = rds.rdsC & 0xFF; // Second character of segment
|
||||
eon_buffer[position][(offset * 2) + 2] = '\0'; // Endmarker of segment
|
||||
|
||||
if (offset > 2) { // Last chars are received
|
||||
if (eon_buffer[position] != eon_buffer2[position]) { // When difference between old and new, let's go...
|
||||
RDScharConverter(eon_buffer[position], EONPStext, sizeof(EONPStext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII
|
||||
String utf8String = convertToUTF8(EONPStext); // Convert RDS characterset to ASCII
|
||||
eon[position].ps = extractUTF8Substring(utf8String, 0, 8, true); // Make sure PS does not exceed 8 characters
|
||||
}
|
||||
}
|
||||
|
||||
if (offset > 4 && offset < 9) {
|
||||
if (((rds.rdsC >> 8) * 10 + 8750) == currentfreq) { // Check if mapped frequency belongs to current frequency
|
||||
eon[position].mappedfreq = ((rds.rdsC & 0xFF) * 10 + 8750); // Add mapped frequency to array
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -643,10 +652,14 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
||||
for (i = 0; i < 18; i++) rds.stationType[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 < 5; i++) {
|
||||
eon[i].pi = 0;
|
||||
for (int y = 0; y < 9; y++) eon[i].ps[y] = 0;
|
||||
eon[i].pi = 0;
|
||||
for (int y = 0; y < 9; y++) {
|
||||
eon_buffer[i][y] = 0;
|
||||
eon_buffer2[i][y] = 0;
|
||||
}
|
||||
eon[i].ps = "";
|
||||
}
|
||||
|
||||
for (i = 0; i < 45; i++) {
|
||||
|
||||
@@ -141,16 +141,16 @@ typedef struct _af_ {
|
||||
} af_;
|
||||
|
||||
typedef struct _eon_ {
|
||||
uint16_t mappedfreq;
|
||||
uint16_t pi;
|
||||
char ps[9];
|
||||
uint16_t mappedfreq;
|
||||
uint16_t pi;
|
||||
String ps;
|
||||
} eon_;
|
||||
|
||||
|
||||
class TEF6686 {
|
||||
public:
|
||||
af_ af[50];
|
||||
eon_ eon[5];
|
||||
eon_ eon[5];
|
||||
rds_ rds;
|
||||
void readRDS(bool showrdserrors);
|
||||
void SetFreq(uint16_t frequency);
|
||||
@@ -201,16 +201,17 @@ class TEF6686 {
|
||||
String extractUTF8Substring(const String& utf8String, size_t start, size_t length, bool under);
|
||||
char ps_buffer[9];
|
||||
char ps_buffer2[9];
|
||||
char ptyn_buffer[9];
|
||||
char eon_buffer[9];
|
||||
char ptyn_buffer[9];
|
||||
char eon_buffer[9][5];
|
||||
char eon_buffer2[9][5];
|
||||
bool ps_process;
|
||||
bool rt_process;
|
||||
char rt_buffer[65];
|
||||
char rt_buffer2[65];
|
||||
bool useRTPlus = true;
|
||||
bool checkDouble (uint16_t value);
|
||||
bool checkDoubleEON (uint16_t value);
|
||||
byte eon_counter;
|
||||
bool checkDoubleEON (uint16_t value);
|
||||
byte eon_counter;
|
||||
bool ABold;
|
||||
char stationTextBuffer[65];
|
||||
uint64_t doublecheck;
|
||||
@@ -219,11 +220,12 @@ class TEF6686 {
|
||||
uint16_t rdsDprevious;
|
||||
bool rtABold;
|
||||
wchar_t PStext[9] = L"";
|
||||
wchar_t PTYNtext[9] = L"";
|
||||
wchar_t EONPStext[9] = L"";
|
||||
wchar_t PTYNtext[9] = L"";
|
||||
byte ps_counter;
|
||||
char musicArtist[45];
|
||||
char musicTitle[45];
|
||||
char stationHost[45];
|
||||
char stationEvent[45];
|
||||
uint16_t currentfreq;
|
||||
};
|
||||
uint16_t currentfreq;
|
||||
};
|
||||
103
src/language.h
103
src/language.h
@@ -1,6 +1,6 @@
|
||||
// [number of languages][number of texts][max. length of text]
|
||||
|
||||
static const char myLanguage[9][78][85] = {
|
||||
static const char myLanguage[9][87][85] = {
|
||||
{ "English", // English
|
||||
"Rotary direction changed", // 1
|
||||
"Please release button", // 2
|
||||
@@ -78,7 +78,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Nederlands", // Dutch
|
||||
@@ -158,8 +167,17 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
}, //
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NIET MOGELIJK" // 86
|
||||
}, //
|
||||
|
||||
{ "Polski", // Polish
|
||||
"Kierunek obrotu zmieniony", // 1
|
||||
@@ -238,7 +256,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Opcje zasilania", // 74
|
||||
"Glebokie uspienie", // 75
|
||||
"Wylacz ekran", // 76
|
||||
"Motyw" // 77
|
||||
"Motyw", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Hrvatski", // Croatian
|
||||
@@ -318,7 +345,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Ελληνικά", // Greek
|
||||
@@ -398,7 +434,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Επιλογές ενέργειας", // 74
|
||||
"Βαθιά αναμονή", // 75
|
||||
"Οθόνη κλειστή", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Romana", // Romanian
|
||||
@@ -478,7 +523,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Deutsch", // German
|
||||
@@ -558,7 +612,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Energieeinstellungen", // 74
|
||||
"Komplett aus", // 75
|
||||
"Bildschirm aus", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Czech", // Czech
|
||||
@@ -638,7 +701,16 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
|
||||
{ "Slovak", // Slovak
|
||||
@@ -718,6 +790,15 @@ static const char myLanguage[9][78][85] = {
|
||||
"Power options", // 74
|
||||
"Deep sleep", // 75
|
||||
"Screen off", // 76
|
||||
"Theme" // 77
|
||||
"Theme", // 77
|
||||
"Default", // 78
|
||||
"Cyan", // 79
|
||||
"Crimson", // 80
|
||||
"Monochrome", // 81
|
||||
"Volcano", // 82
|
||||
"Dendro", // 83
|
||||
"Sakura", // 84
|
||||
"Whiteout", // 85
|
||||
"NOT POSSIBLE" // 86
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user