Browse Source

Merge pull request #4983 from MarlinFirmware/revert-4933-rc_drop_pid_func_range

Revert "Removal of PID functional range"
Scott Lahteine 8 years ago
parent
commit
b6221df3f3
24 changed files with 83 additions and 27 deletions
  1. 3
    1
      Marlin/Configuration.h
  2. 3
    1
      Marlin/example_configurations/Cartesio/Configuration.h
  3. 3
    1
      Marlin/example_configurations/Felix/Configuration.h
  4. 3
    1
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  5. 3
    1
      Marlin/example_configurations/Hephestos/Configuration.h
  6. 3
    1
      Marlin/example_configurations/Hephestos_2/Configuration.h
  7. 3
    1
      Marlin/example_configurations/K8200/Configuration.h
  8. 3
    1
      Marlin/example_configurations/K8400/Configuration.h
  9. 3
    1
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  10. 3
    1
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  11. 3
    1
      Marlin/example_configurations/RigidBot/Configuration.h
  12. 3
    1
      Marlin/example_configurations/SCARA/Configuration.h
  13. 3
    1
      Marlin/example_configurations/TAZ4/Configuration.h
  14. 3
    1
      Marlin/example_configurations/WITBOX/Configuration.h
  15. 3
    1
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  16. 3
    1
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  17. 3
    1
      Marlin/example_configurations/delta/generic/Configuration.h
  18. 3
    1
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  19. 3
    1
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  20. 3
    1
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  21. 3
    1
      Marlin/example_configurations/makibox/Configuration.h
  22. 3
    1
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  23. 16
    5
      Marlin/temperature.cpp
  24. 1
    0
      Marlin/temperature.h

+ 3
- 1
Marlin/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active); 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/Cartesio/Configuration.h View File

@@ -289,7 +289,7 @@
289 289
 // Comment the following line to disable PID and enable bang-bang.
290 290
 #define PIDTEMP
291 291
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
292
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
292
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
293 293
 #if ENABLED(PIDTEMP)
294 294
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
295 295
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -297,6 +297,8 @@
297 297
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
298 298
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
299 299
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
300
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
301
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
300 302
   #define K1 0.95 //smoothing factor within the PID
301 303
 
302 304
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/Felix/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // Felix 2.0+ electronics with v4 Hotend

+ 3
- 1
Marlin/example_configurations/Felix/DUAL/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // Felix 2.0+ electronics with v4 Hotend

+ 3
- 1
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -291,7 +291,7 @@
291 291
 // Comment the following line to disable PID and enable bang-bang.
292 292
 #define PIDTEMP
293 293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
294
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
294
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
295 295
 #if ENABLED(PIDTEMP)
296 296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297 297
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -299,6 +299,8 @@
299 299
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
300 300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301 301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
302
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
303
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
302 304
   #define K1 0.95 //smoothing factor within the PID
303 305
 
304 306
   // Hephestos i3

+ 3
- 1
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 250  // If the temperature difference between the target temperature and the actual temperature
300
+                                    // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // Tuned PID values using M303

+ 3
- 1
Marlin/example_configurations/K8200/Configuration.h View File

@@ -295,7 +295,7 @@
295 295
 // Comment the following line to disable PID and enable bang-bang.
296 296
 #define PIDTEMP
297 297
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
298
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
298
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
299 299
 #if ENABLED(PIDTEMP)
300 300
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
301 301
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -303,6 +303,8 @@
303 303
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
304 304
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
305 305
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
306
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
307
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
306 308
   #define K1 0.95 //smoothing factor within the PID
307 309
 
308 310
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/K8400/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/K8400/Dual-head/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -291,7 +291,7 @@
291 291
 // Comment the following line to disable PID and enable bang-bang.
292 292
 #define PIDTEMP
293 293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
294
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
294
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
295 295
 #if ENABLED(PIDTEMP)
296 296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297 297
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -299,6 +299,8 @@
299 299
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
300 300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301 301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
302
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
303
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
302 304
   #define K1 0.95 //smoothing factor within the PID
303 305
 
304 306
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -320,7 +320,7 @@
320 320
 // Comment the following line to disable PID and enable bang-bang.
321 321
 #define PIDTEMP
322 322
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
323
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
323
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
324 324
 #if ENABLED(PIDTEMP)
325 325
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
326 326
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -328,6 +328,8 @@
328 328
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
329 329
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
330 330
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
331
+  #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature
332
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
331 333
   #define K1 0.95 //smoothing factor within the PID
332 334
 
333 335
   // Merlin Hotend: From Autotune

+ 3
- 1
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 70 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX 74 // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX 74 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 16 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -291,7 +291,7 @@
291 291
 // Comment the following line to disable PID and enable bang-bang.
292 292
 #define PIDTEMP
293 293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
294
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
294
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
295 295
 #if ENABLED(PIDTEMP)
296 296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297 297
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -299,6 +299,8 @@
299 299
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
300 300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301 301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
302
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
303
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
302 304
   #define K1 0.95 //smoothing factor within the PID
303 305
 
304 306
   // Witbox

+ 3
- 1
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -294,7 +294,7 @@
294 294
 // Comment the following line to disable PID and enable bang-bang.
295 295
 #define PIDTEMP
296 296
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
297
-#define PID_MAX  125 // limits current to nozzle while PID is active; 255=full current
297
+#define PID_MAX  125 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
298 298
 #if ENABLED(PIDTEMP)
299 299
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
300 300
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -302,6 +302,8 @@
302 302
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
303 303
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
304 304
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
305
+  #define PID_FUNCTIONAL_RANGE 50 // If the temperature difference between the target temperature and the actual temperature
306
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
305 307
   #define K1 0.95 //smoothing factor within the PID
306 308
 
307 309
   // Kossel Pro

+ 3
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -281,7 +281,7 @@
281 281
 // Comment the following line to disable PID and enable bang-bang.
282 282
 #define PIDTEMP
283 283
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
284
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
284
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
285 285
 #if ENABLED(PIDTEMP)
286 286
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
287 287
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -289,6 +289,8 @@
289 289
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
290 290
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
291 291
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
292
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
293
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
292 294
   #define K1 0.95 //smoothing factor within the PID
293 295
 
294 296
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/makibox/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 3
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -288,7 +288,7 @@
288 288
 // Comment the following line to disable PID and enable bang-bang.
289 289
 #define PIDTEMP
290 290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
291
-#define PID_MAX BANG_MAX // limits current to nozzle while PID is active; 255=full current
291
+#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
292 292
 #if ENABLED(PIDTEMP)
293 293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294 294
   //#define PID_DEBUG // Sends debug data to the serial port.
@@ -296,6 +296,8 @@
296 296
   //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
297 297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298 298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
299
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
300
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
299 301
   #define K1 0.95 //smoothing factor within the PID
300 302
 
301 303
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it

+ 16
- 5
Marlin/temperature.cpp View File

@@ -137,6 +137,7 @@ volatile bool Temperature::temp_meas_ready = false;
137 137
   #endif
138 138
 
139 139
   float Temperature::pid_error[HOTENDS];
140
+  bool Temperature::pid_reset[HOTENDS];
140 141
 #endif
141 142
 
142 143
 #if ENABLED(PIDTEMPBED)
@@ -194,6 +195,7 @@ uint8_t Temperature::soft_pwm[HOTENDS];
194 195
 #endif
195 196
 
196 197
 #if HAS_PID_HEATING
198
+
197 199
   void Temperature::PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
198 200
     float input = 0.0;
199 201
     int cycles = 0;
@@ -450,6 +452,7 @@ int Temperature::getHeaterPower(int heater) {
450 452
 }
451 453
 
452 454
 #if HAS_AUTO_FAN
455
+
453 456
   void Temperature::checkExtruderAutoFans() {
454 457
     const int8_t fanPin[] = { EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN };
455 458
     const int fanBit[] = {
@@ -532,17 +535,23 @@ float Temperature::get_pid_output(int e) {
532 535
   #endif
533 536
   float pid_output;
534 537
   #if ENABLED(PIDTEMP)
535
-    #if ENABLED(PID_OPENLOOP)
536
-      pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX);
537
-    #else
538
+    #if DISABLED(PID_OPENLOOP)
538 539
       pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
539 540
       dTerm[HOTEND_INDEX] = K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + K1 * dTerm[HOTEND_INDEX];
540 541
       temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
541
-      if (target_temperature[HOTEND_INDEX] == 0) {
542
+      if (pid_error[HOTEND_INDEX] > PID_FUNCTIONAL_RANGE) {
543
+        pid_output = BANG_MAX;
544
+        pid_reset[HOTEND_INDEX] = true;
545
+      }
546
+      else if (pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0) {
542 547
         pid_output = 0;
543
-        temp_iState[HOTEND_INDEX] = 0.0;
548
+        pid_reset[HOTEND_INDEX] = true;
544 549
       }
545 550
       else {
551
+        if (pid_reset[HOTEND_INDEX]) {
552
+          temp_iState[HOTEND_INDEX] = 0.0;
553
+          pid_reset[HOTEND_INDEX] = false;
554
+        }
546 555
         pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX];
547 556
         temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX];
548 557
         iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
@@ -575,6 +584,8 @@ float Temperature::get_pid_output(int e) {
575 584
           pid_output = 0;
576 585
         }
577 586
       }
587
+    #else
588
+      pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX);
578 589
     #endif //PID_OPENLOOP
579 590
 
580 591
     #if ENABLED(PID_DEBUG)

+ 1
- 0
Marlin/temperature.h View File

@@ -158,6 +158,7 @@ class Temperature {
158 158
       #endif
159 159
 
160 160
       static float pid_error[HOTENDS];
161
+      static bool pid_reset[HOTENDS];
161 162
     #endif
162 163
 
163 164
     #if ENABLED(PIDTEMPBED)

Loading…
Cancel
Save