Skip to content

Commit a9cfecf

Browse files
ellenspthinkyhead
authored andcommitted
🚑️ Fix SD mount bug (MarlinFirmware#24319)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent ee1ef35 commit a9cfecf

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

Marlin/src/sd/cardreader.cpp

+2-15
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,7 @@ void CardReader::manage_media() {
495495

496496
// Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
497497
if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount();
498-
if (!isMounted()) { // Not mounted?
499-
stat = 0;
500-
#if HAS_SD_DETECT && DISABLED(SD_IGNORE_AT_STARTUP)
501-
prev_stat = 0;
502-
#endif
503-
}
498+
if (!isMounted()) stat = 0; // Not mounted?
504499

505500
TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
506501
}
@@ -512,21 +507,13 @@ void CardReader::manage_media() {
512507

513508
if (!stat) return; // Exit if no media is present
514509

515-
static bool did_first_insert = false;
516-
if (did_first_insert) return; // Did a media insert already happen?
517-
did_first_insert = true; // Definitely handling this media insert...
510+
if (old_stat != 2) return; // First mount?
518511

519512
DEBUG_ECHOLNPGM("First mount.");
520513

521514
// Load settings the first time media is inserted (not just during init)
522515
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
523516

524-
#if HAS_USB_FLASH_DRIVE
525-
const millis_t ms = millis();
526-
DEBUG_ECHOLNPGM("USB mount waiting time = ", ms);
527-
if (ms > 5000) return; // Too late to be considered "already inserted"?
528-
#endif
529-
530517
bool do_auto = true; UNUSED(do_auto);
531518

532519
// Check for PLR file.

0 commit comments

Comments
 (0)