瀏覽代碼

🚑️ Fix SD mount bug (#24319)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
ellensp 3 年之前
父節點
當前提交
22f0496c9b
No account linked to committer's email address
共有 1 個文件被更改,包括 2 次插入15 次删除
  1. 2
    15
      Marlin/src/sd/cardreader.cpp

+ 2
- 15
Marlin/src/sd/cardreader.cpp 查看文件

495
 
495
 
496
     // Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
496
     // Try to mount the media (only later with SD_IGNORE_AT_STARTUP)
497
     if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount();
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
     TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
500
     TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug
506
   }
501
   }
512
 
507
 
513
   if (!stat) return;                // Exit if no media is present
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
   DEBUG_ECHOLNPGM("First mount.");
512
   DEBUG_ECHOLNPGM("First mount.");
520
 
513
 
521
   // Load settings the first time media is inserted (not just during init)
514
   // Load settings the first time media is inserted (not just during init)
522
   TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
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
   bool do_auto = true; UNUSED(do_auto);
517
   bool do_auto = true; UNUSED(do_auto);
531
 
518
 
532
   // Check for PLR file.
519
   // Check for PLR file.

Loading…
取消
儲存