From d4901cbab1b2a76481af9900b6043d33d249e4d6 Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 30 Sep 2020 22:52:30 +0200 Subject: [PATCH] channels: add dac_value to Report --- src/channels.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/channels.rs b/src/channels.rs index 4291724..cdd591b 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -417,6 +417,7 @@ impl Channels { let (i_set, _) = self.get_i(channel); let i_tec = self.read_itec(channel); let tec_i = (i_tec - vref) / ElectricalResistance::new::(0.4); + let (dac_value, _) = self.get_dac(channel); let state = self.channel_state(channel); let pid_output = state.pid.last_output.map(|last_output| ElectricCurrent::new::(last_output) @@ -431,6 +432,7 @@ impl Channels { pid_engaged: state.pid_engaged, i_set, vref, + dac_value, dac_feedback: self.read_dac_feedback(channel), i_tec, tec_i, @@ -451,7 +453,7 @@ impl Channels { } } -type JsonBuffer = heapless::Vec; +type JsonBuffer = heapless::Vec; #[derive(Serialize)] pub struct Report { @@ -463,6 +465,7 @@ pub struct Report { pid_engaged: bool, i_set: ElectricCurrent, vref: ElectricPotential, + dac_value: ElectricPotential, dac_feedback: ElectricPotential, i_tec: ElectricPotential, tec_i: ElectricCurrent, @@ -538,6 +541,7 @@ mod test { pid_engaged: false, i_set: ElectricCurrent::new::(0.5 / 1.1), vref: ElectricPotential::new::(1.5 / 1.1), + dac_value: ElectricPotential::new::(2.0 / 1.1), dac_feedback: ElectricPotential::new::(2.0 / 1.1), i_tec: ElectricPotential::new::(2.0 / 1.1), tec_i: ElectricCurrent::new::(0.2 / 1.1), @@ -556,7 +560,7 @@ mod test { let pwm_summary = PwmSummary { channel: 0, - center: CenterPoint::Vref, + center: CenterPointJson(CenterPoint::Vref), i_set: PwmSummaryField { value: ElectricCurrent::new::(value), max: ElectricCurrent::new::(max),