Skip to content

Commit

Permalink
v0.7.414
Browse files Browse the repository at this point in the history
  • Loading branch information
e2002 committed Aug 23, 2022
1 parent 223bae1 commit de97530
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 29 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ Work is in progress...

---
## Version history
#### v0.7.414
- fixed non latin long titles of songs error

#### v0.7.402
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** \
**Please backup playlist.csv and wifi.csv before updating.**
Expand Down
4 changes: 4 additions & 0 deletions yoRadio/audiohandlers.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ void audio_showstation(const char *info) {
void audio_showstreamtitle(const char *info) {
if (strlen(info) > 0) {
bool p = printable(info);
#ifdef DEBUG_TITLES
config.setTitle(DEBUG_TITLES);
#else
config.setTitle(p?info:"*****");
#endif
netserver.requestOnChange(TITLE, 0);
}
}
7 changes: 7 additions & 0 deletions yoRadio/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ void DBGVB(const char *format, ...) {
#endif
}

void u8fix(char *src){
char last = src[strlen(src)-1];
if ((uint8_t)last >= 0xC2) src[strlen(src)-1]='\0';
}

void Config::init() {
EEPROM.begin(EEPROM_SIZE);
#if IR_PIN!=255
Expand Down Expand Up @@ -223,12 +228,14 @@ byte Config::setLastSSID(byte val) {
void Config::setTitle(const char* title) {
memset(config.station.title, 0, BUFLEN);
strlcpy(config.station.title, title, BUFLEN);
u8fix(config.station.title);
display.putRequest({NEWTITLE, 0});
}

void Config::setStation(const char* station) {
memset(config.station.name, 0, BUFLEN);
strlcpy(config.station.name, station, BUFLEN);
u8fix(config.station.title);
}

void Config::indexPlaylist() {
Expand Down
1 change: 1 addition & 0 deletions yoRadio/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define INDEX_PATH "/data/index.dat"

void DBGVB(const char *format, ...);
void u8fix(char *src);

struct theme_t {
uint16_t background;
Expand Down
45 changes: 17 additions & 28 deletions yoRadio/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,6 @@ void Display::station() {
nextion.newNameset(config.station.name);
nextion.bitrate(config.station.bitrate);
nextion.bitratePic(ICON_NA);
#endif
#ifdef DEBUG_TITLES
meta.setText(dsp.utf8Rus("Utenim adminim veniam FM", true));
#endif
//dsp.loop(true);
//netserver.requestOnChange(STATION, 0);
Expand All @@ -570,44 +567,36 @@ void Display::returnTile() {
meta.setText(dsp.utf8Rus(config.station.name, true));
#ifdef USE_NEXTION
nextion.newNameset(config.station.name);
#endif
#ifdef DEBUG_TITLES
meta.setText(dsp.utf8Rus("Utenim adminim veniam FM", true));
#endif
meta.reset();
//dsp.loop(true);
}

char *split(char *str, const char *delim) {
char *dmp = strstr(str, delim);
if (dmp == NULL) return NULL;
*dmp = '\0';
return dmp + strlen(delim);
}

void Display::title() {
/*
memset(config.station.title, 0, BUFLEN);
strlcpy(config.station.title, str, BUFLEN);
*/
char ttl[BUFLEN / 2] = { 0 };
char sng[BUFLEN / 2] = { 0 };
DBGVB("call of %s(), config.station.title=%s", __func__, config.station.title);
if (strlen(config.station.title) > 0) {
char* ici;
if ((ici = strstr(config.station.title, " - ")) != NULL && TITLE_SIZE2 != 0) {
strlcpy(sng, ici + 3, BUFLEN / 2);
strlcpy(ttl, config.station.title, strlen(config.station.title) - strlen(ici) + 1);

} else {
strlcpy(ttl, config.station.title, BUFLEN / 2);
sng[0] = '\0';
char tmpbuf[strlen(config.station.title)+1];
strlcpy(tmpbuf, config.station.title, strlen(config.station.title)+1);
char *stitle = split(tmpbuf, " - ");
if(stitle && TITLE_SIZE2 != 0){
title1.setText(dsp.utf8Rus(tmpbuf, true));
title2.setText(dsp.utf8Rus(stitle, true));
}else{
title1.setText(dsp.utf8Rus(tmpbuf, true));
title2.setText(dsp.utf8Rus("", true));
}
#ifdef DEBUG_TITLES
strlcpy(ttl, "Duis aute irure dolor in reprehenderit in voluptate velit", BUFLEN / 2);
strlcpy(sng, "Excepteur sint occaecat cupidatat non proident", BUFLEN / 2);
#endif
title1.setText(dsp.utf8Rus(ttl, true));
if (TITLE_SIZE2 != 0) title2.setText(dsp.utf8Rus(sng, true));
#ifdef USE_NEXTION
nextion.newTitle(config.station.title);
#endif
//dsp.loop(true);
if (player_on_track_change) player_on_track_change();
}
//netserver.requestOnChange(TITLE, 0);
}

void Display::heap() {
Expand Down
2 changes: 1 addition & 1 deletion yoRadio/options.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h

#define VERSION "0.7.402"
#define VERSION "0.7.414"

/*******************************************************
DO NOT EDIT THIS FILE.
Expand Down

0 comments on commit de97530

Please sign in to comment.