From a05a261b723d3004446bea6641eab182715cfe3a Mon Sep 17 00:00:00 2001 From: Blair Thompson Date: Sat, 18 Feb 2012 23:56:31 +0000 Subject: [PATCH] Added a workaround. Ramps SD card does not have sdcarddetect. My temporary solution is to add a momentary swtich that pulls down the SDCARDDETECT pin and mimicking the pull and reinsert ofa a SD card --- Marlin/Configuration.h | 7 +++++++ Marlin/pins.h | 8 ++++---- Marlin/ultralcd.h | 11 +++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fa12c0082..4497ec7cd 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -179,6 +179,13 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t //#define ULTRA_LCD //general lcd support, also 16x2 #define SDSUPPORT // Enable SD Card Support in Hardware Console +// Invert the SD card Detect Pin. +// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted +// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT +// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should +// be commented out otherwise +#define SDCARDDETECTINVERTED + #define ULTIPANEL #ifdef ULTIPANEL #define NEWPANEL //enable this if you have a click-encoder panel diff --git a/Marlin/pins.h b/Marlin/pins.h index a366a679a..ec6eef66b 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -281,8 +281,8 @@ #ifdef ULTRA_LCD #ifdef NEWPANEL - //arduino pin witch triggers an piezzo beeper - #define BEEPER -1 // No Beeper added + //arduino pin which triggers an piezzo beeper + #define BEEPER 33 // Beeper on AUX-4 #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 @@ -300,7 +300,7 @@ #define BLEN_B 1 #define BLEN_A 0 - #define SDCARDDETECT -1 // Ramps does not use this port + #define SDCARDDETECT 31 // Ramps does not use this port //encoder rotation values #define encrot0 0 @@ -310,7 +310,7 @@ #else //old style panel with shift register //arduino pin witch triggers an piezzo beeper - #define BEEPER -1 No Beeper added + #define BEEPER 33 No Beeper added //buttons are attached to a shift register // Not wired this yet diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 08ac950d3..25abb427c 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -27,8 +27,15 @@ #define CLICKED (buttons&EN_C) #define BLOCK {blocking=millis()+blocktime;} - #define CARDINSERTED (READ(SDCARDDETECT)==0) - + + #ifdef SDCARDDETECTINVERTED + #define CARDINSERTED (READ(SDCARDDETECT)!=0) + + #else + #define CARDINSERTED (READ(SDCARDDETECT)==0) + + #endif //SDCARDTETECTINVERTED + #else //atomatic, do not change