Browse Source

🚑️ Fix SD mount bug (#24319)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
ellensp 3 years ago
parent
commit
22f0496c9b
No account linked to committer's email address
1 changed files with 2 additions and 15 deletions
  1. 2
    15
      Marlin/src/sd/cardreader.cpp

+ 2
- 15
Marlin/src/sd/cardreader.cpp View File

@@ -495,12 +495,7 @@ void CardReader::manage_media() {
495 495
 
496 496
     // Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
497 497
     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?
504 499
 
505 500
     TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
506 501
   }
@@ -512,21 +507,13 @@ void CardReader::manage_media() {
512 507
 
513 508
   if (!stat) return;                // Exit if no media is present
514 509
 
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?
518 511
 
519 512
   DEBUG_ECHOLNPGM("First mount.");
520 513
 
521 514
   // Load settings the first time media is inserted (not just during init)
522 515
   TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
523 516
 
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
-
530 517
   bool do_auto = true; UNUSED(do_auto);
531 518
 
532 519
   // Check for PLR file.

Loading…
Cancel
Save