From 5955a3063f2b0ea9aea617320e65c1ecee3fd3dd Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Fri, 25 Mar 2016 19:05:31 -0700
Subject: [PATCH] Sanity check PIDTEMPBED plus BED_LIMIT_SWITCHING

---
 Marlin/SanityCheck.h                                | 8 +++++++-
 Marlin/example_configurations/SCARA/Configuration.h | 2 +-
 Marlin/temperature.cpp                              | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h
index 16df8fbbfb0..728320c31aa 100644
--- a/Marlin/SanityCheck.h
+++ b/Marlin/SanityCheck.h
@@ -131,10 +131,16 @@
   #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN  or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller.
 #endif
 
+/**
+ * Bed Heating Options - PID vs Limit Switching
+ */
+#if ENABLED(PIDTEMPBED) && ENABLED(BED_LIMIT_SWITCHING)
+  #error To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED.
+#endif
+
 /**
  * Mesh Bed Leveling
  */
-
 #if ENABLED(MESH_BED_LEVELING)
   #if ENABLED(DELTA)
     #error MESH_BED_LEVELING does not yet support DELTA printers.
diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h
index d3826099f9e..617297b7a32 100644
--- a/Marlin/example_configurations/SCARA/Configuration.h
+++ b/Marlin/example_configurations/SCARA/Configuration.h
@@ -286,7 +286,7 @@
 // If this is enabled, find your own PID constants below.
 #define PIDTEMPBED
 
-#define BED_LIMIT_SWITCHING
+//#define BED_LIMIT_SWITCHING
 
 // This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
 // all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index 99909204db3..05e523882de 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -745,7 +745,7 @@ void manage_heater() {
         soft_pwm_bed = 0;
         WRITE_HEATER_BED(LOW);
       }
-    #else // BED_LIMIT_SWITCHING
+    #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
       // Check if temperature is within the correct range
       if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) {
         soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;