From 7c85f250421058f7fed8d29be4a6b0f15e7ca922 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:33:25 +1200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20SD=20mount=20bug?= =?UTF-8?q?=20(#24319)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/sd/cardreader.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 5e03795692..3fff796539 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -495,12 +495,7 @@ void CardReader::manage_media() { // Try to mount the media (only later with SD_IGNORE_AT_STARTUP) if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount(); - if (!isMounted()) { // Not mounted? - stat = 0; - #if HAS_SD_DETECT && DISABLED(SD_IGNORE_AT_STARTUP) - prev_stat = 0; - #endif - } + if (!isMounted()) stat = 0; // Not mounted? 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 - static bool did_first_insert = false; - if (did_first_insert) return; // Did a media insert already happen? - did_first_insert = true; // Definitely handling this media insert... + if (old_stat != 2) return; // First mount? DEBUG_ECHOLNPGM("First mount."); // Load settings the first time media is inserted (not just during init) 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); // Check for PLR file.