mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
🚑️ Fix SD mount bug (#24319)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
d0e9ff0e29
commit
22f0496c9b
@ -495,12 +495,7 @@ void CardReader::manage_media() {
|
|||||||
|
|
||||||
// Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
|
// Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
|
||||||
if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount();
|
if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount();
|
||||||
if (!isMounted()) { // Not mounted?
|
if (!isMounted()) stat = 0; // Not mounted?
|
||||||
stat = 0;
|
|
||||||
#if HAS_SD_DETECT && DISABLED(SD_IGNORE_AT_STARTUP)
|
|
||||||
prev_stat = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
|
TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
|
||||||
}
|
}
|
||||||
@ -512,21 +507,13 @@ void CardReader::manage_media() {
|
|||||||
|
|
||||||
if (!stat) return; // Exit if no media is present
|
if (!stat) return; // Exit if no media is present
|
||||||
|
|
||||||
static bool did_first_insert = false;
|
if (old_stat != 2) return; // First mount?
|
||||||
if (did_first_insert) return; // Did a media insert already happen?
|
|
||||||
did_first_insert = true; // Definitely handling this media insert...
|
|
||||||
|
|
||||||
DEBUG_ECHOLNPGM("First mount.");
|
DEBUG_ECHOLNPGM("First mount.");
|
||||||
|
|
||||||
// Load settings the first time media is inserted (not just during init)
|
// Load settings the first time media is inserted (not just during init)
|
||||||
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
|
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
|
||||||
|
|
||||||
#if HAS_USB_FLASH_DRIVE
|
|
||||||
const millis_t ms = millis();
|
|
||||||
DEBUG_ECHOLNPGM("USB mount waiting time = ", ms);
|
|
||||||
if (ms > 5000) return; // Too late to be considered "already inserted"?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool do_auto = true; UNUSED(do_auto);
|
bool do_auto = true; UNUSED(do_auto);
|
||||||
|
|
||||||
// Check for PLR file.
|
// Check for PLR file.
|
||||||
|
Loading…
Reference in New Issue
Block a user