Browse Source

Merge pull request #433 from whosawhatsis/bang-mode

Separate PID_MAX from BANG_MAX
ErikZalm 11 years ago
parent
commit
9fb8bd5685
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

118
 // PID settings:
118
 // PID settings:
119
 // Comment the following line to disable PID and enable bang-bang.
119
 // Comment the following line to disable PID and enable bang-bang.
120
 #define PIDTEMP
120
 #define PIDTEMP
121
-#define PID_MAX 256 // limits current to nozzle; 256=full current
121
+#define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
122
+#define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
122
 #ifdef PIDTEMP
123
 #ifdef PIDTEMP
123
   //#define PID_DEBUG // Sends debug data to the serial port. 
124
   //#define PID_DEBUG // Sends debug data to the serial port. 
124
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
125
   //#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
     #ifndef PID_OPENLOOP
325
     #ifndef PID_OPENLOOP
326
         pid_error[e] = target_temperature[e] - pid_input;
326
         pid_error[e] = target_temperature[e] - pid_input;
327
         if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
327
         if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
328
-          pid_output = PID_MAX;
328
+          pid_output = BANG_MAX;
329
           pid_reset[e] = true;
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
           pid_output = 0;
332
           pid_output = 0;
333
           pid_reset[e] = true;
333
           pid_reset[e] = true;
334
         }
334
         }

Loading…
Cancel
Save