forked from M-Labs/thermostat
pid: only reset after target change
This commit is contained in:
parent
83a209397e
commit
34543c8660
10
src/main.rs
10
src/main.rs
|
@ -361,8 +361,11 @@ fn main() -> ! {
|
||||||
let pid = &mut channels.channel_state(channel).pid;
|
let pid = &mut channels.channel_state(channel).pid;
|
||||||
use command_parser::PidParameter::*;
|
use command_parser::PidParameter::*;
|
||||||
match parameter {
|
match parameter {
|
||||||
Target =>
|
Target => {
|
||||||
pid.target = value,
|
pid.target = value;
|
||||||
|
// reset pid.integral
|
||||||
|
pid.reset();
|
||||||
|
}
|
||||||
KP =>
|
KP =>
|
||||||
pid.parameters.kp = value,
|
pid.parameters.kp = value,
|
||||||
KI =>
|
KI =>
|
||||||
|
@ -378,9 +381,6 @@ fn main() -> ! {
|
||||||
IntegralMax =>
|
IntegralMax =>
|
||||||
pid.parameters.integral_max = value,
|
pid.parameters.integral_max = value,
|
||||||
}
|
}
|
||||||
// TODO: really reset PID state
|
|
||||||
// after each parameter change?
|
|
||||||
pid.reset();
|
|
||||||
let _ = writeln!(socket, "PID parameter updated");
|
let _ = writeln!(socket, "PID parameter updated");
|
||||||
}
|
}
|
||||||
Command::SteinhartHart { channel, parameter, value } => {
|
Command::SteinhartHart { channel, parameter, value } => {
|
||||||
|
|
Loading…
Reference in New Issue