Skip to content

Commit

Permalink
Mounting SDCard issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Nov 8, 2024
1 parent f3c4bfd commit 95fc568
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/core/sd_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ bool setupSdCard() {
}

// avoid unnecessary remounting
if(sdcardMounted) return true;
//if(sdcardMounted) return true;

#if defined(CORES3)
if (!SD.begin(SDCARD_CS))
#elif TFT_MOSI == SDCARD_MOSI && TFT_MOSI>0
if (!SD.begin(SDCARD_CS, tft.getSPIinstance()))
#else
sdcardSPI.end();
sdcardSPI.begin(SDCARD_SCK, SDCARD_MISO, SDCARD_MOSI, SDCARD_CS); // start SPI communications
delay(10);
if (!SD.begin(SDCARD_CS, sdcardSPI))
#endif
{
Expand Down
16 changes: 12 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void begin_tft(){
M5.begin();

#endif
tft.fillScreen(TFT_BLACK);
tft.setRotation(bruceConfig.rotation);
resetTftDisplay();
setBrightness(bruceConfig.bright);
Expand Down Expand Up @@ -368,11 +369,18 @@ void setup() {
BLEConnected=false;

setup_gpio();
begin_storage();

bruceConfig.fromFile();

#if TFT_MOSI==SDCARD_MOSI // If TFT and SD_Card shares the same SPI Bus, TFT must be initialized before.
bruceConfig.bright=100; // theres is no value yet
begin_tft();
begin_storage();
bruceConfig.fromFile();
#else
begin_storage();
bruceConfig.fromFile();
begin_tft();
#endif

begin_tft();
init_clock();

boot_screen();
Expand Down

0 comments on commit 95fc568

Please sign in to comment.