From bc205c76a387a6e2de4d37d790bde8320edc441a Mon Sep 17 00:00:00 2001
From: Ed Boston <edward.boston@gmail.com>
Date: Fri, 22 May 2015 16:28:10 -0700
Subject: [PATCH 1/4] SDCARDDETECTINVERTED problems

Fixed an error where SDCARDDETECTINVERTED was being defined/undefined
improperly
---
 Marlin/Conditionals.h      | 2 +-
 Marlin/Configuration_adv.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h
index 36974d012c..3946d224e2 100644
--- a/Marlin/Conditionals.h
+++ b/Marlin/Conditionals.h
@@ -322,7 +322,7 @@
     #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
   #endif
 
-  #ifdef ULTIPANEL
+  #if defined(ULTIPANEL) && !defined(ELB_FULL_GRAPHIC_CONTROLLER)
     #undef SDCARDDETECTINVERTED
   #endif
 
diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 8a05298d59..ad47ad68de 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -289,7 +289,9 @@
   // 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
+  #ifndef ELB_FULL_GRAPHIC_CONTROLLER
+    #define SDCARDDETECTINVERTED
+  #endif
 
   #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
   #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.

From b94a0e15013ce8401a20ab87ff76692748dd96fb Mon Sep 17 00:00:00 2001
From: Ed Boston <edward.boston@gmail.com>
Date: Fri, 29 May 2015 15:02:20 -0700
Subject: [PATCH 2/4] Added ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED

The new define allows the sd card detect to be inverted or not from
Configuration.h
---
 Marlin/Conditionals.h  | 4 +++-
 Marlin/Configuration.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h
index 3946d224e2..7ac6b0706f 100644
--- a/Marlin/Conditionals.h
+++ b/Marlin/Conditionals.h
@@ -33,7 +33,9 @@
       #define DEFAULT_LCD_CONTRAST 40
     #elif defined(ELB_FULL_GRAPHIC_CONTROLLER)
       #define DEFAULT_LCD_CONTRAST 110
-      #define SDCARDDETECTINVERTED
+      #ifdef ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
+        #define SDCARDDETECTINVERTED
+      #endif
       #define SDSLOW
       #define U8GLIB_LM6059_AF
     #endif
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 430f134bb5..337a5bb5d4 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -670,6 +670,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller

From fed18bcc203fa0f9ec02c74cd07029f85e50d65d Mon Sep 17 00:00:00 2001
From: Ed Boston <edward.boston@gmail.com>
Date: Wed, 3 Jun 2015 21:14:49 -0700
Subject: [PATCH 3/4] Removed SDSLOW for ELB_FULL_GRAPHIC_CONTROLLER

Hardware changes has removed the need for this option.
---
 Marlin/Conditionals.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h
index 7ac6b0706f..c5426db81f 100644
--- a/Marlin/Conditionals.h
+++ b/Marlin/Conditionals.h
@@ -36,7 +36,6 @@
       #ifdef ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
         #define SDCARDDETECTINVERTED
       #endif
-      #define SDSLOW
       #define U8GLIB_LM6059_AF
     #endif
 

From 08968c29bba09e5215feadfc85cfa724ceb0fc22 Mon Sep 17 00:00:00 2001
From: Ed Boston <edward.boston@gmail.com>
Date: Wed, 3 Jun 2015 21:23:15 -0700
Subject: [PATCH 4/4] Adding ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 to Examples

---
 Marlin/example_configurations/Felix/Configuration.h         | 1 +
 Marlin/example_configurations/Felix/Configuration_DUAL.h    | 6 ++++++
 Marlin/example_configurations/Hephestos/Configuration.h     | 1 +
 Marlin/example_configurations/K8200/Configuration.h         | 1 +
 .../RepRapWorld/Megatronics/Configuration.h                 | 1 +
 Marlin/example_configurations/SCARA/Configuration.h         | 1 +
 Marlin/example_configurations/WITBOX/Configuration.h        | 1 +
 Marlin/example_configurations/delta/biv2.5/Configuration.h  | 1 +
 Marlin/example_configurations/delta/generic/Configuration.h | 1 +
 .../delta/kossel_mini/Configuration.h                       | 1 +
 Marlin/example_configurations/makibox/Configuration.h       | 1 +
 Marlin/example_configurations/tvrrug/Round2/Configuration.h | 1 +
 12 files changed, 17 insertions(+)

diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h
index 7ed203ccc2..16a76f23be 100644
--- a/Marlin/example_configurations/Felix/Configuration.h
+++ b/Marlin/example_configurations/Felix/Configuration.h
@@ -610,6 +610,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h
index 6f91f8c8b7..6c222f34ef 100644
--- a/Marlin/example_configurations/Felix/Configuration_DUAL.h
+++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h
@@ -600,6 +600,12 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //#define VIKI2
 //#define miniVIKI
 
+// This is a new controller currently under development.  https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/
+//
+// ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
+//#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
+
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
 //#define REPRAP_DISCOUNT_SMART_CONTROLLER
diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h
index 489e956ea9..d34cbd3754 100644
--- a/Marlin/example_configurations/Hephestos/Configuration.h
+++ b/Marlin/example_configurations/Hephestos/Configuration.h
@@ -633,6 +633,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h
index 3cbb0f8751..13ca5804cc 100644
--- a/Marlin/example_configurations/K8200/Configuration.h
+++ b/Marlin/example_configurations/K8200/Configuration.h
@@ -688,6 +688,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
index 94efff07b3..aaba859e36 100644
--- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
+++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
@@ -671,6 +671,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h
index fbdc5f5efa..4084c3d755 100644
--- a/Marlin/example_configurations/SCARA/Configuration.h
+++ b/Marlin/example_configurations/SCARA/Configuration.h
@@ -668,6 +668,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h
index c74683d174..43ea45e19b 100644
--- a/Marlin/example_configurations/WITBOX/Configuration.h
+++ b/Marlin/example_configurations/WITBOX/Configuration.h
@@ -632,6 +632,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h
index afd6c3e705..5b3159397a 100644
--- a/Marlin/example_configurations/delta/biv2.5/Configuration.h
+++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h
@@ -675,6 +675,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h
index 913b02e8ab..04998d92a5 100644
--- a/Marlin/example_configurations/delta/generic/Configuration.h
+++ b/Marlin/example_configurations/delta/generic/Configuration.h
@@ -678,6 +678,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
index 4c3c6ab1a7..1c5ce8c02f 100644
--- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h
+++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
@@ -682,6 +682,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h
index 6a9cfb23c9..2348d2ca88 100644
--- a/Marlin/example_configurations/makibox/Configuration.h
+++ b/Marlin/example_configurations/makibox/Configuration.h
@@ -630,6 +630,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
index 82f51bd5c1..205a9d5e11 100644
--- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h
+++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
@@ -636,6 +636,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
 //
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
 //#define ELB_FULL_GRAPHIC_CONTROLLER
+//#define ELB_FULL_GRAPHIC_CONTROLLER_SDCARDDETECTINVERTED
 
 // The RepRapDiscount Smart Controller (white PCB)
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller