Try to init SD with no detect pin

This commit is contained in:
Scott Lahteine 2019-06-15 15:32:09 -05:00
parent 9a56a88200
commit eb1c9113c2
2 changed files with 19 additions and 13 deletions

View File

@ -937,7 +937,7 @@ void setup() {
ui.show_bootscreen();
#endif
#if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
#if ENABLED(SDIO_SUPPORT) && !PIN_EXISTS(SD_DETECT)
// Auto-mount the SD for EEPROM.dat emulation
if (!card.isDetected()) card.initsd();
#endif

View File

@ -104,7 +104,7 @@
#endif
#endif
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
#if ENABLED(SDSUPPORT)
uint8_t lcd_sd_status;
#endif
@ -315,8 +315,10 @@ void MarlinUI::init() {
#endif // HAS_SHIFT_ENCODER
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
#if ENABLED(SDSUPPORT)
#if PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
lcd_sd_status = 2; // UNKNOWN
#endif
@ -766,7 +768,7 @@ void MarlinUI::update() {
#endif // HAS_LCD_MENU
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
#if ENABLED(SDSUPPORT)
const uint8_t sd_status = (uint8_t)IS_SD_INSERTED();
if (sd_status != lcd_sd_status && detected()) {
@ -782,6 +784,7 @@ void MarlinUI::update() {
else
set_status_P(PSTR(MSG_SD_INSERTED));
}
#if PIN_EXISTS(SD_DETECT)
else {
card.release();
if (old_sd_status != 2) {
@ -790,9 +793,12 @@ void MarlinUI::update() {
}
}
refresh();
init_lcd(); // May revive the LCD if static electricity killed it
#endif
refresh();
ms = millis();
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // delay LCD update until after SD activity completes
@ -801,7 +807,7 @@ void MarlinUI::update() {
#endif
}
#endif // SDSUPPORT && SD_DETECT_PIN
#endif // SDSUPPORT
if (ELAPSED(ms, next_lcd_update_ms)
#if HAS_GRAPHICAL_LCD