Skip to content

Commit

Permalink
Sanity-check user SD_DETECT_STATE
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 13, 2021
1 parent 75f76cb commit 87a1e02
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 0 additions & 12 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,6 @@
#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
#define SD_DETECT_STATE LOW
#endif
#endif

#if DISABLED(USB_FLASH_DRIVE_SUPPORT) || BOTH(MULTI_VOLUME, VOLUME_SD_ONBOARD)
#if ENABLED(SDIO_SUPPORT)
#define NEED_SD2CARD_SDIO 1
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,17 @@ 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 ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
#ifndef SD_DETECT_STATE
#error "SD_DETECT_STATE is a required setting with SD_DETECT_PIN."
#elif SD_DETECT_STATE != HIGH && BOTH(ELB_FULL_GRAPHIC_CONTROLLER, HAS_LCD_MENU) && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
#error "SD_DETECT_STATE must be set HIGH for SD on the ELB_FULL_GRAPHIC_CONTROLLER."
#endif
#endif

/**
* SD File Sorting
*/
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,9 @@
//
#if SD_CONNECTION_IS(ONBOARD)
#define SDIO_SUPPORT // Use SDIO for onboard SD
#undef SD_DETECT_STATE
#define SD_DETECT_STATE HIGH
#if SD_DETECT_STATE != HIGH
#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)

Expand Down

0 comments on commit 87a1e02

Please sign in to comment.