sd_i2s+sd_vs_v3

This commit is contained in:
e2002
2022-12-16 12:43:53 +03:00
parent db34be117f
commit a2ba963027
8 changed files with 43 additions and 23 deletions

View File

@@ -6,7 +6,7 @@
Config config;
#if DSP_HSPI || TS_HSPI || VS_HSPI
#if DSP_HSPI || TS_HSPI || VS_HSPI || SD_HSPI
SPIClass SPI2(HSPI);
#endif
//SPIClass SDSPI(VSPI);
@@ -296,6 +296,13 @@ bool endsWith (const char* base, const char* str) {
return (strncmp(p, str, slen) == 0);
}
bool Config::checkNoMedia(const char* path){
char nomedia[BUFLEN]= {0};
strlcat(nomedia, path, BUFLEN);
strlcat(nomedia, "/.nomedia", BUFLEN);
return SD.exists(nomedia);
}
void Config::listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels){
File root = SD.open(dirname);
if(!root){
@@ -313,7 +320,7 @@ void Config::listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8
while(file){
if(file.isDirectory()){
if(levels){
if(levels && !checkNoMedia(file.path())){
listSD(plSDfile, plSDindex, file.path(), levels -1);
}
} else {

View File

@@ -33,6 +33,7 @@
#define REAL_INDEX store.play_mode==PM_WEB?INDEX_PATH:INDEX_SD_PATH
#define MAX_PLAY_MODE 1
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
void u8fix(char *src);
@@ -179,9 +180,6 @@ class Config {
void setSmartStart(byte ss);
void initPlaylist();
void indexPlaylist();
void listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels);
void initSDPlaylist();
void indexSDPlaylist();
void fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum = false);
void setTimezone(int8_t tzh, int8_t tzm);
void setTimezoneOffset(uint16_t tzo);
@@ -198,6 +196,10 @@ class Config {
Ticker _sleepTimer;
static void doSleep();
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
void listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels);
void initSDPlaylist();
void indexSDPlaylist();
bool checkNoMedia(const char* path);
};
extern Config config;

View File

@@ -499,6 +499,7 @@ void onBtnClick(int id) {
break;
}
case EVT_BTNMODE: {
if(SDC_CS==255) break;
config.store.play_mode++;
if(config.store.play_mode > MAX_PLAY_MODE){
config.store.play_mode=0;

View File

@@ -484,6 +484,7 @@ void NetServer::getPlaylist(uint8_t clientId) {
}
bool NetServer::importPlaylist() {
if(config.store.play_mode==PM_SDCARD) return false;
File tempfile = SPIFFS.open(TMP_PATH, "r");
if (!tempfile) {
return false;

View File

@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h
#define YOVERSION "0.8.800"
#define YOVERSION "0.8.813"
/*******************************************************
DO NOT EDIT THIS FILE.
@@ -121,6 +121,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef SDC_CS
#define SDC_CS 255 // SDCARD CS pin
#endif
#ifndef SD_HSPI
#define SD_HSPI false // use HSPI for SD (miso=12, mosi=13, clk=14) instead of VSPI (by default)
#endif
/* ENCODER */
#ifndef ENC_BTNL

View File

@@ -9,7 +9,6 @@
#endif
enum audioMode_e { PLAYING, STOPPED };
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
struct audiorequest_t
{