From 2f71c1859c6cca0befce5ed4ebae140f5956aa71 Mon Sep 17 00:00:00 2001 From: e2002 Date: Sat, 3 Jun 2023 13:40:10 +0300 Subject: [PATCH] v0.9.242 --- README.md | 5 +++++ yoRadio/src/audioVS1053/audioVS1053Ex.cpp | 4 +++- yoRadio/src/core/config.cpp | 18 +++++++++++------- yoRadio/src/core/options.h | 2 +- yoRadio/src/core/player.cpp | 1 + 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5a7bcb2..aec2ecc 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,11 @@ Work is in progress... --- ## Version history +#### v0.9.242 +- fixed a hang bug when scrolling through an SD playlist with an encoder in configurations with VS1053B +- fixed a hang bug when quickly switching SD / WEB modes from the WEB interface in configurations with VS1053B +- fixes in the logic of work + #### v0.9.236 - fix compilation error 'class NetServer' has no member named 'resetQueue' diff --git a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp index 6553af6..64a9bd2 100644 --- a/yoRadio/src/audioVS1053/audioVS1053Ex.cpp +++ b/yoRadio/src/audioVS1053/audioVS1053Ex.cpp @@ -425,7 +425,9 @@ void Audio::stopSong() { uint16_t modereg; // Read from mode register int i; // Loop control - + if(audiofile){ + cardLock(true);audiofile.close();cardLock(false); + } m_f_localfile = false; m_f_webfile = false; m_f_webstream = false; diff --git a/yoRadio/src/core/config.cpp b/yoRadio/src/core/config.cpp index c0ed15f..7e2feb3 100644 --- a/yoRadio/src/core/config.cpp +++ b/yoRadio/src/core/config.cpp @@ -64,7 +64,8 @@ void Config::init() { ssidsCount = 0; _cardStatus = CS_NONE; _SDplaylistFS = getMode()==PM_SDCARD?&SD:(true?&SPIFFS:_SDplaylistFS); - if(SDC_CS!=255) randomSeed(analogRead(SDC_CS)); + //if(SDC_CS!=255) randomSeed(analogRead(SDC_CS)); + randomSeed(esp_random()); backupSDStation = 0; //checkSD(); _bootDone=false; @@ -162,6 +163,7 @@ void Config::changeMode(int newmode){ delay(10); delay(50); } + if(getMode()==PM_WEB) player.setResumeFilePos(0); initPlaylistMode(); if (store.smartstart == 1) player.sendCommand({PR_PLAY, store.lastStation}); //else @@ -661,23 +663,25 @@ uint8_t Config::fillPlMenu(int from, uint8_t count, bool fromNextion) { playlist.seek(pos, SeekSet); sdog.giveMutex(); } - while (playlist.available()) { + bool pla = true; + while (pla) { sdog.takeMutex(); + pla = playlist.available(); String stationName = playlist.readStringUntil('\n'); sdog.giveMutex(); stationName = stationName.substring(0, stationName.indexOf('\t')); - if(config.store.numplaylist) stationName = String(from+c)+" "+stationName; + if(config.store.numplaylist && stationName.length()>0) stationName = String(from+c)+" "+stationName; if(!fromNextion) display.printPLitem(c, stationName.c_str()); - #ifdef USE_NEXTION - if(fromNextion) nextion.printPLitem(c, stationName.c_str()); - #endif + #ifdef USE_NEXTION + if(fromNextion) nextion.printPLitem(c, stationName.c_str()); + #endif c++; if (c >= count) break; } break; } - return c; sdog.takeMutex();playlist.close();sdog.giveMutex(); + return c; } bool Config::parseCSV(const char* line, char* name, char* url, int &ovol) { diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index 5c28133..0bf6dde 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.236" +#define YOVERSION "0.9.242" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/core/player.cpp b/yoRadio/src/core/player.cpp index 9571270..8e5a1ed 100644 --- a/yoRadio/src/core/player.cpp +++ b/yoRadio/src/core/player.cpp @@ -36,6 +36,7 @@ QueueHandle_t playerQueue; void Player::init() { Serial.print("##[BOOT]#\tplayer.init\t"); playerQueue=NULL; + _resumeFilePos = 0; playerQueue = xQueueCreate( 5, sizeof( playerRequestParams_t ) ); setOutputPins(false); delay(50);