Browse Source

Option to ignore SD at startup (#20099)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
Hebezo 4 years ago
committed by Scott Lahteine
parent
commit
012745b218
  1. 1
      Marlin/Configuration_adv.h
  2. 19
      Marlin/src/inc/SanityCheck.h
  3. 3
      Marlin/src/sd/cardreader.cpp

1
Marlin/Configuration_adv.h

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

19
Marlin/src/inc/SanityCheck.h

@ -582,6 +582,11 @@
/** /**
* Serial * Serial
*/ */
#ifndef SERIAL_PORT
#error "SERIAL_PORT must be defined in Configuration.h"
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
#endif
#if !(defined(__AVR__) && defined(USBCON)) #if !(defined(__AVR__) && defined(USBCON))
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
#error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops." #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
@ -594,12 +599,6 @@
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices." #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
#endif #endif
#ifndef SERIAL_PORT
#error "SERIAL_PORT must be defined in Configuration.h"
#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
#endif
/** /**
* Multiple Stepper Drivers Per Axis * Multiple Stepper Drivers Per Axis
*/ */
@ -2194,6 +2193,14 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#endif #endif
#endif #endif
#if ENABLED(SD_IGNORE_AT_STARTUP)
#if ENABLED(POWER_LOSS_RECOVERY)
#error "SD_IGNORE_AT_STARTUP is incompatible with POWER_LOSS_RECOVERY."
#elif ENABLED(SDCARD_EEPROM_EMULATION)
#error "SD_IGNORE_AT_STARTUP is incompatible with SDCARD_EEPROM_EMULATION."
#endif
#endif
/** /**
* Make sure only one display is enabled * Make sure only one display is enabled
*/ */

3
Marlin/src/sd/cardreader.cpp

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

Loading…
Cancel
Save