🔧 Improve SD_DETECT_STATE default (#21885)

This commit is contained in:
Scott Lahteine 2021-05-13 01:14:37 -05:00 committed by Scott Lahteine
parent 1d1f318752
commit 159f9c85a6
3 changed files with 22 additions and 15 deletions

View File

@ -330,11 +330,6 @@
*/
#if ENABLED(SDSUPPORT)
// Extender cable doesn't support SD_DETECT_PIN
#if ENABLED(NO_SD_DETECT)
#undef SD_DETECT_PIN
#endif
#if HAS_SD_HOST_DRIVE && SD_CONNECTION_IS(ONBOARD)
//
// The external SD card is not used. Hardware SPI is used to access the card.
@ -345,18 +340,20 @@
#define HAS_SHARED_MEDIA 1
#endif
#if PIN_EXISTS(SD_DETECT)
#if HAS_LCD_MENU && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
#undef SD_DETECT_STATE
#if ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define SD_DETECT_STATE HIGH
#endif
#endif
#ifndef SD_DETECT_STATE
// Set SD_DETECT_STATE based on hardware if not overridden
#if PIN_EXISTS(SD_DETECT) && !defined(SD_DETECT_STATE)
#if BOTH(HAS_LCD_MENU, ELB_FULL_GRAPHIC_CONTROLLER) && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
#define SD_DETECT_STATE HIGH
#else
#define SD_DETECT_STATE LOW
#endif
#endif
// Extender cable doesn't support SD_DETECT_PIN
#if ENABLED(NO_SD_DETECT)
#undef SD_DETECT_PIN
#endif
#if DISABLED(USB_FLASH_DRIVE_SUPPORT) || BOTH(MULTI_VOLUME, VOLUME_SD_ONBOARD)
#if ENABLED(SDIO_SUPPORT)
#define NEED_SD2CARD_SDIO 1

View File

@ -760,6 +760,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "LIGHTWEIGHT_UI requires a U8GLIB_ST7920-based display."
#endif
/**
* SD Card Settings
*/
#if ALL(SDSUPPORT, ELB_FULL_GRAPHIC_CONTROLLER, HAS_LCD_MENU) && PIN_EXISTS(SD_DETECT) && SD_DETECT_STATE != HIGH && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
#error "SD_DETECT_STATE must be set HIGH for SD on the ELB_FULL_GRAPHIC_CONTROLLER."
#endif
/**
* SD File Sorting
*/

View File

@ -352,8 +352,11 @@
//
#if SD_CONNECTION_IS(ONBOARD)
#define SDIO_SUPPORT // Use SDIO for onboard SD
#undef SD_DETECT_STATE
#define SD_DETECT_STATE HIGH
#ifndef SD_DETECT_STATE
#define SD_DETECT_STATE HIGH
#elif SD_DETECT_STATE == LOW
#error "BOARD_BTT_OCTOPUS_V1_0 onboard SD requires SD_DETECT_STATE set to HIGH."
#endif
#define SD_DETECT_PIN PC14
#elif SD_CONNECTION_IS(LCD)