Browse Source

SD_DETECT_INVERTED => SD_DETECT_STATE (#17112)

Scott Lahteine 4 years ago
parent
commit
8f66dbfcd5
No account linked to committer's email address

+ 3
- 6
Marlin/Configuration_adv.h View File

@@ -1018,12 +1018,9 @@
1018 1018
 
1019 1019
 #if ENABLED(SDSUPPORT)
1020 1020
 
1021
-  // Some RAMPS and other boards don't detect when an SD card is inserted. You can work
1022
-  // around this by connecting a push button or single throw switch to the pin defined
1023
-  // as SD_DETECT_PIN in your board's pins definitions.
1024
-  // This setting should be disabled unless you are using a push button, pulling the pin to ground.
1025
-  // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER).
1026
-  #define SD_DETECT_INVERTED
1021
+  // The standard SD detect circuit reads LOW when media is inserted and HIGH when empty.
1022
+  // Enable this option and set to HIGH if your SD cards are incorrectly detected.
1023
+  //#define SD_DETECT_STATE HIGH
1027 1024
 
1028 1025
   #define SD_FINISHED_STEPPERRELEASE true          // Disable steppers when SD Print is finished
1029 1026
   #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place.

+ 0
- 1
Marlin/src/inc/Conditionals_LCD.h View File

@@ -74,7 +74,6 @@
74 74
     #define U8GLIB_ST7565_64128N
75 75
   #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
76 76
     #define U8GLIB_LM6059_AF
77
-    #define SD_DETECT_INVERTED
78 77
   #elif ENABLED(AZSMZ_12864)
79 78
     #define U8GLIB_ST7565_64128N
80 79
   #endif

+ 11
- 3
Marlin/src/inc/Conditionals_post.h View File

@@ -292,10 +292,18 @@
292 292
 #endif
293 293
 
294 294
 /**
295
- * Override here because this is set in Configuration_adv.h
295
+ * Override the SD_DETECT_STATE set in Configuration_adv.h
296 296
  */
297
-#if HAS_LCD_MENU && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
298
-  #undef SD_DETECT_INVERTED
297
+#if ENABLED(SDSUPPORT)
298
+  #if HAS_LCD_MENU && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION))
299
+    #undef SD_DETECT_STATE
300
+    #if ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
301
+      #define SD_DETECT_STATE HIGH
302
+    #endif
303
+  #endif
304
+  #ifndef SD_DETECT_STATE
305
+    #define SD_DETECT_STATE LOW
306
+  #endif
299 307
 #endif
300 308
 
301 309
 /**

+ 3
- 1
Marlin/src/inc/SanityCheck.h View File

@@ -99,7 +99,9 @@
99 99
 #elif defined(X_HOME_RETRACT_MM)
100 100
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
101 101
 #elif defined(SDCARDDETECTINVERTED)
102
-  #error "SDCARDDETECTINVERTED is now SD_DETECT_INVERTED. Please update your configuration."
102
+  #error "SDCARDDETECTINVERTED is now SD_DETECT_STATE (HIGH). Please update your configuration."
103
+#elif defined(SD_DETECT_INVERTED)
104
+  #error "SD_DETECT_INVERTED is now SD_DETECT_STATE (HIGH). Please update your configuration."
103 105
 #elif defined(BTENABLED)
104 106
   #error "BTENABLED is now BLUETOOTH. Please update your configuration."
105 107
 #elif defined(CUSTOM_MENDEL_NAME)

+ 0
- 4
Marlin/src/pins/ramps/pins_FYSETC_F6_13.h View File

@@ -29,10 +29,6 @@
29 29
   #error "Oops! Select 'FYSETC F6' in 'Tools > Board.'"
30 30
 #endif
31 31
 
32
-#if ENABLED(SD_DETECT_INVERTED)
33
-  //#error "SD_DETECT_INVERTED must be disabled for the FYSETC_F6_13 board."
34
-#endif
35
-
36 32
 #ifndef BOARD_INFO_NAME
37 33
   #define BOARD_INFO_NAME "FYSETC F6 1.3"
38 34
 #endif

+ 1
- 1
Marlin/src/sd/cardreader.h View File

@@ -276,7 +276,7 @@ private:
276 276
 #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
277 277
   #define IS_SD_INSERTED() Sd2Card::isInserted()
278 278
 #elif PIN_EXISTS(SD_DETECT)
279
-  #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) != ENABLED(SD_DETECT_INVERTED))
279
+  #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == SD_DETECT_STATE)
280 280
 #else
281 281
   // No card detect line? Assume the card is inserted.
282 282
   #define IS_SD_INSERTED() true

Loading…
Cancel
Save