forked from M-Labs/thermostat
pid: fix derivative calculation
Reviewed-on: M-Labs/thermostat#40 Co-Authored-By: topquark12 <aw@m-labs.hk> Co-Committed-By: topquark12 <aw@m-labs.hk>
This commit is contained in:
parent
8c9e12587f
commit
e94601f54f
|
@ -85,7 +85,7 @@ impl Controller {
|
||||||
None =>
|
None =>
|
||||||
0.0,
|
0.0,
|
||||||
Some(last_input) =>
|
Some(last_input) =>
|
||||||
f64::from(self.parameters.kd) * (input - last_input) / time_delta,
|
f64::from(self.parameters.kd) * (last_input - input) / time_delta,
|
||||||
};
|
};
|
||||||
self.last_input = Some(input);
|
self.last_input = Some(input);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue