diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-03 10:44:01 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-03 10:44:01 -0500 |
commit | bba22ab7f0606912014d5bbf9ec535fa9474ae69 (patch) | |
tree | 2ed8f0b49e05c851d24cd0713c3c65acb93af711 /klippy/heater.py | |
parent | a0b4cdb5c44125297aa989a4da19849ea6e7de48 (diff) | |
download | kutter-bba22ab7f0606912014d5bbf9ec535fa9474ae69.tar.gz kutter-bba22ab7f0606912014d5bbf9ec535fa9474ae69.tar.xz kutter-bba22ab7f0606912014d5bbf9ec535fa9474ae69.zip |
heater: Provide symbolic names for pid check_busy (aka M109 / M190)
Add PID_SETTLE_DELTA and PID_SETTLE_SLOPE constants to the code to try
and make it a little more clear how the wait for temperature code
works.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/heater.py')
-rw-r--r-- | klippy/heater.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/klippy/heater.py b/klippy/heater.py index c666ddec..553b208b 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -215,6 +215,9 @@ class ControlBangBang: # Proportional Integral Derivative (PID) control algo ###################################################################### +PID_SETTLE_DELTA = 1. +PID_SETTLE_SLOPE = .1 + class ControlPID: def __init__(self, heater, config): self.heater = heater @@ -255,7 +258,8 @@ class ControlPID: self.prev_temp_integ = temp_integ def check_busy(self, eventtime): temp_diff = self.heater.target_temp - self.heater.last_temp - return abs(temp_diff) > 1. or abs(self.prev_temp_deriv) > 0.1 + return (abs(temp_diff) > PID_SETTLE_DELTA + or abs(self.prev_temp_deriv) > PID_SETTLE_SLOPE) ###################################################################### |