config: save/store pid_engaged

Fixes Gitea issue #17
This commit is contained in:
Astro 2020-12-13 02:33:59 +01:00
parent 2e7be3fe01
commit b2f455b2cf
1 changed files with 3 additions and 0 deletions

View File

@ -17,6 +17,7 @@ pub struct ChannelConfig {
center: CenterPoint, center: CenterPoint,
pid: pid::Parameters, pid: pid::Parameters,
pid_target: f32, pid_target: f32,
pid_engaged: bool,
sh: steinhart_hart::Parameters, sh: steinhart_hart::Parameters,
pwm: PwmLimits, pwm: PwmLimits,
/// uses variant `PostFilter::Invalid` instead of `None` to save space /// uses variant `PostFilter::Invalid` instead of `None` to save space
@ -36,6 +37,7 @@ impl ChannelConfig {
center: state.center.clone(), center: state.center.clone(),
pid: state.pid.parameters.clone(), pid: state.pid.parameters.clone(),
pid_target: state.pid.target as f32, pid_target: state.pid.target as f32,
pid_engaged: state.pid_engaged,
sh: state.sh.clone(), sh: state.sh.clone(),
pwm, pwm,
adc_postfilter, adc_postfilter,
@ -47,6 +49,7 @@ impl ChannelConfig {
state.center = self.center.clone(); state.center = self.center.clone();
state.pid.parameters = self.pid.clone(); state.pid.parameters = self.pid.clone();
state.pid.target = self.pid_target.into(); state.pid.target = self.pid_target.into();
state.pid_engaged = self.pid_engaged;
state.sh = self.sh.clone(); state.sh = self.sh.clone();
self.pwm.apply(channels, channel); self.pwm.apply(channels, channel);