Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Edzelf authored May 5, 2022
1 parent 885bf5d commit 633156c
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions include/SDcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
//

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

#define SDPRESENT 4 // GPIO Pin will be low if card inserted

struct mp3specbuf_t
{
char mp3specbuf[MAXSPACE] ; // Space for all MP3 filenames on SD card

This comment has been minimized.

Copy link
@tsctrl

tsctrl May 9, 2022

hi @Edzelf , #define mount_SDCARD() false need to have parameters as csPIN, SPI, SPEED mount_SDCARD(a,b,c)

This comment has been minimized.

Copy link
@tsctrl

tsctrl May 9, 2022

(char*)new ( mp3specbuf_t ) ; require try catch block, as it will crash if oom

This comment has been minimized.

Copy link
@tsctrl

tsctrl May 9, 2022

bugfix:
dbgprint ("mp3 file length %s", mp3filelength); to
dbgprint ("mp3 file length %d", mp3filelength);

Expand Down Expand Up @@ -245,14 +243,15 @@ struct mp3spec_t // For List of mp3 file on
// G E T S D T R A C K S *
//**************************************************************************************************
// Search all MP3 files on directory of SD card. *
// Will be called recursively. *
//**************************************************************************************************
void getsdtracks ( fs::FS &fs, const char * dirname, uint8_t levels )
void getsdtracks ( const char * dirname, uint8_t levels )
{
File root ; // Work directory
File file ; // File in work directory

claimSPI ( "sdopen1" ) ; // Claim SPI bus
root = fs.open ( dirname ) ; // Open directory
root = SD.open ( dirname ) ; // Open directory
releaseSPI() ; // Release SPI bus
if ( !root ) // Check on open
{
Expand All @@ -276,7 +275,7 @@ struct mp3spec_t // For List of mp3 file on
{
if ( strrchr ( file.name(), '/' )[1] != '.' ) // Skip hidden directories
{
getsdtracks ( fs, file.name(), levels -1 ) ; // Non hidden directory: call recursive
getsdtracks ( file.name(), levels -1 ) ; // Non hidden directory: call recursive
}
}
}
Expand Down Expand Up @@ -479,18 +478,16 @@ struct mp3spec_t // For List of mp3 file on
//**************************************************************************************************
void scan_SDCARD()
{
clearFileList() ; // Create list with names and count
clearFileList() ; // Create list with names and count
dbgprint ( "Locate mp3 files on SD, "
"may take a while..." ) ;
getsdtracks ( SD, "/", SD_MAXDEPTH ) ; // Build file list
getsdtracks ( "/", SD_MAXDEPTH ) ; // Build file list
dbgprint ( "Space %d", ESP.getFreeHeap() ) ;
dbgprint ( "%d tracks on SD",
SD_filecount ) ;
getFirstSDFileName() ; // Point to first entry
dbgprint ( "%d tracks on SD", SD_filecount ) ; // Show number of files
getFirstSDFileName() ; // Point to first entry
}



//**************************************************************************************************
// C L O S E _ S D C A R D *
//**************************************************************************************************
Expand Down

0 comments on commit 633156c

Please sign in to comment.