Skip to content

Commit b5881ee

Browse files
committed
SDMMC enable max open files arg
1 parent e5071e0 commit b5881ee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

libraries/SD_MMC/src/SD_MMC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SDMMCFS::SDMMCFS(FSImplPtr impl)
3636
: FS(impl), _card(NULL)
3737
{}
3838

39-
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed)
39+
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed, int maxOpenFiles)
4040
{
4141
if(_card) {
4242
return true;
@@ -70,7 +70,7 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
7070

7171
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
7272
.format_if_mount_failed = format_if_mount_failed,
73-
.max_files = 5,
73+
.max_files = maxOpenFiles,
7474
.allocation_unit_size = 0
7575
};
7676

libraries/SD_MMC/src/SD_MMC.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include "driver/sdmmc_types.h"
1919
#include "sd_defines.h"
2020

21+
#ifndef SDMMC_HOST_MAX_FILES_DEFAULT
22+
#define SDMMC_HOST_MAX_FILES_DEFAULT 10
23+
#endif
24+
2125
namespace fs
2226
{
2327

@@ -28,7 +32,7 @@ class SDMMCFS : public FS
2832

2933
public:
3034
SDMMCFS(FSImplPtr impl);
31-
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false);
35+
bool begin(const char *mountpoint = "/sdcard", bool mode1bit = false, bool format_if_mount_failed = false, int maxOpenFiles = SDMMC_HOST_MAX_FILES_DEFAULT);
3236
void end();
3337
sdcard_type_t cardType();
3438
uint64_t cardSize();

0 commit comments

Comments
 (0)