Added Parameter for enabling/disabling of SD mount

This commit is contained in:
Stefan Altheimer 2020-11-11 00:05:55 +01:00
parent 1be01b04dc
commit cdb8fc41a9
2 changed files with 17 additions and 2 deletions

View file

@ -1739,6 +1739,15 @@
*/
//#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
*

View file

@ -425,7 +425,9 @@ 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) {
mount(); // Try to mount the media
}
#if MB(FYSETC_CHEETAH, FYSETC_CHEETAH_V12, FYSETC_AIO_II)
reset_stepper_drivers(); // Workaround for Cheetah bug
#endif
@ -441,7 +443,11 @@ void CardReader::manage_media() {
if (stat) {
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
if (old_stat == 2) // First mount?
if (
old_stat == 2
&&
ENABLED(SD_MOUNT_ON_INSERT)
) // First mount?
DEBUG_ECHOLNPGM("First mount.");
TERN(POWER_LOSS_RECOVERY,
recovery.check(), // Check for PLR file. (If not there it will beginautostart)