Skip to content

Commit

Permalink
fix back MMC support
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Jun 30, 2024
1 parent d79cfd5 commit 232ee86
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
23 changes: 12 additions & 11 deletions Firmware/Bentuino/src/Component/components/files/FilesComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ bool FilesComponent::initInternal(JsonObject o)
{
useInternalMemory = false;

bool mounted = false;
#ifdef FILES_TYPE_MMC

NDBG("Init SD MMC");
if (SD_MMC.begin("/sdcard", true)) // if using ESP32 package 3.x.x
{
mounted = true;
}
#else

NDBG("Init SD SPI");

AddIntParamConfig(sdEnPin);
AddBoolParamConfig(sdEnVal);
AddIntParamConfig(sdSCK);
Expand Down Expand Up @@ -37,17 +49,6 @@ bool FilesComponent::initInternal(JsonObject o)
return initInternalMemory();
}

bool mounted = false;
#ifdef FILES_MMC_TYPE

NDBG("Init SD MMC");
if (SD_MMC.begin("/sdcard", true)) // if using ESP32 package 3.x.x
{
mounted = true;
}
#else

NDBG("Init SD SPI");
// NDBG("initilializing SD with pins SCK,MISO,MOSI,CS,Speed : " + sdSCK.stringValue() + "," + sdMiso.stringValue() + "," + sdMosi.stringValue() + "," + sdCS.stringValue() + "," + sdSpeed.stringValue());
pinMode(sdSCK, INPUT_PULLUP);
pinMode(sdMiso, INPUT_PULLUP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bool handleCommandInternal(const String &command, var *data, int numData) overri
DeclareComponentEventTypes(UploadStart, UploadProgress, UploadComplete, UploadCancel, FileList);
DeclareComponentEventNames("uploadStart", "uploadProgress", "uploadComplete", "uploadCancel", "list");

#ifdef FILES_TYPE_SD
HandleSetParamInternalStart
CheckAndSetParam(sdEnPin);
CheckAndSetParam(sdEnVal);
Expand Down Expand Up @@ -65,5 +66,6 @@ FillOSCQueryIntParam(sdMosi);
FillOSCQueryIntParam(sdCS);
FillOSCQueryIntParam(sdSpeed);
FillOSCQueryInternalEnd
#endif

EndDeclareComponent
EndDeclareComponent
6 changes: 3 additions & 3 deletions Firmware/Bentuino/src/UnityIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

#ifdef USE_FILES

#ifndef FILES_MMC_TYPE
#define FILES_SD_TYPE
#ifndef FILES_TYPE_MMC
#define FILES_TYPE_SD
#endif

#ifdef FILES_MMC_TYPE
#ifdef FILES_TYPE_MMC
#include "SD_MMC.h"
#else
#include "SD.h"
Expand Down

0 comments on commit 232ee86

Please sign in to comment.