optimisation: if SD card fails to mount, do not set root directory

I noticed this on Marlin 2.1 side, it should apply here as well.
This commit is contained in:
gudnimg 2023-10-01 14:39:50 +00:00 committed by Guðni Már Gilbert
parent 3c64874e20
commit e0eb8b8a24
1 changed files with 3 additions and 15 deletions

View File

@ -230,29 +230,17 @@ void CardReader::initsd(bool doPresort/* = true*/)
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK
} }
workDir=root;
curDir=&root;
workDirDepth = 0;
#ifdef SDCARD_SORT_ALPHA if (cardOK)
if (doPresort)
presort();
#endif
/*
if(!workDir.openRoot(&volume))
{ {
SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL); setroot(doPresort);
} }
*/
} }
void CardReader::setroot(bool doPresort) void __attribute__((noinline)) CardReader::setroot(bool doPresort)
{ {
workDir=root; workDir=root;
workDirDepth = 0; workDirDepth = 0;
curDir=&workDir; curDir=&workDir;
#ifdef SDCARD_SORT_ALPHA #ifdef SDCARD_SORT_ALPHA
if (doPresort) if (doPresort)