sd_i2s+sd_vs_v3
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "mp3_decoder/mp3_decoder.h"
|
||||
#include "aac_decoder/aac_decoder.h"
|
||||
#include "flac_decoder/flac_decoder.h"
|
||||
#include "../core/config.h"
|
||||
|
||||
#ifdef SDFATFS_USED
|
||||
fs::SDFATFS SD_SDFAT;
|
||||
@@ -311,11 +312,13 @@ void Audio::setDefaults() {
|
||||
vector_clear_and_shrink(m_playlistURL);
|
||||
vector_clear_and_shrink(m_playlistContent);
|
||||
m_hashQueue.clear(); m_hashQueue.shrink_to_fit(); // uint32_t vector
|
||||
client.stop();
|
||||
client.flush(); // release memory
|
||||
clientsecure.stop();
|
||||
clientsecure.flush();
|
||||
_client = static_cast<WiFiClient*>(&client); /* default to *something* so that no NULL deref can happen */
|
||||
if(config.store.play_mode!=PM_SDCARD){
|
||||
client.stop();
|
||||
client.flush(); // release memory
|
||||
clientsecure.stop();
|
||||
clientsecure.flush();
|
||||
_client = static_cast<WiFiClient*>(&client); /* default to *something* so that no NULL deref can happen */
|
||||
}
|
||||
playI2Sremains();
|
||||
|
||||
AUDIO_INFO("buffers freed, free Heap: %u bytes", ESP.getFreeHeap());
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef VS_PATCH_ENABLE
|
||||
#define VS_PATCH_ENABLE true
|
||||
#endif
|
||||
#include "../core/config.h"
|
||||
#include "audioVS1053Ex.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
@@ -569,10 +570,11 @@ void Audio::showstreamtitle(const char* ml) {
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void Audio::cardLock(bool lock){
|
||||
#if (TFT_CS!=255) || (SDC_CS!=255)
|
||||
#if (SDC_CS!=255)
|
||||
if(lock){
|
||||
xSemaphoreTake(mutex_pl, portMAX_DELAY);
|
||||
}else{
|
||||
// digitalWrite(SDC_CS, HIGH);
|
||||
xSemaphoreGive(mutex_pl);
|
||||
}
|
||||
#endif
|
||||
@@ -908,7 +910,6 @@ void Audio::processWebStream(){
|
||||
InBuff.bytesWasRead(bytesDecoded);
|
||||
}
|
||||
stopSong(); // Correct close when play known length sound #74 and before callback #112
|
||||
|
||||
if(m_f_tts){
|
||||
sprintf(chbuf, "End of speech: \"%s\"", m_lastHost);
|
||||
if(audio_info) audio_info(chbuf);
|
||||
@@ -1592,11 +1593,13 @@ void Audio::setDefaults(){
|
||||
InBuff.resetBuffer();
|
||||
vector_clear_and_shrink(m_playlistURL);
|
||||
vector_clear_and_shrink(m_playlistContent);
|
||||
client.stop();
|
||||
client.flush(); // release memory
|
||||
clientsecure.stop();
|
||||
clientsecure.flush();
|
||||
_client = static_cast<WiFiClient*>(&client); /* default to *something* so that no NULL deref can happen */
|
||||
if(config.store.play_mode!=PM_SDCARD){
|
||||
client.stop();
|
||||
client.flush(); // release memory
|
||||
clientsecure.stop();
|
||||
clientsecure.flush();
|
||||
_client = static_cast<WiFiClient*>(&client); /* default to *something* so that no NULL deref can happen */
|
||||
}
|
||||
m_f_ctseen=false; // Contents type not seen yet
|
||||
m_metaint=0; // No metaint yet
|
||||
m_LFcount=0; // For detection end of header
|
||||
@@ -1908,23 +1911,24 @@ bool Audio::connecttoFS(fs::FS &fs, const char* path, uint32_t resumeFilePos) {
|
||||
sprintf(chbuf, "Reading file: \"%s\"", audioName);
|
||||
if(audio_info) {vTaskDelay(2); audio_info(chbuf);}
|
||||
if(audio_beginSDread) audio_beginSDread();
|
||||
cardLock(true); audiofile.close(); cardLock(false);
|
||||
cardLock(true);
|
||||
audiofile.close();
|
||||
if(fs.exists(audioName)) {
|
||||
cardLock(true); audiofile = fs.open(audioName); cardLock(false);
|
||||
audiofile = fs.open(audioName);
|
||||
} else {
|
||||
UTF8toASCII(audioName);
|
||||
if(fs.exists(audioName)) {
|
||||
cardLock(true); audiofile = fs.open(audioName); cardLock(false);
|
||||
audiofile = fs.open(audioName);
|
||||
}
|
||||
}
|
||||
|
||||
if(!audiofile) {
|
||||
if(audio_info) {vTaskDelay(2); audio_info("Failed to open file for reading");}
|
||||
cardLock(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_f_localfile = true;
|
||||
cardLock(true);
|
||||
m_file_size = audiofile.size();//TEST loop
|
||||
|
||||
char* afn = strdup(audiofile.name()); // audioFileName
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endif
|
||||
|
||||
enum audioMode_e { PLAYING, STOPPED };
|
||||
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
|
||||
|
||||
struct audiorequest_t
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user