From e86f2342c057cdc624a07a11ed26bb653c790bda Mon Sep 17 00:00:00 2001
From: Jonathan Bastien-Filiatrault <joe@x2a.org>
Date: Thu, 28 May 2015 11:30:56 -0400
Subject: [PATCH] Separate the maximum integral power for the bed from
 PID_INTEGRAL_DRIVE_MAX / PID_MAX.

My PID_INTEGRAL_DRIVE_MAX was at 96, which was insufficient for my bed
to reach its intended temperature. The head requires a low maximum power since
I run on 24 volts and it has a somewhat low thermal mass.
---
 Marlin/Configuration.h | 2 ++
 Marlin/temperature.cpp | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index d9d9aa8b23..32a0a888d2 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -243,6 +243,8 @@ Here are some standard links for getting your machine calibrated:
 //#define PID_BED_DEBUG // Sends debug data to the serial port.
 
 #ifdef PIDTEMPBED
+    #define PID_BED_INTEGRAL_DRIVE_MAX MAX_BED_POWER //limit for the integral term
+
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
 //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
     #define  DEFAULT_bedKp 10.00
diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index 356c0057c6..d55ebffd9f 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -361,7 +361,7 @@ void updatePID() {
     }
   #endif
   #ifdef PIDTEMPBED
-    temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
+    temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi;
   #endif
 }
 
@@ -844,7 +844,7 @@ void tp_init() {
     #endif //PIDTEMP
     #ifdef PIDTEMPBED
       temp_iState_min_bed = 0.0;
-      temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
+      temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi;
     #endif //PIDTEMPBED
   }