Skip to content

Commit

Permalink
Fix broken implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 11, 2020
1 parent cdb8fc4 commit 8b0f037
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
9 changes: 0 additions & 9 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1739,15 +1739,6 @@
*/
//#define SDSUPPORT

/**
* SD CARD: MOUNT ON INSERT
*
* If you do not want to mount the SD Card when it´s inserted to the slot, comment the following line.
*
*/

#define SD_MOUNT_ON_INSERT

/**
* SD CARD: SPI SPEED
*
Expand Down
1 change: 1 addition & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
//#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 SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
Expand Down
15 changes: 9 additions & 6 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@
/**
* 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 ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
#error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
Expand All @@ -594,12 +599,6 @@
#error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
#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
*/
Expand Down Expand Up @@ -2194,6 +2193,10 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#endif
#endif

#if BOTH(SD_IGNORE_AT_STARTUP, POWER_LOSS_RECOVERY)
#error "POWER_LOSS_RECOVERY is incompatible with SD_IGNORE_AT_STARTUP."
#endif

/**
* Make sure only one display is enabled
*/
Expand Down
9 changes: 2 additions & 7 deletions Marlin/src/sd/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,8 @@ void CardReader::manage_media() {

if (stat) { // Media Inserted
safe_delay(500); // Some boards need a delay to get settled
if (ENABLED(SD_MOUNT_ON_INSERT) && old_stat == 2) {
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)
reset_stepper_drivers(); // Workaround for Cheetah bug
#endif
Expand All @@ -443,11 +442,7 @@ void CardReader::manage_media() {

if (stat) {
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
if (
old_stat == 2
&&
ENABLED(SD_MOUNT_ON_INSERT)
) // First mount?
if (DISABLED(SD_IGNORE_AT_STARTUP) && old_stat == 2) // First mount?
DEBUG_ECHOLNPGM("First mount.");
TERN(POWER_LOSS_RECOVERY,
recovery.check(), // Check for PLR file. (If not there it will beginautostart)
Expand Down

0 comments on commit 8b0f037

Please sign in to comment.