diff --git a/yoRadio/src/audioI2S/Audio.cpp b/yoRadio/src/audioI2S/Audio.cpp index 086217a..a47a4c1 100644 --- a/yoRadio/src/audioI2S/Audio.cpp +++ b/yoRadio/src/audioI2S/Audio.cpp @@ -3774,6 +3774,7 @@ bool Audio::parseHttpResponseHeader() { // this is the response to a GET / reque } else{ AUDIO_INFO("unknown content found at: %s", m_lastHost); + AUDIO_ERROR("unknown content found at: %s", m_lastHost); goto exit; } return true; diff --git a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp index 10f4726..772d39c 100644 --- a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp +++ b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp @@ -1418,6 +1418,7 @@ bool Audio::parseHttpResponseHeader() { // this is the response to a GET / reque } else{ AUDIO_INFO("unknown content found at: %s", m_lastHost); + AUDIO_ERROR("unknown content found at: %s", m_lastHost); goto exit; } return true; diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index df20a23..4af9488 100644 --- a/yoRadio/src/core/options.h +++ b/yoRadio/src/core/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define YOVERSION "0.9.099" +#define YOVERSION "0.9.102" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/core/player.cpp b/yoRadio/src/core/player.cpp index 41e0a92..58b5815 100644 --- a/yoRadio/src/core/player.cpp +++ b/yoRadio/src/core/player.cpp @@ -37,6 +37,8 @@ void Player::init() { Serial.print("##[BOOT]#\tplayer.init\t"); playerQueue=NULL; playerQueue = xQueueCreate( 5, sizeof( playerRequestParams_t ) ); + + memset(_plError, 0, PLERR_LN); #ifdef MQTT_ROOT_TOPIC memset(burl, 0, MQTT_BURL_SIZE); #endif @@ -79,11 +81,19 @@ void Player::stopInfo() { requestToStart = true; } +void Player::setError(const char *e){ + strlcpy(_plError, e, PLERR_LN); + if(hasError()) { + config.setTitle(_plError); + telnet.printf("##ERROR#:\t%s\n", e); + } +} + void Player::_stop(bool alreadyStopped){ if(config.store.play_mode==PM_SDCARD) config.sdResumePos = player.getFilePos(); _status = STOPPED; setOutputPins(false); - config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped); + if(!hasError()) config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped); config.station.bitrate = 0; #ifdef USE_NEXTION nextion.bitrate(config.station.bitrate); @@ -155,6 +165,7 @@ void Player::setOutputPins(bool isPlaying) { } void Player::_play(uint16_t stationId) { + setError(""); remoteStationName = false; config.setDspOn(1); display.putRequest(PSTOP); @@ -179,12 +190,14 @@ void Player::_play(uint16_t stationId) { if (player_on_start_play) player_on_start_play(); }else{ telnet.printf("##ERROR#:\tError connecting to %s\n", config.station.url); + SET_PLAY_ERROR("Error connecting to %s", config.station.url); _stop(true); }; } #ifdef MQTT_ROOT_TOPIC void Player::browseUrl(){ + setError(""); remoteStationName = true; config.setDspOn(1); resumeAfterUrl = _status==PLAYING; @@ -202,6 +215,7 @@ void Player::browseUrl(){ if (player_on_start_play) player_on_start_play(); }else{ telnet.printf("##ERROR#:\tError connecting to %s\n", burl); + SET_PLAY_ERROR("Error connecting to %s", burl); _stop(true); } memset(burl, 0, MQTT_BURL_SIZE); diff --git a/yoRadio/src/core/player.h b/yoRadio/src/core/player.h index 4c01f19..967dd0c 100644 --- a/yoRadio/src/core/player.h +++ b/yoRadio/src/core/player.h @@ -12,6 +12,9 @@ #define MQTT_BURL_SIZE 512 #endif +#define PLERR_LN 64 +#define SET_PLAY_ERROR(...) {char buff[512 + 64]; sprintf(buff,__VA_ARGS__); setError(buff);} + enum playerRequestType_e : uint8_t { PR_PLAY = 1, PR_STOP = 2, PR_PREV = 3, PR_NEXT = 4, PR_VOL = 5 }; struct playerRequestParams_t { @@ -26,7 +29,8 @@ class Player: public Audio { uint32_t _volTicks; /* delayed volume save */ bool _volTimer; /* delayed volume save */ uint32_t _resumeFilePos; - plStatus_e _status; + plStatus_e _status; + char _plError[PLERR_LN]; private: void _stop(bool alreadyStopped = false); void _play(uint16_t stationId); @@ -45,6 +49,8 @@ class Player: public Audio { void init(); void loop(); void initHeaders(const char *file); + void setError(const char *e); + bool hasError() { return strlen(_plError)>0; } void sendCommand(playerRequestParams_t request); #ifdef MQTT_ROOT_TOPIC void browseUrl(); diff --git a/yoRadio/src/displays/conf/displayILI9341conf.h b/yoRadio/src/displays/conf/displayILI9341conf.h index efdcae1..51b8f88 100644 --- a/yoRadio/src/displays/conf/displayILI9341conf.h +++ b/yoRadio/src/displays/conf/displayILI9341conf.h @@ -48,7 +48,7 @@ const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER }; const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 }; /* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */ -const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 5 }; +const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 2 }; /* STRINGS */ const char numtxtFmt[] PROGMEM = "%d"; diff --git a/yoRadio/src/displays/conf/displayST7789conf.h b/yoRadio/src/displays/conf/displayST7789conf.h index 5cb32c3..14dba7d 100644 --- a/yoRadio/src/displays/conf/displayST7789conf.h +++ b/yoRadio/src/displays/conf/displayST7789conf.h @@ -51,7 +51,7 @@ const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER }; const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 }; /* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */ -const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 4 }; +const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 2 }; /* STRINGS */ const char numtxtFmt[] PROGMEM = "%d"; diff --git a/yoRadio/yoRadio.ino b/yoRadio/yoRadio.ino index 59dae35..4cdc99c 100644 --- a/yoRadio/yoRadio.ino +++ b/yoRadio/yoRadio.ino @@ -101,7 +101,8 @@ void audio_info(const char *info) { #endif if (strstr(info, "skip metadata") != NULL) config.setTitle(config.station.name); if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) { - telnet.printf("##ERROR#:\t%s\n", info); + player.setError(info); + } char* ici; char b[20]={0}; if ((ici = strstr(info, "BitRate: ")) != NULL) { @@ -132,8 +133,8 @@ bool printable(const char *info) { } void audio_showstation(const char *info) { - bool p = printable(info) && (strlen(info) > 0); - config.setTitle(p?info:config.station.name); + bool p = printable(info) && (strlen(info) > 0);(void)p; + //config.setTitle(p?info:config.station.name); if(player.remoteStationName){ config.setStation(p?info:config.station.name); display.putRequest(NEWSTATION); @@ -143,9 +144,7 @@ void audio_showstation(const char *info) { void audio_showstreamtitle(const char *info) { DBGH(); - if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL){ - telnet.printf("##ERROR#:\t%s\n", info); - } + if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) player.setError(info); bool p = printable(info) && (strlen(info) > 0); #ifdef DEBUG_TITLES config.setTitle(DEBUG_TITLES); @@ -155,7 +154,8 @@ void audio_showstreamtitle(const char *info) { } void audio_error(const char *info) { - config.setTitle(info); + //config.setTitle(info); + player.setError(info); telnet.printf("##ERROR#:\t%s\n", info); }