ErikZalm/Marlin — pull request #974 by AlexeyKruglov (2014-06-23 07:30:58+00:00)
Title: Improvements and bugfixes to PID heater controller code

A set of improvements and bugfixes for a fast-response low thermal capacity extruder to work:

- PID_autotune() (M303) could set heater power higher than PID_MAX when PID_MAX<20 -- fixed by 1. properly checking power range and 2. removing the lower limit of 20 for *bias* value.
- PID controlled heater could get stuck at target temperature minus PID_FUNCTIONAL_RANGE if heater response is fast enough because of a drop in heating power at PID turn on temperature -- fixed by initializing I term so that power changes continuously at PID turn on.
- PID_autotune() (M303) failed with "Temperature too high!" error if heater is faster than ~20 C/5 sec. Fixed by allowing to heat/cool for less than 5 sec in case it hits target temperature + 15 C.
- Change default PID_INTEGRAL_DRIVE_MAX from 255 to PID_MAX for extruders and to BED_MAX_POWER for bed to lower heating overshoot due to I term windup. Introduce a separate PID_INTEGRAL_DRIVE_MAX_BED for bed.
- Allow setting asymmetric PID_FUNCTIONAL_RANGE in Configuration.h. This allows to extend the low limit of PID range to slow down heating in advance without extending the high limit.