This commit is contained in:
e2002
2023-06-02 12:12:21 +03:00
parent 3cd53f226a
commit aba29fcf16
15 changed files with 263 additions and 178 deletions

View File

@@ -35,6 +35,10 @@
#define REAL_INDEX getMode()==PM_WEB?INDEX_PATH:INDEX_SD_PATH
#define MAX_PLAY_MODE 1
#if SDC_CS!=255
#define USE_SD
#endif
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
enum cardStatus_e : uint8_t { CS_NONE=0, CS_PRESENT=1, CS_MOUNTED=2, CS_EJECTED=3 };
enum BitrateFormat { BF_UNCNOWN, BF_MP3, BF_AAC, BF_FLAC, BF_OGG, BF_WAV };
@@ -164,7 +168,6 @@ class Config {
bool sdSnuffle;
bool emptyFS;
bool SDinit;
bool mountSDbusy;
public:
Config() {};
void save();
@@ -194,8 +197,12 @@ class Config {
void setBitrateFormat(BitrateFormat fmt) { configFmt = fmt; }
void initPlaylist();
void indexPlaylist();
void initSDPlaylist(bool doIndex = true);
void indexSDPlaylist();
#ifdef USE_SD
void initSDPlaylist(bool doIndex = true);
void indexSDPlaylist();
void changeMode(int newmode=-1);
void checkSD();
#endif
uint8_t fillPlMenu(int from, uint8_t count, bool fromNextion=false);
char * stationByNum(uint16_t num);
void setTimezone(int8_t tzh, int8_t tzm);
@@ -207,29 +214,32 @@ class Config {
void bootInfo();
void doSleepW();
void setSnuffle(bool sn);
void changeMode(int newmode=-1);
uint8_t getMode() { return store.play_mode & 0b11; }
void initPlaylistMode();
void checkSD();
cardStatus_e getSDStatus(){ return _cardStatus; };
void clearCardStatus() { if(_cardStatus!=CS_NONE) _cardStatus=CS_NONE; }
bool spiffsCleanup();
FS* SDPLFS(){ return _SDplaylistFS; }
private:
template <class T> int eepromWrite(int ee, const T& value);
template <class T> int eepromRead(int ee, T& value);
cardStatus_e _cardStatus;
bool _bootDone;
FS* _SDplaylistFS;
void setDefaults();
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);
#ifdef USE_SD
void listSD(File &plSDfile, File &plSDindex, const char * dirname, uint8_t levels);
bool _sdCardIsConnected();
void _mountSD();
bool _sdBegin();
#endif
bool checkNoMedia(const char* path);
void _initHW();
bool _isFSempty();
bool _sdCardIsConnected();
void _mountSD();
bool _sdBegin();
char _stationBuf[BUFLEN/2];
};