Skip to content

Commit 633156c

Browse files
authored
Add files via upload
1 parent 885bf5d commit 633156c

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

include/SDcard.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
//
44

55
#define MAXFNLEN 512 // Max length of a full filespec
6-
#define MAXSPACE 20000 // Max space for filenames (bytes, not tracks)
6+
#define MAXSPACE 40000 // Max space for filenames (bytes, not tracks).
77
// Approx. 36 tracks per kB
88
#define SD_MAXDEPTH 4 // Maximum depths. Note: see mp3play_html.
99

10-
#define SDPRESENT 4 // GPIO Pin will be low if card inserted
11-
1210
struct mp3specbuf_t
1311
{
1412
char mp3specbuf[MAXSPACE] ; // Space for all MP3 filenames on SD card
@@ -245,14 +243,15 @@ struct mp3spec_t // For List of mp3 file on
245243
// G E T S D T R A C K S *
246244
//**************************************************************************************************
247245
// Search all MP3 files on directory of SD card. *
246+
// Will be called recursively. *
248247
//**************************************************************************************************
249-
void getsdtracks ( fs::FS &fs, const char * dirname, uint8_t levels )
248+
void getsdtracks ( const char * dirname, uint8_t levels )
250249
{
251250
File root ; // Work directory
252251
File file ; // File in work directory
253252

254253
claimSPI ( "sdopen1" ) ; // Claim SPI bus
255-
root = fs.open ( dirname ) ; // Open directory
254+
root = SD.open ( dirname ) ; // Open directory
256255
releaseSPI() ; // Release SPI bus
257256
if ( !root ) // Check on open
258257
{
@@ -276,7 +275,7 @@ struct mp3spec_t // For List of mp3 file on
276275
{
277276
if ( strrchr ( file.name(), '/' )[1] != '.' ) // Skip hidden directories
278277
{
279-
getsdtracks ( fs, file.name(), levels -1 ) ; // Non hidden directory: call recursive
278+
getsdtracks ( file.name(), levels -1 ) ; // Non hidden directory: call recursive
280279
}
281280
}
282281
}
@@ -479,18 +478,16 @@ struct mp3spec_t // For List of mp3 file on
479478
//**************************************************************************************************
480479
void scan_SDCARD()
481480
{
482-
clearFileList() ; // Create list with names and count
481+
clearFileList() ; // Create list with names and count
483482
dbgprint ( "Locate mp3 files on SD, "
484483
"may take a while..." ) ;
485-
getsdtracks ( SD, "/", SD_MAXDEPTH ) ; // Build file list
484+
getsdtracks ( "/", SD_MAXDEPTH ) ; // Build file list
486485
dbgprint ( "Space %d", ESP.getFreeHeap() ) ;
487-
dbgprint ( "%d tracks on SD",
488-
SD_filecount ) ;
489-
getFirstSDFileName() ; // Point to first entry
486+
dbgprint ( "%d tracks on SD", SD_filecount ) ; // Show number of files
487+
getFirstSDFileName() ; // Point to first entry
490488
}
491489

492490

493-
494491
//**************************************************************************************************
495492
// C L O S E _ S D C A R D *
496493
//**************************************************************************************************

0 commit comments

Comments
 (0)