diff --git a/src/channels.rs b/src/channels.rs index 588e994..c2a2900 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -137,12 +137,7 @@ impl<'a> Channels<'a> { } pub fn set_i(&mut self, channel: usize, i_set: ElectricCurrent) -> ElectricCurrent { - let vref_meas = match channel.into() { - 0 => self.channel0.vref_meas, - 1 => self.channel1.vref_meas, - _ => unreachable!(), - }; - let center_point = vref_meas; + let center_point = self.get_center(channel); let r_sense = ElectricalResistance::new::(R_SENSE); let voltage = i_set * 10.0 * r_sense + center_point; let voltage = self.set_dac(channel, voltage);