Fix RT refresh
This commit is contained in:
+10
-3
@@ -256,7 +256,7 @@ bool TEF6686::readRDS(bool showrdserrors)
|
||||
}
|
||||
if (rds.region == 1) {
|
||||
if (rds.stationID > 4096) {
|
||||
if (rds.stationID > 21671 &&(rds.stationID & 0xF00U) >> 8 == 0) rds.stationID = ((uint16_t)uint8_t(0xA0 + ((rds.stationID & 0xF000U) >> 12)) << 8) + lowByte(rds.stationID); // C0DE -> ACDE
|
||||
if (rds.stationID > 21671 && (rds.stationID & 0xF00U) >> 8 == 0) rds.stationID = ((uint16_t)uint8_t(0xA0 + ((rds.stationID & 0xF000U) >> 12)) << 8) + lowByte(rds.stationID); // C0DE -> ACDE
|
||||
if (rds.stationID > 21671 && lowByte(rds.stationID) == 0) rds.stationID = 0xAF00 + uint8_t(highByte(rds.stationID)); // CD00 -> AFCD
|
||||
if (rds.stationID < 39247) {
|
||||
if (rds.stationID > 21671) {
|
||||
@@ -298,6 +298,8 @@ bool TEF6686::readRDS(bool showrdserrors)
|
||||
}
|
||||
|
||||
if (ps_process == 2) {
|
||||
for (int i = 0; i < 9; i++) rds.PStext[i] = 0;
|
||||
rds.stationName = "";
|
||||
RDScharConverter(ps_buffer, rds.PStext, sizeof(rds.PStext) / sizeof(wchar_t));
|
||||
rds.stationName = convertToUTF8(rds.PStext);
|
||||
|
||||
@@ -364,6 +366,7 @@ bool TEF6686::readRDS(bool showrdserrors)
|
||||
offsetold = 0;
|
||||
rds.stationText = "";
|
||||
if (rt_timer == 64) {
|
||||
for (int i = 0; i < 65; i++) rds.RTtext[i] = 0;
|
||||
RDScharConverter(stationTextBuffer, rds.RTtext, sizeof(rds.RTtext) / sizeof(wchar_t));
|
||||
rds.stationText = convertToUTF8(rds.RTtext);
|
||||
}
|
||||
@@ -395,6 +398,8 @@ bool TEF6686::readRDS(bool showrdserrors)
|
||||
strcpy(stationTextBuffer, rt_buffer);
|
||||
for (int i = 0; i < 64; i++) stationTextBuffer[i] = stationTextBuffer[i];
|
||||
if (rt_timer < 64) {
|
||||
rds.stationText = "";
|
||||
for (int i = 0; i < 65; i++) rds.RTtext[i] = 0;
|
||||
RDScharConverter(stationTextBuffer, rds.RTtext, sizeof(rds.RTtext) / sizeof(wchar_t));
|
||||
rds.stationText = convertToUTF8(rds.RTtext);
|
||||
rt_timer++;
|
||||
@@ -534,11 +539,12 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
||||
rds.stationName = "";
|
||||
rds.stationText = "";
|
||||
for (i = 0; i < 9; i++) {
|
||||
// rds.stationName[i] = 0;
|
||||
rds.PStext[i] = 0;
|
||||
ps_buffer[i] = 0;
|
||||
}
|
||||
for (i = 0; i < 65; i++) {
|
||||
stationTextBuffer[i] = 0;
|
||||
rds.RTtext[i] = 0;
|
||||
rt_buffer[i] = 0;
|
||||
rt_buffer2[i] = 0;
|
||||
}
|
||||
@@ -585,6 +591,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
||||
ps_process = 1;
|
||||
af_counter = 0;
|
||||
rt_timer = 0;
|
||||
rds.rdsreset = true;
|
||||
}
|
||||
|
||||
void TEF6686::tone(uint16_t time, int16_t amplitude, uint16_t frequency) {
|
||||
@@ -622,7 +629,7 @@ void TEF6686::RDScharConverter(const char* input, wchar_t* output, size_t size)
|
||||
for (size_t i = 0; i < size - 1; i++) {
|
||||
char currentChar = input[i];
|
||||
switch (currentChar) {
|
||||
case 0x20: if(rds.underscore) output[i] = L'_'; else output[i] = L' '; break;
|
||||
case 0x20: if (rds.underscore) output[i] = L'_'; else output[i] = L' '; break;
|
||||
case 0x21 ... 0x5D: output[i] = static_cast<wchar_t>(currentChar); break;
|
||||
case 0x5E: output[i] = L'―'; break;
|
||||
case 0x5F: output[i] = L'_'; break;
|
||||
|
||||
@@ -171,6 +171,7 @@ typedef struct _rds_ {
|
||||
bool correct;
|
||||
bool correctPI;
|
||||
bool underscore;
|
||||
bool rdsreset;
|
||||
} rds_;
|
||||
|
||||
typedef struct _af_ {
|
||||
|
||||
Reference in New Issue
Block a user