i_tec -> i_set

i_tec is reserved for the voltage signal coming out of the MAX1968 chip
for now.
This commit is contained in:
atse 2024-02-14 17:01:19 +08:00
parent 8b975e656e
commit 76547be90a
2 changed files with 7 additions and 7 deletions

View File

@ -129,7 +129,7 @@ impl<'a> Channels<'a> {
voltage
}
pub fn set_i(&mut self, channel: usize, i_tec: ElectricCurrent) -> ElectricCurrent {
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,
@ -137,11 +137,11 @@ impl<'a> Channels<'a> {
};
let center_point = vref_meas;
let r_sense = ElectricalResistance::new::<ohm>(R_SENSE);
let voltage = i_tec * 10.0 * r_sense + center_point;
let voltage = i_set * 10.0 * r_sense + center_point;
let voltage = self.set_dac(channel, voltage);
let i_tec = (voltage - center_point) / (10.0 * r_sense);
self.channel_state(channel).i_set = i_tec;
i_tec
let i_set = (voltage - center_point) / (10.0 * r_sense);
self.channel_state(channel).i_set = i_set;
i_set
}
pub fn read_dac_feedback(&mut self, channel: usize) -> ElectricPotential {

View File

@ -207,11 +207,11 @@ impl Handler {
}
fn set_center_point(socket: &mut TcpSocket, channels: &mut Channels, channel: usize, center: CenterPoint) -> Result<Handler, Error> {
let i_tec = channels.get_i(channel);
let i_set = channels.get_i(channel);
let state = channels.channel_state(channel);
state.center = center;
if !state.pid_engaged {
channels.set_i(channel, i_tec);
channels.set_i(channel, i_set);
}
send_line(socket, b"{}");
Ok(Handler::Handled)