pid: only reset after target change

This commit is contained in:
Astro 2020-09-18 00:24:00 +02:00
parent 83a209397e
commit 34543c8660
1 changed files with 5 additions and 5 deletions

View File

@ -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 } => {