Browse Source

Separate PID_MAX from BANG_MAX

This allows PID_FUNCTIONAL_RANGE to use a maximum duty cycle higher
than PID_MAX. This is useful for powerful heaters to heat quickly in
bang-bang mode, but use a lower duty cycle that is easier to stabilize
in PID mode.
whosawhatsis 11 years ago
parent
commit
fd5b7e0cec
2 changed files with 4 additions and 3 deletions
  1. 2
    1
      Marlin/Configuration.h
  2. 2
    2
      Marlin/temperature.cpp

+ 2
- 1
Marlin/Configuration.h View File

@@ -117,7 +117,8 @@
117 117
 // PID settings:
118 118
 // Comment the following line to disable PID and enable bang-bang.
119 119
 #define PIDTEMP
120
-#define PID_MAX 256 // limits current to nozzle; 256=full current
120
+#define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
121
+#define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
121 122
 #ifdef PIDTEMP
122 123
   //#define PID_DEBUG // Sends debug data to the serial port. 
123 124
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX

+ 2
- 2
Marlin/temperature.cpp View File

@@ -325,10 +325,10 @@ void manage_heater()
325 325
     #ifndef PID_OPENLOOP
326 326
         pid_error[e] = target_temperature[e] - pid_input;
327 327
         if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
328
-          pid_output = PID_MAX;
328
+          pid_output = BANG_MAX;
329 329
           pid_reset[e] = true;
330 330
         }
331
-        else if(pid_error[e] < -PID_FUNCTIONAL_RANGE) {
331
+        else if(pid_error[e] < -PID_FUNCTIONAL_RANGE || target_temperature[e] == 0) {
332 332
           pid_output = 0;
333 333
           pid_reset[e] = true;
334 334
         }

Loading…
Cancel
Save