Browse Source

Option to ignore SD at startup (#20099)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Hebezo 3 years ago
parent
commit
6ccb4b93b1
No account linked to committer's email address
3 changed files with 16 additions and 7 deletions
  1. 1
    0
      Marlin/Configuration_adv.h
  2. 13
    6
      Marlin/src/inc/SanityCheck.h
  3. 2
    1
      Marlin/src/sd/cardreader.cpp

+ 1
- 0
Marlin/Configuration_adv.h View File

@@ -1172,6 +1172,7 @@
1172 1172
   // Enable this option and set to HIGH if your SD cards are incorrectly detected.
1173 1173
   //#define SD_DETECT_STATE HIGH
1174 1174
 
1175
+  //#define SD_IGNORE_AT_STARTUP            // Don't mount the SD card when starting up
1175 1176
   //#define SDCARD_READONLY                 // Read-only SD card (to save over 2K of flash)
1176 1177
 
1177 1178
   #define SD_PROCEDURE_DEPTH 1              // Increase if you need more nested M32 calls

+ 13
- 6
Marlin/src/inc/SanityCheck.h View File

@@ -582,6 +582,11 @@
582 582
 /**
583 583
  * Serial
584 584
  */
585
+#ifndef SERIAL_PORT
586
+  #error "SERIAL_PORT must be defined in Configuration.h"
587
+#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
588
+  #error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
589
+#endif
585 590
 #if !(defined(__AVR__) && defined(USBCON))
586 591
   #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
587 592
     #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
@@ -594,12 +599,6 @@
594 599
   #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
595 600
 #endif
596 601
 
597
-#ifndef SERIAL_PORT
598
-  #error "SERIAL_PORT must be defined in Configuration.h"
599
-#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
600
-  #error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
601
-#endif
602
-
603 602
 /**
604 603
  * Multiple Stepper Drivers Per Axis
605 604
  */
@@ -2194,6 +2193,14 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2194 2193
   #endif
2195 2194
 #endif
2196 2195
 
2196
+#if ENABLED(SD_IGNORE_AT_STARTUP)
2197
+  #if ENABLED(POWER_LOSS_RECOVERY)
2198
+    #error "SD_IGNORE_AT_STARTUP is incompatible with POWER_LOSS_RECOVERY."
2199
+  #elif ENABLED(SDCARD_EEPROM_EMULATION)
2200
+    #error "SD_IGNORE_AT_STARTUP is incompatible with SDCARD_EEPROM_EMULATION."
2201
+  #endif
2202
+#endif
2203
+
2197 2204
 /**
2198 2205
  * Make sure only one display is enabled
2199 2206
  */

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

@@ -425,7 +425,8 @@ void CardReader::manage_media() {
425 425
 
426 426
     if (stat) {                       // Media Inserted
427 427
       safe_delay(500);                // Some boards need a delay to get settled
428
-      mount();                        // Try to mount the media
428
+      if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2))
429
+        mount();                      // Try to mount the media
429 430
       #if MB(FYSETC_CHEETAH, FYSETC_CHEETAH_V12, FYSETC_AIO_II)
430 431
         reset_stepper_drivers();      // Workaround for Cheetah bug
431 432
       #endif

Loading…
Cancel
Save