From 98e96feee9062d7e52ad5b240091a974faf1e394 Mon Sep 17 00:00:00 2001
From: AnHardt <github@kitelab.de>
Date: Sat, 6 Aug 2016 15:21:23 +0200
Subject: [PATCH 1/8] Repair SPI-pins

SCK_PIN can't be defined as DIO[number] they mus be defined as pure number.
So rebuilding the structure of fastio.h in pins.h.
---
 Marlin/pins.h | 47 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index 3657675db5..c040805b6b 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -456,17 +456,56 @@
 
 #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
 
+/**
+ * Define SPI Pins: SCK, MISO, MOSI, SS
+ */
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
+  #define AVR_SCK_PIN  13
+  #define AVR_MISO_PIN 12
+  #define AVR_MOSI_PIN 11
+  #define AVR_SS_PIN   10
+#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
+  #define AVR_SCK_PIN  7
+  #define AVR_MISO_PIN 6
+  #define AVR_MOSI_PIN 5
+  #define AVR_SS_PIN   4
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+  #define AVR_SCK_PIN  52
+  #define AVR_MISO_PIN 50
+  #define AVR_MOSI_PIN 51
+  #define AVR_SS_PIN   53
+#elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
+  #if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS)
+    // Teensy pin assignments
+    #define AVR_SCK_PIN  21
+    #define AVR_MISO_PIN 23
+    #define AVR_MOSI_PIN 22
+    #define AVR_SS_PIN   20
+  #else
+    // Traditional pin assignments
+    #define AVR_SCK_PIN  9
+    #define AVR_MISO_PIN 11
+    #define AVR_MOSI_PIN 10
+    #define AVR_SS_PIN   8
+  #endif
+#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
+  #define AVR_SCK_PIN  10
+  #define AVR_MISO_PIN 12
+  #define AVR_MOSI_PIN 11
+  #define AVR_SS_PIN   16
+#endif
+
 #ifndef SCK_PIN
-  #define SCK_PIN  SCK
+  #define SCK_PIN  AVR_SCK_PIN
 #endif
 #ifndef MISO_PIN
-  #define MISO_PIN MISO
+  #define MISO_PIN AVR_MISO_PIN
 #endif
 #ifndef MOSI_PIN
-  #define MOSI_PIN MOSI
+  #define MOSI_PIN AVR_MOSI_PIN
 #endif
 #ifndef SS_PIN
-  #define SS_PIN   SS
+  #define SS_PIN   AVR_SS_PIN
 #endif
 
 #endif //__PINS_H

From 020cd32d28223671231cd0b026c9e2979a76e2cb Mon Sep 17 00:00:00 2001
From: AnHardt <github@kitelab.de>
Date: Sat, 6 Aug 2016 15:21:23 +0200
Subject: [PATCH 2/8] Update restore_configs

for travis builds.
---
 buildroot/bin/restore_configs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs
index ba7a72cd89..73240bd438 100755
--- a/buildroot/bin/restore_configs
+++ b/buildroot/bin/restore_configs
@@ -2,7 +2,7 @@
 
 cp Marlin/Configuration.h.backup      Marlin/Configuration.h
 cp Marlin/Configuration_adv.h.backup  Marlin/Configuration_adv.h
-cp Marlin/pins_RAMPS_14.h.backup      Marlin/pins_RAMPS_14.h
+cp Marlin/pins_RAMPS.h.backup         Marlin/pins_RAMPS.h
 
 if [ -f Marlin/_Bootscreen.h ]; then
   rm Marlin/_Bootscreen.h

From 31cad77ba91776e034bbede6e2322101aaf35707 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 6 Aug 2016 17:15:00 -0700
Subject: [PATCH 3/8] Chmod a+x opt_disable_adv

---
 buildroot/bin/opt_disable_adv | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 buildroot/bin/opt_disable_adv

diff --git a/buildroot/bin/opt_disable_adv b/buildroot/bin/opt_disable_adv
old mode 100644
new mode 100755

From 1f239ac9a782ddcd73f80361a57a8b1bb1c5f246 Mon Sep 17 00:00:00 2001
From: AnHardt <github@kitelab.de>
Date: Sat, 6 Aug 2016 15:21:23 +0200
Subject: [PATCH 4/8] Extend travis test to check MAX6675

---
 .travis.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 23d673f4b2..8408ecf40f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -93,6 +93,12 @@ script:
   - opt_enable PIDTEMPBED
   - build_marlin
   #
+  # Test MAX6675
+  #
+  - restore_configs
+  - opt_set TEMP_SENSOR_0 -2
+  - build_marlin
+  #
   # Test a "Fix Mounted" Probe along with Safe Homing
   #
   - restore_configs

From 98392abb78a8e52930d21c7ddd06482748b8c5e4 Mon Sep 17 00:00:00 2001
From: AnHardt <github@kitelab.de>
Date: Sat, 6 Aug 2016 15:21:23 +0200
Subject: [PATCH 5/8] Clean warnings for pins_BQ_ZUM_MEGA_3D.h

---
 Marlin/pins_BQ_ZUM_MEGA_3D.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Marlin/pins_BQ_ZUM_MEGA_3D.h b/Marlin/pins_BQ_ZUM_MEGA_3D.h
index c5509d4e5f..782419b7d2 100644
--- a/Marlin/pins_BQ_ZUM_MEGA_3D.h
+++ b/Marlin/pins_BQ_ZUM_MEGA_3D.h
@@ -56,6 +56,7 @@
 #define DIGIPOTSS_PIN     22
 #define DIGIPOT_CHANNELS  { 4, 5, 3, 0, 1 }
 
+#undef FAN1_PIN
 #define FAN1_PIN          7
 
 #undef PS_ON_PIN             // 12

From 93eafa1785bc16f0f5d2d5d1786da3dabcfdc8e1 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 6 Aug 2016 17:15:34 -0700
Subject: [PATCH 6/8] Use DISABLED to check TEENSY pin option

---
 Marlin/pins_BRAINWAVE_PRO.h | 2 +-
 Marlin/pins_TEENSY2.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Marlin/pins_BRAINWAVE_PRO.h b/Marlin/pins_BRAINWAVE_PRO.h
index cba0d46944..b0d53a0ca9 100644
--- a/Marlin/pins_BRAINWAVE_PRO.h
+++ b/Marlin/pins_BRAINWAVE_PRO.h
@@ -33,7 +33,7 @@
 
 #include "fastio.h"
 
-#ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS  // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical.
+#if DISABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical.
   #error "Uncomment #define AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h for this config"
 #endif
 
diff --git a/Marlin/pins_TEENSY2.h b/Marlin/pins_TEENSY2.h
index f4f7d4c013..bfadf295d5 100644
--- a/Marlin/pins_TEENSY2.h
+++ b/Marlin/pins_TEENSY2.h
@@ -69,7 +69,7 @@
   #error "Oops!  Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu."
 #endif
 
-#ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS  // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical.
+#if DISABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) // use Teensyduino Teensy++2.0 pin assignments instead of Marlin alphabetical.
   #error "Uncomment #define AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h for this config"
   // (or build from command line)
 #endif

From 98437bd48884574039d25acb707bcff569c979a9 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 6 Aug 2016 17:16:16 -0700
Subject: [PATCH 7/8] Allow override of CONTROLLERFAN_PIN with RAMPS EFF

---
 Marlin/pins.h       | 3 +++
 Marlin/pins_RAMPS.h | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Marlin/pins.h b/Marlin/pins.h
index c040805b6b..bc1ede37fa 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -214,6 +214,9 @@
 #ifndef FAN2_PIN
   #define FAN2_PIN -1
 #endif
+#ifndef CONTROLLERFAN_PIN
+  #define CONTROLLERFAN_PIN  -1
+#endif
 
 #ifndef HEATER_0_PIN
   #define HEATER_0_PIN -1
diff --git a/Marlin/pins_RAMPS.h b/Marlin/pins_RAMPS.h
index 5f2e0d1194..7e2acc21ec 100644
--- a/Marlin/pins_RAMPS.h
+++ b/Marlin/pins_RAMPS.h
@@ -159,7 +159,6 @@
 #elif ENABLED(IS_RAMPS_EFF)                    // Hotend, Fan, Fan
   #define FAN_PIN        RAMPS_D9_PIN
   #define FAN1_PIN       RAMPS_D8_PIN
-  #define CONTROLLERFAN_PIN  -1
 #elif ENABLED(IS_RAMPS_SF)                     // Spindle, Fan
   #define FAN_PIN        RAMPS_D8_PIN
 #else                                          // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")

From 0ff5005c9b96e930c007e03d3e21f8aa05c8826c Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 6 Aug 2016 17:17:09 -0700
Subject: [PATCH 8/8] Allow connector flexibility for BQ ZUM Mega

---
 Marlin/pins_BQ_ZUM_MEGA_3D.h | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/Marlin/pins_BQ_ZUM_MEGA_3D.h b/Marlin/pins_BQ_ZUM_MEGA_3D.h
index 782419b7d2..51b30e6dd3 100644
--- a/Marlin/pins_BQ_ZUM_MEGA_3D.h
+++ b/Marlin/pins_BQ_ZUM_MEGA_3D.h
@@ -30,6 +30,11 @@
 
 #define BOARD_NAME "ZUM Mega 3D"
 
+#define RAMPS_D8_PIN  10
+#define RAMPS_D9_PIN  12
+#define RAMPS_D10_PIN  9
+#define MOSFET_D_PIN   7
+
 #include "pins_RAMPS_13.h"
 
 #undef X_MAX_PIN
@@ -38,15 +43,6 @@
 #undef Z_ENABLE_PIN
 #define Z_ENABLE_PIN      77 // 62
 
-#undef FAN_PIN
-#define FAN_PIN           12 //  4
-
-#undef HEATER_0_PIN
-#define HEATER_0_PIN       9 // 10
-
-#undef HEATER_1_PIN
-#define HEATER_1_PIN      10 //  9
-
 #undef TEMP_1_PIN
 #define TEMP_1_PIN        14 // 15
 
@@ -56,9 +52,6 @@
 #define DIGIPOTSS_PIN     22
 #define DIGIPOT_CHANNELS  { 4, 5, 3, 0, 1 }
 
-#undef FAN1_PIN
-#define FAN1_PIN          7
-
 #undef PS_ON_PIN             // 12
 #define PS_ON_PIN         81 // External Power Supply