v0.9.693
This commit is contained in:
@@ -235,6 +235,11 @@ Work is in progress...
|
|||||||
|
|
||||||
---
|
---
|
||||||
## Version history
|
## Version history
|
||||||
|
#### v0.9.693
|
||||||
|
- fixed incorrect behavior of the `HIDE_VU` setting [#205](https://github.com/e2002/yoradio/issues/205)
|
||||||
|
- fixed `CORRUPT HEAP` error when playing "invalid links" [#203](https://github.com/e2002/yoradio/issues/203)
|
||||||
|
- optimized code of `utfToAscii` [utf8Rus](https://github.com/e2002/yoradio/blob/main/yoRadio/src/displays/tools/utf8Rus.cpp)
|
||||||
|
|
||||||
#### v0.9.689
|
#### v0.9.689
|
||||||
- fixed artifacts in scrolling text
|
- fixed artifacts in scrolling text
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
|
|||||||
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
||||||
|
|
||||||
if(pos_slash > 1) {
|
if(pos_slash > 1) {
|
||||||
hostwoext = (char*)malloc(pos_slash + 1);
|
hostwoext = (char*)malloc(pos_slash + 2);
|
||||||
memcpy(hostwoext, h_host, pos_slash);
|
memcpy(hostwoext, h_host, pos_slash);
|
||||||
hostwoext[pos_slash] = '\0';
|
hostwoext[pos_slash] = '\0';
|
||||||
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
||||||
@@ -579,7 +579,7 @@ bool Audio::httpPrint(const char* host) {
|
|||||||
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
||||||
|
|
||||||
if(pos_slash > 1) {
|
if(pos_slash > 1) {
|
||||||
hostwoext = (char*)malloc(pos_slash + 1);
|
hostwoext = (char*)malloc(pos_slash + 2);
|
||||||
memcpy(hostwoext, h_host, pos_slash);
|
memcpy(hostwoext, h_host, pos_slash);
|
||||||
hostwoext[pos_slash] = '\0';
|
hostwoext[pos_slash] = '\0';
|
||||||
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
||||||
|
|||||||
@@ -1776,7 +1776,7 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
|
|||||||
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
char *extension = NULL; // "/mp3" in "skonto.ls.lv:8002/mp3"
|
||||||
|
|
||||||
if(pos_slash > 1) {
|
if(pos_slash > 1) {
|
||||||
hostwoext = (char*)malloc(pos_slash + 1);
|
hostwoext = (char*)malloc(pos_slash + 2);
|
||||||
memcpy(hostwoext, h_host, pos_slash);
|
memcpy(hostwoext, h_host, pos_slash);
|
||||||
hostwoext[pos_slash] = '\0';
|
hostwoext[pos_slash] = '\0';
|
||||||
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
uint16_t extLen = urlencode_expected_len(h_host + pos_slash);
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ void Display::putRequest(displayRequestType_e type, int payload){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::_layoutChange(bool played){
|
void Display::_layoutChange(bool played){
|
||||||
if(config.store.vumeter){
|
if(config.store.vumeter && _vuwidget){
|
||||||
if(played){
|
if(played){
|
||||||
if(_vuwidget) _vuwidget->unlock();
|
if(_vuwidget) _vuwidget->unlock();
|
||||||
//_clock->moveTo(clockMove);
|
//_clock->moveTo(clockMove);
|
||||||
@@ -428,8 +428,9 @@ void Display::_layoutChange(bool played){
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(played){
|
if(played){
|
||||||
|
if(clockMove.width<0) _clock->moveBack(); else _clock->moveTo(clockMove);
|
||||||
if(_weather) _weather->moveTo(weatherMove);
|
if(_weather) _weather->moveTo(weatherMove);
|
||||||
_clock->moveBack();
|
//_clock->moveBack();
|
||||||
}else{
|
}else{
|
||||||
if(_weather) _weather->moveBack();
|
if(_weather) _weather->moveBack();
|
||||||
_clock->moveBack();
|
_clock->moveBack();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "commandhandler.h"
|
#include "commandhandler.h"
|
||||||
#include "timekeeper.h"
|
#include "timekeeper.h"
|
||||||
|
#include "../displays/dspcore.h"
|
||||||
#include "../displays/widgets/widgetsconfig.h" //BitrateFormat
|
#include "../displays/widgets/widgetsconfig.h" //BitrateFormat
|
||||||
|
|
||||||
#if DSP_MODEL==DSP_DUMMY
|
#if DSP_MODEL==DSP_DUMMY
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define options_h
|
#define options_h
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define YOVERSION "0.9.689"
|
#define YOVERSION "0.9.693"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
|
|||||||
@@ -3,190 +3,87 @@
|
|||||||
#include "../dspcore.h"
|
#include "../dspcore.h"
|
||||||
#include "utf8Rus.h"
|
#include "utf8Rus.h"
|
||||||
|
|
||||||
#ifndef DSP_LCD
|
size_t strlen_utf8(const char* s) {
|
||||||
char* utf8Rus(const char* str, bool uppercase) {
|
size_t count = 0;
|
||||||
int index = 0;
|
while (*s) {
|
||||||
static char strn[BUFLEN];
|
count++;
|
||||||
bool E = false;
|
if ((*s & 0xF0) == 0xF0) { // 4-byte character
|
||||||
strlcpy(strn, str, BUFLEN);
|
s += 4;
|
||||||
if (uppercase) {
|
} else if ((*s & 0xE0) == 0xE0) { // 3-byte character
|
||||||
bool next = false;
|
s += 3;
|
||||||
for (char *iter = strn; *iter != '\0'; ++iter)
|
} else if ((*s & 0xC0) == 0xC0) { // 2-byte character
|
||||||
{
|
s += 2;
|
||||||
if (E) {
|
} else { // 1-byte character (ASCII)
|
||||||
E = false;
|
s += 1;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
uint8_t rus = (uint8_t) * iter;
|
|
||||||
if (rus == 208 && (uint8_t) * (iter + 1) == 129) { // ёКостыли
|
|
||||||
*iter = (char)209;
|
|
||||||
*(iter + 1) = (char)145;
|
|
||||||
E = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rus == 209 && (uint8_t) * (iter + 1) == 145) {
|
|
||||||
*iter = (char)209;
|
|
||||||
*(iter + 1) = (char)145;
|
|
||||||
E = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (next) {
|
|
||||||
if (rus >= 128 && rus <= 143) *iter = (char)(rus + 32);
|
|
||||||
if (rus >= 176 && rus <= 191) *iter = (char)(rus - 32);
|
|
||||||
next = false;
|
|
||||||
}
|
|
||||||
if (rus == 208) next = true;
|
|
||||||
if (rus == 209) {
|
|
||||||
*iter = (char)208;
|
|
||||||
next = true;
|
|
||||||
}
|
|
||||||
*iter = toupper(*iter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(L10N_LANGUAGE==EN) return strn;
|
return count;
|
||||||
while (strn[index])
|
|
||||||
{
|
|
||||||
if (strn[index] >= 0xBF)
|
|
||||||
{
|
|
||||||
switch (strn[index]) {
|
|
||||||
case 0xD0: {
|
|
||||||
if (strn[index + 1] == 0x81) {
|
|
||||||
strn[index] = 0xA8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strn[index + 1] >= 0x90 && strn[index + 1] <= 0xBF) strn[index] = strn[index + 1] + 0x30;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0xD1: {
|
|
||||||
if (strn[index + 1] == 0x91) {
|
|
||||||
//strn[index] = 0xB7;
|
|
||||||
strn[index] = 0xB8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strn[index + 1] >= 0x80 && strn[index + 1] <= 0x8F) strn[index] = strn[index + 1] + 0x70;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int sind = index + 2;
|
|
||||||
while (strn[sind]) {
|
|
||||||
strn[sind - 1] = strn[sind];
|
|
||||||
sind++;
|
|
||||||
}
|
|
||||||
strn[sind - 1] = 0;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
return strn;
|
|
||||||
}
|
}
|
||||||
#else //#ifndef DSP_LCD
|
|
||||||
char* utf8Rus(const char* str, bool uppercase) {
|
char* utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
static char out[BUFLEN];
|
||||||
static char strn[BUFLEN];
|
int outPos = 0;
|
||||||
static char newStr[BUFLEN];
|
#ifdef DSP_LCD
|
||||||
bool E = false;
|
static const char* mapD0[] = {
|
||||||
strlcpy(strn, str, BUFLEN);
|
"A","B","V","G","D","E","ZH","Z","I","Y",
|
||||||
newStr[0] = '\0';
|
"K","L","M","N","O","P","R","S","T","U",
|
||||||
bool next = false;
|
"F","H","TS","CH","SH","SHCH","'","YU","'","E","YU","YA"
|
||||||
for (char *iter = strn; *iter != '\0'; ++iter)
|
};
|
||||||
{
|
#endif
|
||||||
if (E) {
|
for (int i = 0; str[i] && outPos < BUFLEN - 1; i++) {
|
||||||
E = false;
|
uint8_t c = (uint8_t)str[i];
|
||||||
continue;
|
if (c == 0xD0 && str[i+1]) {
|
||||||
|
uint8_t n = (uint8_t)str[++i];
|
||||||
|
if (n == 0x81) { // Ё
|
||||||
|
#ifdef DSP_LCD
|
||||||
|
const char* t = "YO";
|
||||||
|
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
|
||||||
|
#else
|
||||||
|
out[outPos++] = uppercase ? 0xA8 : 0xB8;
|
||||||
|
#endif
|
||||||
|
} else if (n >= 144 && n <= 191) {
|
||||||
|
#ifdef DSP_LCD
|
||||||
|
if(n>=176) n-=32;
|
||||||
|
const char* t = mapD0[n - 0x90];
|
||||||
|
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
|
||||||
|
#else
|
||||||
|
uint8_t ch = n + 48;
|
||||||
|
if(n>=176 && uppercase) ch-=32;
|
||||||
|
out[outPos++] = ch;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
uint8_t rus = (uint8_t) * iter;
|
} else if (c == 0xD1 && str[i+1]) {
|
||||||
if (rus == 208 && (uint8_t) * (iter + 1) == 129) { // ёКостыли
|
uint8_t n = (uint8_t)str[++i];
|
||||||
*iter = (char)209;
|
if (n == 0x91) { // ё
|
||||||
*(iter + 1) = (char)145;
|
#ifdef DSP_LCD
|
||||||
E = true;
|
const char* t = "YO";
|
||||||
continue;
|
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
|
||||||
|
#else
|
||||||
|
out[outPos++] = uppercase ? 0xA8 : 0xB8;
|
||||||
|
#endif
|
||||||
|
} else if (n >= 128 && n <= 143) {
|
||||||
|
#ifdef DSP_LCD
|
||||||
|
n+=16;
|
||||||
|
const char* t = mapD0[n - 128];
|
||||||
|
for (; *t && outPos < BUFLEN-1; t++) out[outPos++] = *t;
|
||||||
|
#else
|
||||||
|
uint8_t ch = n + 112;
|
||||||
|
if(uppercase) ch-=32;
|
||||||
|
out[outPos++] = ch;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (rus == 209 && (uint8_t) * (iter + 1) == 145) {
|
} else { // ASCII
|
||||||
*iter = (char)209;
|
#ifdef DSP_LCD
|
||||||
*(iter + 1) = (char)145;
|
char ch = (char)toupper(c);
|
||||||
E = true;
|
if (ch == 7) ch = (char)165;
|
||||||
continue;
|
if (ch == 9) ch = (char)223;
|
||||||
}
|
out[outPos++] = ch;
|
||||||
if (next) {
|
#else
|
||||||
if (rus >= 128 && rus <= 143) *iter = (char)(rus + 32);
|
out[outPos++] = uppercase ? toupper(c) : c;
|
||||||
if (rus >= 176 && rus <= 191) *iter = (char)(rus - 32);
|
#endif
|
||||||
next = false;
|
|
||||||
}
|
|
||||||
if (rus == 208) next = true;
|
|
||||||
if (rus == 209) {
|
|
||||||
*iter = (char)208;
|
|
||||||
next = true;
|
|
||||||
}
|
|
||||||
*iter = toupper(*iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (strn[index])
|
|
||||||
{
|
|
||||||
if (strlen(newStr) > BUFLEN - 2) break;
|
|
||||||
if (strn[index] >= 0xBF)
|
|
||||||
{
|
|
||||||
switch (strn[index]) {
|
|
||||||
case 0xD0: {
|
|
||||||
switch (strn[index + 1])
|
|
||||||
{
|
|
||||||
case 0x90: strcat(newStr, "A"); break;
|
|
||||||
case 0x91: strcat(newStr, "B"); break;
|
|
||||||
case 0x92: strcat(newStr, "V"); break;
|
|
||||||
case 0x93: strcat(newStr, "G"); break;
|
|
||||||
case 0x94: strcat(newStr, "D"); break;
|
|
||||||
case 0x95: strcat(newStr, "E"); break;
|
|
||||||
case 0x96: strcat(newStr, "ZH"); break;
|
|
||||||
case 0x97: strcat(newStr, "Z"); break;
|
|
||||||
case 0x98: strcat(newStr, "I"); break;
|
|
||||||
case 0x99: strcat(newStr, "Y"); break;
|
|
||||||
case 0x9A: strcat(newStr, "K"); break;
|
|
||||||
case 0x9B: strcat(newStr, "L"); break;
|
|
||||||
case 0x9C: strcat(newStr, "M"); break;
|
|
||||||
case 0x9D: strcat(newStr, "N"); break;
|
|
||||||
case 0x9E: strcat(newStr, "O"); break;
|
|
||||||
case 0x9F: strcat(newStr, "P"); break;
|
|
||||||
case 0xA0: strcat(newStr, "R"); break;
|
|
||||||
case 0xA1: strcat(newStr, "S"); break;
|
|
||||||
case 0xA2: strcat(newStr, "T"); break;
|
|
||||||
case 0xA3: strcat(newStr, "U"); break;
|
|
||||||
case 0xA4: strcat(newStr, "F"); break;
|
|
||||||
case 0xA5: strcat(newStr, "H"); break;
|
|
||||||
case 0xA6: strcat(newStr, "TS"); break;
|
|
||||||
case 0xA7: strcat(newStr, "CH"); break;
|
|
||||||
case 0xA8: strcat(newStr, "SH"); break;
|
|
||||||
case 0xA9: strcat(newStr, "SHCH"); break;
|
|
||||||
case 0xAA: strcat(newStr, "'"); break;
|
|
||||||
case 0xAB: strcat(newStr, "YU"); break;
|
|
||||||
case 0xAC: strcat(newStr, "'"); break;
|
|
||||||
case 0xAD: strcat(newStr, "E"); break;
|
|
||||||
case 0xAE: strcat(newStr, "YU"); break;
|
|
||||||
case 0xAF: strcat(newStr, "YA"); break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0xD1: {
|
|
||||||
if (strn[index + 1] == 0x91) {
|
|
||||||
strcat(newStr, "YO"); break;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int sind = index + 2;
|
out[outPos] = 0;
|
||||||
while (strn[sind]) {
|
return out;
|
||||||
strn[sind - 1] = strn[sind];
|
|
||||||
sind++;
|
|
||||||
}
|
|
||||||
strn[sind - 1] = 0;
|
|
||||||
} else {
|
|
||||||
if(strn[index]==7) strn[index]=165;
|
|
||||||
if(strn[index]==9) strn[index]=223;
|
|
||||||
char Temp[2] = {(char) strn[index] , 0 } ;
|
|
||||||
strcat(newStr, Temp);
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
return newStr;
|
|
||||||
}
|
}
|
||||||
#endif //#ifndef DSP_LCD
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef utf8Rus_h
|
#ifndef utf8Rus_h
|
||||||
#define utf8Rus_h
|
#define utf8Rus_h
|
||||||
|
|
||||||
|
size_t strlen_utf8(const char* s);
|
||||||
char* utf8Rus(const char* str, bool uppercase);
|
char* utf8Rus(const char* str, bool uppercase);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user