Browse Source

Revert "Squashed - Removal of PID functional range"

Scott Lahteine 8 years ago
parent
commit
1e551c0688
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
289
 // Comment the following line to disable PID and enable bang-bang.
290
 #define PIDTEMP
290
 #define PIDTEMP
291
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
293
 #if ENABLED(PIDTEMP)
294
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
295
   //#define PID_DEBUG // Sends debug data to the serial port.
295
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
299
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
302
   #define K1 0.95 //smoothing factor within the PID
301
 
303
 
302
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // Felix 2.0+ electronics with v4 Hotend
303
   // Felix 2.0+ electronics with v4 Hotend

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

288
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // Felix 2.0+ electronics with v4 Hotend
303
   // Felix 2.0+ electronics with v4 Hotend

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

291
 // Comment the following line to disable PID and enable bang-bang.
291
 // Comment the following line to disable PID and enable bang-bang.
292
 #define PIDTEMP
292
 #define PIDTEMP
293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
295
 #if ENABLED(PIDTEMP)
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
304
   #define K1 0.95 //smoothing factor within the PID
303
 
305
 
304
   // Hephestos i3
306
   // Hephestos i3

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

288
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // Tuned PID values using M303
303
   // Tuned PID values using M303

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

295
 // Comment the following line to disable PID and enable bang-bang.
295
 // Comment the following line to disable PID and enable bang-bang.
296
 #define PIDTEMP
296
 #define PIDTEMP
297
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
299
 #if ENABLED(PIDTEMP)
300
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
300
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
301
   //#define PID_DEBUG // Sends debug data to the serial port.
301
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
304
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
305
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
308
   #define K1 0.95 //smoothing factor within the PID
307
 
309
 
308
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
291
 // Comment the following line to disable PID and enable bang-bang.
292
 #define PIDTEMP
292
 #define PIDTEMP
293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
295
 #if ENABLED(PIDTEMP)
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
304
   #define K1 0.95 //smoothing factor within the PID
303
 
305
 
304
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
320
 // Comment the following line to disable PID and enable bang-bang.
321
 #define PIDTEMP
321
 #define PIDTEMP
322
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
324
 #if ENABLED(PIDTEMP)
325
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
325
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
326
   //#define PID_DEBUG // Sends debug data to the serial port.
326
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
329
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
330
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
333
   #define K1 0.95 //smoothing factor within the PID
332
 
334
 
333
   // Merlin Hotend: From Autotune
335
   // Merlin Hotend: From Autotune

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

288
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 70 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
291
 // Comment the following line to disable PID and enable bang-bang.
292
 #define PIDTEMP
292
 #define PIDTEMP
293
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
295
 #if ENABLED(PIDTEMP)
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
296
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
297
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
300
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
301
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
304
   #define K1 0.95 //smoothing factor within the PID
303
 
305
 
304
   // Witbox
306
   // Witbox

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

288
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
294
 // Comment the following line to disable PID and enable bang-bang.
295
 #define PIDTEMP
295
 #define PIDTEMP
296
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
298
 #if ENABLED(PIDTEMP)
299
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
299
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
300
   //#define PID_DEBUG // Sends debug data to the serial port.
300
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
303
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
304
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
307
   #define K1 0.95 //smoothing factor within the PID
306
 
308
 
307
   // Kossel Pro
309
   // Kossel Pro

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

281
 // Comment the following line to disable PID and enable bang-bang.
281
 // Comment the following line to disable PID and enable bang-bang.
282
 #define PIDTEMP
282
 #define PIDTEMP
283
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
285
 #if ENABLED(PIDTEMP)
286
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
286
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
287
   //#define PID_DEBUG // Sends debug data to the serial port.
287
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
290
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
291
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
294
   #define K1 0.95 //smoothing factor within the PID
293
 
295
 
294
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
 // Comment the following line to disable PID and enable bang-bang.
288
 // Comment the following line to disable PID and enable bang-bang.
289
 #define PIDTEMP
289
 #define PIDTEMP
290
 #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
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
 #if ENABLED(PIDTEMP)
292
 #if ENABLED(PIDTEMP)
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
293
   //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
294
   //#define PID_DEBUG // Sends debug data to the serial port.
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
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
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
297
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
298
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
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
   #define K1 0.95 //smoothing factor within the PID
301
   #define K1 0.95 //smoothing factor within the PID
300
 
302
 
301
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
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
   #endif
137
   #endif
138
 
138
 
139
   float Temperature::pid_error[HOTENDS];
139
   float Temperature::pid_error[HOTENDS];
140
+  bool Temperature::pid_reset[HOTENDS];
140
 #endif
141
 #endif
141
 
142
 
142
 #if ENABLED(PIDTEMPBED)
143
 #if ENABLED(PIDTEMPBED)
194
 #endif
195
 #endif
195
 
196
 
196
 #if HAS_PID_HEATING
197
 #if HAS_PID_HEATING
198
+
197
   void Temperature::PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
199
   void Temperature::PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
198
     float input = 0.0;
200
     float input = 0.0;
199
     int cycles = 0;
201
     int cycles = 0;
450
 }
452
 }
451
 
453
 
452
 #if HAS_AUTO_FAN
454
 #if HAS_AUTO_FAN
455
+
453
   void Temperature::checkExtruderAutoFans() {
456
   void Temperature::checkExtruderAutoFans() {
454
     const int8_t fanPin[] = { EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN };
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
     const int fanBit[] = {
458
     const int fanBit[] = {
532
   #endif
535
   #endif
533
   float pid_output;
536
   float pid_output;
534
   #if ENABLED(PIDTEMP)
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
       pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
539
       pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
539
       dTerm[HOTEND_INDEX] = K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + K1 * dTerm[HOTEND_INDEX];
540
       dTerm[HOTEND_INDEX] = K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + K1 * dTerm[HOTEND_INDEX];
540
       temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
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
         pid_output = 0;
547
         pid_output = 0;
543
-        temp_iState[HOTEND_INDEX] = 0.0;
548
+        pid_reset[HOTEND_INDEX] = true;
544
       }
549
       }
545
       else {
550
       else {
551
+        if (pid_reset[HOTEND_INDEX]) {
552
+          temp_iState[HOTEND_INDEX] = 0.0;
553
+          pid_reset[HOTEND_INDEX] = false;
554
+        }
546
         pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX];
555
         pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX];
547
         temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX];
556
         temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX];
548
         iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
557
         iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
575
           pid_output = 0;
584
           pid_output = 0;
576
         }
585
         }
577
       }
586
       }
587
+    #else
588
+      pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX);
578
     #endif //PID_OPENLOOP
589
     #endif //PID_OPENLOOP
579
 
590
 
580
     #if ENABLED(PID_DEBUG)
591
     #if ENABLED(PID_DEBUG)

+ 1
- 0
Marlin/temperature.h View File

158
       #endif
158
       #endif
159
 
159
 
160
       static float pid_error[HOTENDS];
160
       static float pid_error[HOTENDS];
161
+      static bool pid_reset[HOTENDS];
161
     #endif
162
     #endif
162
 
163
 
163
     #if ENABLED(PIDTEMPBED)
164
     #if ENABLED(PIDTEMPBED)

Loading…
Cancel
Save