Changed Long PS to UTF8

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-10-13 17:52:04 +02:00
parent 39bc31893f
commit 64feb26a7b
4 changed files with 62 additions and 63 deletions

View File

@@ -1381,7 +1381,7 @@ void TEF6686::readRDS(byte showrdserrors) {
rds.hasCT = true; rds.hasCT = true;
rds.time = rdstime; rds.time = rdstime;
rds.offset = timeoffset; rds.offset = timeoffset;
} else { } else {
rds.hasCT = false; rds.hasCT = false;
} }
lastrdstime = rdstime; lastrdstime = rdstime;
@@ -1649,9 +1649,8 @@ void TEF6686::readRDS(byte showrdserrors) {
if ((offset == 0 || foundendmarker) && (pslong_process || !rds.fastps)) { // Last chars are received if ((offset == 0 || foundendmarker) && (pslong_process || !rds.fastps)) { // Last chars are received
if (strcmp(pslong_buffer, pslong_buffer2) == 0) { // When no difference between current and buffer, let's go... if (strcmp(pslong_buffer, pslong_buffer2) == 0) { // When no difference between current and buffer, let's go...
pslong_process = true; pslong_process = true;
RDScharConverter(pslong_buffer, PSLongtext, sizeof(PSLongtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII PSLongtext = pslong_buffer;
String utf8String = convertToUTF8(PSLongtext); // Convert RDS characterset to ASCII rds.stationNameLong = extractUTF8Substring(pslong_buffer, 0, endmarkerLPS, true); // Make sure PS Long does not exceed 32 characters
rds.stationNameLong = extractUTF8Substring(utf8String, 0, endmarkerLPS, true); // Make sure PS Long does not exceed 32 characters
rds.stationNameLong = trimTrailingSpaces(rds.stationNameLong); rds.stationNameLong = trimTrailingSpaces(rds.stationNameLong);
} }
} }
@@ -1661,9 +1660,8 @@ void TEF6686::readRDS(byte showrdserrors) {
if (offset == 4) packet1long = true; if (offset == 4) packet1long = true;
if (offset == 8) packet2long = true; if (offset == 8) packet2long = true;
if (offset == 16) packet3long = true; if (offset == 16) packet3long = true;
RDScharConverter(pslong_buffer, PSLongtext, sizeof(PSLongtext) / sizeof(wchar_t), true); // Convert 8 bit ASCII to 16 bit ASCII PSLongtext = pslong_buffer;
String utf8String = convertToUTF8(PSLongtext); // Convert RDS characterset to ASCII rds.stationNameLong = extractUTF8Substring(pslong_buffer, 0, endmarkerLPS, true);
rds.stationNameLong = extractUTF8Substring(utf8String, 0, endmarkerLPS, true);
rds.stationNameLong = trimTrailingSpaces(rds.stationNameLong); rds.stationNameLong = trimTrailingSpaces(rds.stationNameLong);
if ((packet0long && packet1long && packet2long && packet3long) || foundendmarker) pslong_process = true; // OK, we had one runs, now let's go the idle PS Long writing if ((packet0long && packet1long && packet2long && packet3long) || foundendmarker) pslong_process = true; // OK, we had one runs, now let's go the idle PS Long writing
} }
@@ -1693,6 +1691,7 @@ void TEF6686::clearRDS (bool fullsearchrds) {
rds.stationIDtext = ""; rds.stationIDtext = "";
rds.stationStatetext = ""; rds.stationStatetext = "";
rds.enhancedRTtext = ""; rds.enhancedRTtext = "";
PSLongtext = "";
uint8_t i; uint8_t i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@@ -1716,11 +1715,11 @@ void TEF6686::clearRDS (bool fullsearchrds) {
rt_buffer32[i] = 0x20; rt_buffer32[i] = 0x20;
pslong_buffer[i] = 0x20; pslong_buffer[i] = 0x20;
pslong_buffer2[i] = 0x20; pslong_buffer2[i] = 0x20;
PSLongtext[i] = L'\0'; // PSLongtext[i] = L'\0';
} }
rt_buffer32[32] = 0; rt_buffer32[32] = 0;
pslong_buffer[32] = 0; pslong_buffer[32] = 0;
PSLongtext[32] = L'\0'; // PSLongtext[32] = L'\0';
for (i = 0; i < 17; i++) rds.stationType[i] = 0x20; for (i = 0; i < 17; i++) rds.stationType[i] = 0x20;
rds.stationType[17] = 0; rds.stationType[17] = 0;
@@ -2090,4 +2089,4 @@ String TEF6686::ucs2ToUtf8(const char* ucs2Input) {
} }
} }
return utf8Output; return utf8Output;
} }

View File

@@ -726,6 +726,7 @@ class TEF6686 {
String extractUTF8Substring(const String& utf8String, size_t start, size_t length, bool under); String extractUTF8Substring(const String& utf8String, size_t start, size_t length, bool under);
String eRTconverter(const wchar_t* input); String eRTconverter(const wchar_t* input);
String ucs2ToUtf8(const char* ucs2Input); String ucs2ToUtf8(const char* ucs2Input);
String PSLongtext;
char ps_buffer[9]; char ps_buffer[9];
char ps_buffer2[9]; char ps_buffer2[9];
char ptyn_buffer[9]; char ptyn_buffer[9];
@@ -749,7 +750,6 @@ class TEF6686 {
bool rtABold; bool rtABold;
bool rtAB32old; bool rtAB32old;
wchar_t PStext[9] = L""; wchar_t PStext[9] = L"";
wchar_t PSLongtext[33] = L"";
wchar_t EONPStext[20][9]; wchar_t EONPStext[20][9];
wchar_t PTYNtext[9] = L""; wchar_t PTYNtext[9] = L"";
char RDSplus1[45]; char RDSplus1[45];
@@ -781,4 +781,4 @@ class TEF6686 {
time_t lastrdstime; time_t lastrdstime;
int32_t lasttimeoffset; int32_t lasttimeoffset;
}; };
#endif #endif

View File

@@ -335,7 +335,7 @@
static const char* const unitString[] = {"dBμV", "dBf", "dBm"}; static const char* const unitString[] = {"dBμV", "dBf", "dBm"};
static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic", "Modern"}; static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic", "Modern"};
static const char* const Theme[] = {"Essence", "Cyan", "Crimson", "Monochrome", "Volcano", "Dendro", "Sakura", "Whiteout", "Tangerine", "Ocean", "Indigo", "Maroon", "GoldBrite", "Bubblegum"}; static const char* const Theme[] = {"Essence", "Cyan", "Crimson", "Monochrome", "Volcano", "Dendro", "Sakura", "Whiteout", "Tangerine", "Ocean", "Indigo", "Queer", "GoldBrite", "Bubblegum"};
static const char* const Skin[] = {"Essential"}; static const char* const Skin[] = {"Essential"};
// Memory channel database // Memory channel database

View File

@@ -115,9 +115,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotating while screen off", // 107 "Rotating while screen off", // 107
"Model selector", // 108 "Model selector", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Portable (ILI9341)", // 110 "Portable", // 110
"Portable touch (ILI9341)", // 111 "Portable touch", // 111
"Title", // 112 "Title", // 112
"Album", // 113 "Album", // 113
"Track", // 114 "Track", // 114
@@ -399,9 +399,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Afstemmen tijdens\nschermbeveiliging", // 107 "Afstemmen tijdens\nschermbeveiliging", // 107
"Model keuze", // 108 "Model keuze", // 108
"Basis (ILI9341)", // 109 "Basis", // 109
"Portable (ILI9341)", // 110 "Portable", // 110
"Portable touch (ILI9341)", // 111 "Portable touch", // 111
"Titel", // 112 "Titel", // 112
"Album", // 113 "Album", // 113
"Nummer", // 114 "Nummer", // 114
@@ -683,9 +683,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Stroj. gdy ekran wył.", // 107 "Stroj. gdy ekran wył.", // 107
"Wybór modelu", // 108 "Wybór modelu", // 108
"Podstawowy (ILI9341)", // 109 "Podstawowy", // 109
"Przenośny (ILI9341)", // 110 "Przenośny", // 110
"Przenoś. dotyk. (ILI9341)", // 111 "Przenoś. dotyk.", // 111
"Tytuł", // 112 "Tytuł", // 112
"Album", // 113 "Album", // 113
"Ścieżka", // 114 "Ścieżka", // 114
@@ -967,9 +967,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Okretanje dok je zaslon isključen", // 107 "Okretanje dok je zaslon isključen", // 107
"Selektor modela", // 108 "Selektor modela", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Portable (ILI9341)", // 110 "Portable", // 110
"Portable touch (ILI9341)", // 111 "Portable touch", // 111
"Naslov", // 112 "Naslov", // 112
"Album", // 113 "Album", // 113
"Pjesma", // 114 "Pjesma", // 114
@@ -1251,9 +1251,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Περιστροφή με οθόνη\nσβηστή", // 107 "Περιστροφή με οθόνη\nσβηστή", // 107
"Επιλογή μοντέλου", // 108 "Επιλογή μοντέλου", // 108
"Βασικό (ILI9341)", // 109 "Βασικό", // 109
"Φορητό (ILI9341)", // 110 "Φορητό", // 110
"Φορητό αφής (ILI9341)", // 111 "Φορητό αφής", // 111
"Τίτλος", // 112 "Τίτλος", // 112
"Άλμπουμ", // 113 "Άλμπουμ", // 113
"Κομμάτι", // 114 "Κομμάτι", // 114
@@ -1535,9 +1535,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotire când ecranul este oprit", // 107 "Rotire când ecranul este oprit", // 107
"Selectare Model", // 108 "Selectare Model", // 108
"Bază (ILI9341)", // 109 "Bază", // 109
"Portabil (ILI9341)", // 110 "Portabil", // 110
"Portabil touch (ILI9341)", // 111 "Portabil touch", // 111
"Titlu", // 112 "Titlu", // 112
"Album", // 113 "Album", // 113
"Bandă", // 114 "Bandă", // 114
@@ -1819,9 +1819,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Tunen bei Bildschirm aus", // 107 "Tunen bei Bildschirm aus", // 107
"Modell auswählen", // 108 "Modell auswählen", // 108
"Basismodell (ILI9341)", // 109 "Basismodell", // 109
"Portabel (ILI9341)", // 110 "Portabel", // 110
"Portabel Touch (ILI9341)", // 111 "Portabel Touch", // 111
"Titel", // 112 "Titel", // 112
"Album", // 113 "Album", // 113
"Track", // 114 "Track", // 114
@@ -2103,8 +2103,8 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Ladění při vypnuté obrazovce", // 107 "Ladění při vypnuté obrazovce", // 107
"Volba modelu", // 108 "Volba modelu", // 108
"Základní (ILI9341)", // 109 "Základní", // 109
"Přenosný (ILI9341)", // 110 "Přenosný", // 110
"Přenosný-dotykový(ILI9341)", // 111 "Přenosný-dotykový(ILI9341)", // 111
"Title", // 112 "Title", // 112
"Album", // 113 "Album", // 113
@@ -2387,9 +2387,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Hangolás kikapcsolt képernyővel", // 107 "Hangolás kikapcsolt képernyővel", // 107
"Modellválasztó", // 108 "Modellválasztó", // 108
"Alap (ILI9341)", // 109 "Alap", // 109
"Hordozható (ILI9341)", // 110 "Hordozható", // 110
"Hord. érintős (ILI9341)", // 111 "Hord. érintős", // 111
"Cím", // 112 "Cím", // 112
"Album", // 113 "Album", // 113
"Szám", // 114 "Szám", // 114
@@ -2671,9 +2671,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotation lorsque\nl'écran est éteint", // 107 "Rotation lorsque\nl'écran est éteint", // 107
"Sélecteur de modèle", // 108 "Sélecteur de modèle", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Portable (ILI9341)", // 110 "Portable", // 110
"Portable touche (ILI9341)", // 111 "Portable touche", // 111
"Titre", // 112 "Titre", // 112
"Album", // 113 "Album", // 113
"Piste", // 114 "Piste", // 114
@@ -2956,9 +2956,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"ОИРТ", // 106 "ОИРТ", // 106
"Ротация при затъмнен екран", // 107 "Ротация при затъмнен екран", // 107
"Избор на модел", // 108 "Избор на модел", // 108
"База (ILI9341)", // 109 "База", // 109
"Портативен (ILI9341)", // 110 "Портативен", // 110
"Портативен сенз. екран (ILI9341)", // 111 "Портативен сенз. екран", // 111
"Заглавие", // 112 "Заглавие", // 112
"Албум", // 113 "Албум", // 113
"Песен", // 114 "Песен", // 114
@@ -3240,9 +3240,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
" УКВ", // 106 " УКВ", // 106
"Настройка при погашенном экране: ", // 107 "Настройка при погашенном экране: ", // 107
"Выбор модели", // 108 "Выбор модели", // 108
"Стандартный (ILI9341)", // 109 "Стандартный", // 109
"Портативный (ILI9341)", // 110 "Портативный", // 110
"Сенсорный (ILI9341)", // 111 "Сенсорный", // 111
"Название", // 112 "Название", // 112
"Альбом", // 113 "Альбом", // 113
"Трек", // 114 "Трек", // 114
@@ -3524,9 +3524,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Обертання, коли екран вимкнено", // 107 "Обертання, коли екран вимкнено", // 107
"Вибір моделі", // 108 "Вибір моделі", // 108
"Стандартний (ILI9341)", // 109 "Стандартний", // 109
"Портативний (ILI9341)", // 110 "Портативний", // 110
"Портатив. сенсорний (ILI9341)", // 111 "Портатив. сенсорний", // 111
"Назва", // 112 "Назва", // 112
"Альбом", // 113 "Альбом", // 113
"Трек", // 114 "Трек", // 114
@@ -3808,9 +3808,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotazione con schermo spento", // 107 "Rotazione con schermo spento", // 107
"Selezionare modello", // 108 "Selezionare modello", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Portatile (ILI9341)", // 110 "Portatile", // 110
"Portatile touch (ILI9341)", // 111 "Portatile touch", // 111
"Titolo", // 112 "Titolo", // 112
"Album", // 113 "Album", // 113
"Traccia", // 114 "Traccia", // 114
@@ -4376,9 +4376,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Tune når skjerm av", // 107 "Tune når skjerm av", // 107
"Velg Modell", // 108 "Velg Modell", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Bærbar (ILI9341)", // 110 "Bærbar", // 110
"Bærbar touch (ILI9341)", // 111 "Bærbar touch", // 111
"Titel", // 112 "Titel", // 112
"Album", // 113 "Album", // 113
"Spor", // 114 "Spor", // 114
@@ -4660,9 +4660,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotación con\npantalla apagada", // 107 "Rotación con\npantalla apagada", // 107
"Selector de modelo", // 108 "Selector de modelo", // 108
"Base (ILI9341)", // 109 "Base", // 109
"Portátil (ILI9341)", // 110 "Portátil", // 110
"Táctil portátil (ILI9341)", // 111 "Táctil portátil", // 111
"Título", // 112 "Título", // 112
"Álbum", // 113 "Álbum", // 113
"Pista", // 114 "Pista", // 114
@@ -4945,9 +4945,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
"OIRT", // 106 "OIRT", // 106
"Rotativo enquanto a tela\nestá desligada", // 107 "Rotativo enquanto a tela\nestá desligada", // 107
"Seletor de modelo", // 108 "Seletor de modelo", // 108
"Básico (ILI9341)", // 109 "Básico", // 109
"Portátil (ILI9341)", // 110 "Portátil", // 110
"Toque portátil (ILI9341)", // 111 "Toque portátil", // 111
"Título", // 112 "Título", // 112
"Álbum", // 113 "Álbum", // 113
"Faixa", // 114 "Faixa", // 114