forked from M-Labs/thermostat
channels: add dac_value to Report
This commit is contained in:
parent
62d89a68a1
commit
d4901cbab1
|
@ -417,6 +417,7 @@ impl Channels {
|
||||||
let (i_set, _) = self.get_i(channel);
|
let (i_set, _) = self.get_i(channel);
|
||||||
let i_tec = self.read_itec(channel);
|
let i_tec = self.read_itec(channel);
|
||||||
let tec_i = (i_tec - vref) / ElectricalResistance::new::<ohm>(0.4);
|
let tec_i = (i_tec - vref) / ElectricalResistance::new::<ohm>(0.4);
|
||||||
|
let (dac_value, _) = self.get_dac(channel);
|
||||||
let state = self.channel_state(channel);
|
let state = self.channel_state(channel);
|
||||||
let pid_output = state.pid.last_output.map(|last_output|
|
let pid_output = state.pid.last_output.map(|last_output|
|
||||||
ElectricCurrent::new::<ampere>(last_output)
|
ElectricCurrent::new::<ampere>(last_output)
|
||||||
|
@ -431,6 +432,7 @@ impl Channels {
|
||||||
pid_engaged: state.pid_engaged,
|
pid_engaged: state.pid_engaged,
|
||||||
i_set,
|
i_set,
|
||||||
vref,
|
vref,
|
||||||
|
dac_value,
|
||||||
dac_feedback: self.read_dac_feedback(channel),
|
dac_feedback: self.read_dac_feedback(channel),
|
||||||
i_tec,
|
i_tec,
|
||||||
tec_i,
|
tec_i,
|
||||||
|
@ -451,7 +453,7 @@ impl Channels {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type JsonBuffer = heapless::Vec<u8, heapless::consts::U360>;
|
type JsonBuffer = heapless::Vec<u8, heapless::consts::U512>;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct Report {
|
pub struct Report {
|
||||||
|
@ -463,6 +465,7 @@ pub struct Report {
|
||||||
pid_engaged: bool,
|
pid_engaged: bool,
|
||||||
i_set: ElectricCurrent,
|
i_set: ElectricCurrent,
|
||||||
vref: ElectricPotential,
|
vref: ElectricPotential,
|
||||||
|
dac_value: ElectricPotential,
|
||||||
dac_feedback: ElectricPotential,
|
dac_feedback: ElectricPotential,
|
||||||
i_tec: ElectricPotential,
|
i_tec: ElectricPotential,
|
||||||
tec_i: ElectricCurrent,
|
tec_i: ElectricCurrent,
|
||||||
|
@ -538,6 +541,7 @@ mod test {
|
||||||
pid_engaged: false,
|
pid_engaged: false,
|
||||||
i_set: ElectricCurrent::new::<ampere>(0.5 / 1.1),
|
i_set: ElectricCurrent::new::<ampere>(0.5 / 1.1),
|
||||||
vref: ElectricPotential::new::<volt>(1.5 / 1.1),
|
vref: ElectricPotential::new::<volt>(1.5 / 1.1),
|
||||||
|
dac_value: ElectricPotential::new::<volt>(2.0 / 1.1),
|
||||||
dac_feedback: ElectricPotential::new::<volt>(2.0 / 1.1),
|
dac_feedback: ElectricPotential::new::<volt>(2.0 / 1.1),
|
||||||
i_tec: ElectricPotential::new::<volt>(2.0 / 1.1),
|
i_tec: ElectricPotential::new::<volt>(2.0 / 1.1),
|
||||||
tec_i: ElectricCurrent::new::<ampere>(0.2 / 1.1),
|
tec_i: ElectricCurrent::new::<ampere>(0.2 / 1.1),
|
||||||
|
@ -556,7 +560,7 @@ mod test {
|
||||||
|
|
||||||
let pwm_summary = PwmSummary {
|
let pwm_summary = PwmSummary {
|
||||||
channel: 0,
|
channel: 0,
|
||||||
center: CenterPoint::Vref,
|
center: CenterPointJson(CenterPoint::Vref),
|
||||||
i_set: PwmSummaryField {
|
i_set: PwmSummaryField {
|
||||||
value: ElectricCurrent::new::<ampere>(value),
|
value: ElectricCurrent::new::<ampere>(value),
|
||||||
max: ElectricCurrent::new::<ampere>(max),
|
max: ElectricCurrent::new::<ampere>(max),
|
||||||
|
|
Loading…
Reference in New Issue