From 69c333ead99cbed5219536b7712411bf889273bf Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Thu, 18 Apr 2019 21:09:21 -0500
Subject: [PATCH] More universal Formbot pins

Replace `ROXYs_TRex` with pre-defines of the relevant pins at the configuration level.
---
 Marlin/src/pins/pins_FORMBOT_RAPTOR.h         | 12 +++++-----
 Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h      | 23 +++++++++++--------
 Marlin/src/pins/pins_FORMBOT_TREX3.h          |  6 +++--
 Marlin/src/pins/pins_GEN7_13.h                |  2 +-
 .../examples/Formbot/T_Rex_2+/Configuration.h |  6 +++++
 .../examples/Formbot/T_Rex_3/Configuration.h  |  6 +++++
 6 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
index 5944be04afc..10a517aec4f 100644
--- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
+++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
@@ -181,16 +181,16 @@
 // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER
 //
 #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
-  #define LCD_PINS_RS      16
-  #define LCD_PINS_ENABLE  17
-  #define LCD_PINS_D4      23
-  #define LCD_PINS_D5      25
-  #define LCD_PINS_D6      27
-  #define LCD_PINS_D7      29
   #define BEEPER_PIN       37
   #define BTN_EN1          31
   #define BTN_EN2          33
   #define BTN_ENC          35
   #define SD_DETECT_PIN    49
   #define KILL_PIN         41
+  #define LCD_PINS_RS      16
+  #define LCD_PINS_ENABLE  17
+  #define LCD_PINS_D4      23
+  #define LCD_PINS_D5      25
+  #define LCD_PINS_D6      27
+  #define LCD_PINS_D7      29
 #endif
diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h
index 5970123e1f4..16649e42b50 100644
--- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h
+++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h
@@ -155,9 +155,8 @@
 //
 // Misc. Functions
 //
-#define CASE_LIGHT_PIN      8
 #define SDSS               53
-#ifndef ROXYs_TRex
+#ifndef LED_PIN
   #define LED_PIN          13   // The Formbot v 1 board has almost no unassigned pins on it.  The Board's LED
 #endif                          // is a good place to get a signal to control the Max7219 LED Matrix.
 
@@ -168,24 +167,28 @@
   #define PS_ON_PIN        12
 #endif
 
+#define CASE_LIGHT_PIN      8
+
 //
 // LCD / Controller
 //
 // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER
 //
 #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
+  #ifndef BEEPER_PIN
+    #define BEEPER_PIN     37
+  #endif
+  #define BTN_EN1          31
+  #define BTN_EN2          33
+  #define BTN_ENC          35
+  #define SD_DETECT_PIN    49
+  #ifndef KILL_PIN
+    #define KILL_PIN       41
+  #endif
   #define LCD_PINS_RS      16
   #define LCD_PINS_ENABLE  17
   #define LCD_PINS_D4      23
   #define LCD_PINS_D5      25
   #define LCD_PINS_D6      27
   #define LCD_PINS_D7      29
-  #define BTN_EN1          31
-  #define BTN_EN2          33
-  #define BTN_ENC          35
-  #define SD_DETECT_PIN    49
-  #ifndef ROXYs_TRex
-    #define KILL_PIN       41
-    #define BEEPER_PIN     37
-  #endif
 #endif
diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h
index 5b4bd8b533b..8ff09f47c5b 100644
--- a/Marlin/src/pins/pins_FORMBOT_TREX3.h
+++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h
@@ -139,7 +139,7 @@
 //
 #define CASE_LIGHT_PIN      5
 #define SDSS               53
-#ifndef ROXYs_TRex
+#ifndef LED_PIN
   #define LED_PIN          13
 #endif
 
@@ -165,8 +165,10 @@
   #define BTN_EN2          33
   #define BTN_ENC          35
   #define SD_DETECT_PIN    49
-  #ifndef ROXYs_TRex
+  #ifndef KILL_PIN
     #define KILL_PIN       41
+  #endif
+  #ifndef BEEPER_PIN
     #define BEEPER_PIN     37
   #endif
 #endif
diff --git a/Marlin/src/pins/pins_GEN7_13.h b/Marlin/src/pins/pins_GEN7_13.h
index 60c62bdc714..9b1f0d242ed 100644
--- a/Marlin/src/pins/pins_GEN7_13.h
+++ b/Marlin/src/pins/pins_GEN7_13.h
@@ -24,7 +24,7 @@
  * Gen7 v1.3 pin assignments
  */
 
- /**
+/**
  * Rev B    26 DEC 2016
  *
  * added pointer to a current Arduino IDE extension
diff --git a/config/examples/Formbot/T_Rex_2+/Configuration.h b/config/examples/Formbot/T_Rex_2+/Configuration.h
index 82d24eb43f0..767cebf77c6 100644
--- a/config/examples/Formbot/T_Rex_2+/Configuration.h
+++ b/config/examples/Formbot/T_Rex_2+/Configuration.h
@@ -2159,3 +2159,9 @@
 
 // Allow servo angle to be edited and saved to EEPROM
 //#define EDITABLE_SERVO_ANGLES
+
+#ifdef ROXYs_TRex
+  #define LED_PIN     -1
+  #define BEEPER_PIN  -1
+  #define KILL_PIN    -1
+#endif
diff --git a/config/examples/Formbot/T_Rex_3/Configuration.h b/config/examples/Formbot/T_Rex_3/Configuration.h
index 992d2c0e173..339e0ee8f37 100644
--- a/config/examples/Formbot/T_Rex_3/Configuration.h
+++ b/config/examples/Formbot/T_Rex_3/Configuration.h
@@ -2152,3 +2152,9 @@
 
 // Allow servo angle to be edited and saved to EEPROM
 //#define EDITABLE_SERVO_ANGLES
+
+#ifdef ROXYs_TRex
+  #define LED_PIN     -1
+  #define BEEPER_PIN  -1
+  #define KILL_PIN    -1
+#endif