forked from M-Labs/ionpak-thermostat
report target filament voltage
This commit is contained in:
parent
c815d4d37f
commit
5d4a223800
|
@ -30,6 +30,7 @@ pub struct Controller {
|
||||||
fbi_buffer_count: usize,
|
fbi_buffer_count: usize,
|
||||||
last_fbi: Option<f32>,
|
last_fbi: Option<f32>,
|
||||||
fbi_pid: pid::Controller,
|
fbi_pid: pid::Controller,
|
||||||
|
last_fv_target: Option<f32>,
|
||||||
|
|
||||||
fv_pid: pid::Controller,
|
fv_pid: pid::Controller,
|
||||||
last_fv: Option<f32>,
|
last_fv: Option<f32>,
|
||||||
|
@ -42,6 +43,7 @@ pub struct Controller {
|
||||||
pub struct ControllerStatus {
|
pub struct ControllerStatus {
|
||||||
pub ready: bool,
|
pub ready: bool,
|
||||||
pub fbi: Option<f32>,
|
pub fbi: Option<f32>,
|
||||||
|
pub fv_target: Option<f32>,
|
||||||
pub fv: Option<f32>,
|
pub fv: Option<f32>,
|
||||||
pub fbv: Option<f32>
|
pub fbv: Option<f32>
|
||||||
}
|
}
|
||||||
|
@ -55,6 +57,7 @@ impl Controller {
|
||||||
fbi_buffer_count: 0,
|
fbi_buffer_count: 0,
|
||||||
last_fbi: None,
|
last_fbi: None,
|
||||||
fbi_pid: pid::Controller::new(FBI_PID_PARAMETERS),
|
fbi_pid: pid::Controller::new(FBI_PID_PARAMETERS),
|
||||||
|
last_fv_target: None,
|
||||||
|
|
||||||
fv_pid: pid::Controller::new(FV_PID_PARAMETERS),
|
fv_pid: pid::Controller::new(FV_PID_PARAMETERS),
|
||||||
last_fv: None,
|
last_fv: None,
|
||||||
|
@ -90,6 +93,7 @@ impl Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
let fv_target = self.fbi_pid.update(fbi);
|
let fv_target = self.fbi_pid.update(fbi);
|
||||||
|
self.last_fv_target = Some(fv_target);
|
||||||
self.fv_pid.set_target(fv_target);
|
self.fv_pid.set_target(fv_target);
|
||||||
|
|
||||||
let fv = fv_sample as f32/board::FV_ADC_GAIN;
|
let fv = fv_sample as f32/board::FV_ADC_GAIN;
|
||||||
|
@ -135,6 +139,7 @@ impl Controller {
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.fbi_pid.reset();
|
self.fbi_pid.reset();
|
||||||
self.fv_pid.reset();
|
self.fv_pid.reset();
|
||||||
|
self.last_fv_target = None;
|
||||||
self.fbi_buffer_count = 0;
|
self.fbi_buffer_count = 0;
|
||||||
self.last_fbi = None;
|
self.last_fbi = None;
|
||||||
self.last_fv = None;
|
self.last_fv = None;
|
||||||
|
@ -145,6 +150,7 @@ impl Controller {
|
||||||
ControllerStatus {
|
ControllerStatus {
|
||||||
ready: self.emission_ready() & self.bias_ready(),
|
ready: self.emission_ready() & self.bias_ready(),
|
||||||
fbi: self.last_fbi,
|
fbi: self.last_fbi,
|
||||||
|
fv_target: self.last_fv_target,
|
||||||
fv: self.last_fv,
|
fv: self.last_fv,
|
||||||
fbv: self.last_fbv
|
fbv: self.last_fbv
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue