diff --git a/README.md b/README.md index 6b004d8..c830306 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,16 @@ Work is in progress... --- ## Version history +### 0.9.420 +**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** +- added screensaver mode during playback, configurable via the web interface, pull request[#129](https://github.com/e2002/yoradio/pull/129) +- added blank screen mode to screensaver, configurable via the web interface, pull request[#129](https://github.com/e2002/yoradio/pull/129) + Thanks to @trip5 for the amazing code! +- speeding up indexing of SD cards (advice - don't put all files in one folder) +- i don't remember (honestly) why the AsyncTCP server worked on the same core with the player, now it works on the same core with the display + `#define CONFIG_ASYNC_TCP_RUNNING_CORE 0` +- bug fixes + ### v0.9.412 **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** - added mDNS support, configurable via the web interface, pull[#125](https://github.com/e2002/yoradio/pull/125) diff --git a/yoRadio/src/AsyncWebServer/AsyncTCP.h b/yoRadio/src/AsyncWebServer/AsyncTCP.h index ca57ff8..c898bf0 100644 --- a/yoRadio/src/AsyncWebServer/AsyncTCP.h +++ b/yoRadio/src/AsyncWebServer/AsyncTCP.h @@ -32,7 +32,7 @@ extern "C" { //If core is not defined, then we are running in Arduino or PIO #ifndef CONFIG_ASYNC_TCP_RUNNING_CORE - #define CONFIG_ASYNC_TCP_RUNNING_CORE 1 //any available core (-1) + #define CONFIG_ASYNC_TCP_RUNNING_CORE 0 //any available core (-1) #endif #ifndef CONFIG_ASYNC_TCP_USE_WDT @@ -43,7 +43,7 @@ extern "C" { #define XTASK_MEM_SIZE 6144 // 8192 / 2 #endif #ifndef XTASK_PRIOTITY - #define XTASK_PRIOTITY 3 //3 + #define XTASK_PRIOTITY 5 //3 #endif #ifndef ATCP_TASK_DELAY #define ATCP_TASK_DELAY 2 diff --git a/yoRadio/src/core/display.cpp b/yoRadio/src/core/display.cpp index ce058c1..0b87fed 100644 --- a/yoRadio/src/core/display.cpp +++ b/yoRadio/src/core/display.cpp @@ -534,8 +534,14 @@ void Display::_time(bool redraw) { config.setBrightness(); } #endif - if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0) - _clock.moveTo({clockConf.left, static_cast(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2))), 0}); + if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0){ + #ifdef GXCLOCKFONT + uint16_t ft=static_cast(random(TFT_FRAMEWDT, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2-clockConf.textsize))); + #else + uint16_t ft=static_cast(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2))); + #endif + _clock.moveTo({clockConf.left, ft, 0}); + } _clock.draw(); /*#ifdef USE_NEXTION nextion.printClock(network.timeinfo); diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index 13cb532..875bb39 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.412" +#define YOVERSION "0.9.420" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/core/sdmanager.cpp b/yoRadio/src/core/sdmanager.cpp index fa1c68f..1b70abd 100644 --- a/yoRadio/src/core/sdmanager.cpp +++ b/yoRadio/src/core/sdmanager.cpp @@ -60,41 +60,50 @@ bool SDManager::_endsWith (const char* base, const char* str) { return (strncmp(p, str, slen) == 0); } -void SDManager::listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels){ - File root = sdman.open(dirname); - if(!root){ - Serial.println("##[ERROR]#\tFailed to open directory"); - return; - } - if(!root.isDirectory()){ - Serial.println("##[ERROR]#\tNot a directory"); - return; - } - File file = root.openNextFile(); - uint32_t pos = 0; - while(file){ - vTaskDelay(2); - bool fid = file.isDirectory(); - const char * fp = file.path(); - const char * fn = file.name(); - if(fid){ - if(levels && !_checkNoMedia(fp)){ - listSD(plSDfile, plSDindex, fp, levels -1); - } - } else { - if(_endsWith(strlwr((char*)fn), ".mp3") || _endsWith(fn, ".m4a") || _endsWith(fn, ".aac") || _endsWith(fn, ".wav") || _endsWith(fn, ".flac")){ - pos = plSDfile.position(); - plSDfile.print(fn); plSDfile.print("\t"); plSDfile.print(fp); plSDfile.print("\t"); plSDfile.println(0); - plSDindex.write((uint8_t *) &pos, 4); - Serial.print("."); - if(display.mode()==SDCHANGE) display.putRequest(SDFILEINDEX, _sdFCount+1); - _sdFCount++; - if(_sdFCount%64==0) Serial.println(); - } +void SDManager::listSD(File &plSDfile, File &plSDindex, const char* dirname, uint8_t levels) { + File root = sdman.open(dirname); + if (!root) { + Serial.println("##[ERROR]#\tFailed to open directory"); + return; } - if(file) file.close(); file = root.openNextFile(); - } - if(root) root.close(); + if (!root.isDirectory()) { + Serial.println("##[ERROR]#\tNot a directory"); + return; + } + + uint32_t pos = 0; + char* filePath; + while (true) { + vTaskDelay(2); + bool isDir; + String fileName = root.getNextFileName(&isDir); + if (fileName.isEmpty()) break; + filePath = (char*)malloc(fileName.length() + 1); + if (filePath == NULL) { + Serial.println("Memory allocation failed"); + break; + } + strcpy(filePath, fileName.c_str()); + const char* fn = strrchr(filePath, '/') + 1; + if (isDir) { + if (levels && !_checkNoMedia(filePath)) { + listSD(plSDfile, plSDindex, filePath, levels - 1); + } + } else { + if (_endsWith(strlwr((char*)fn), ".mp3") || _endsWith(fn, ".m4a") || _endsWith(fn, ".aac") || + _endsWith(fn, ".wav") || _endsWith(fn, ".flac")) { + pos = plSDfile.position(); + plSDfile.printf("%s\t%s\t0\n", fn, filePath); + plSDindex.write((uint8_t*)&pos, 4); + Serial.print("."); + if(display.mode()==SDCHANGE) display.putRequest(SDFILEINDEX, _sdFCount+1); + _sdFCount++; + if (_sdFCount % 64 == 0) Serial.println(); + } + } + free(filePath); + } + root.close(); } void SDManager::indexSDPlaylist() { diff --git a/yoRadio/src/displays/displayLC1602.cpp b/yoRadio/src/displays/displayLC1602.cpp index ca3bd9e..7078505 100644 --- a/yoRadio/src/displays/displayLC1602.cpp +++ b/yoRadio/src/displays/displayLC1602.cpp @@ -65,7 +65,7 @@ void DspCore::drawPlaylist(uint16_t currentItem) { clear(); config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); setCursor(0,1); - write(byte(126)); + write(uint8_t(126)); } void DspCore::clearDsp(bool black) { diff --git a/yoRadio/src/displays/displaySH1106.h b/yoRadio/src/displays/displaySH1106.h index aab5baf..9f3e06c 100644 --- a/yoRadio/src/displays/displaySH1106.h +++ b/yoRadio/src/displays/displaySH1106.h @@ -11,6 +11,7 @@ #define CHARHEIGHT 8 #define DSP_OLED +#define GXCLOCKFONT typedef GFXcanvas1 Canvas; #include "widgets/widgets.h" diff --git a/yoRadio/src/displays/displaySSD1305.h b/yoRadio/src/displays/displaySSD1305.h index 14b5118..3809309 100644 --- a/yoRadio/src/displays/displaySSD1305.h +++ b/yoRadio/src/displays/displaySSD1305.h @@ -11,6 +11,7 @@ #define CHARHEIGHT 8 #define DSP_OLED +#define GXCLOCKFONT typedef GFXcanvas1 Canvas; #include "widgets/widgets.h" diff --git a/yoRadio/src/displays/displaySSD1306.h b/yoRadio/src/displays/displaySSD1306.h index 9b4dcb1..f979a9b 100644 --- a/yoRadio/src/displays/displaySSD1306.h +++ b/yoRadio/src/displays/displaySSD1306.h @@ -11,6 +11,7 @@ #define CHARHEIGHT 8 #define DSP_OLED +#define GXCLOCKFONT typedef GFXcanvas1 Canvas; #include "widgets/widgets.h" diff --git a/yoRadio/src/displays/displayST7920.h b/yoRadio/src/displays/displayST7920.h index 6f0f305..2aa4163 100644 --- a/yoRadio/src/displays/displayST7920.h +++ b/yoRadio/src/displays/displayST7920.h @@ -11,6 +11,7 @@ #define CHARHEIGHT 8 #define DSP_OLED +#define GXCLOCKFONT typedef GFXcanvas1 Canvas; #include "widgets/widgets.h"