forked from M-Labs/thermostat
Compare commits
2 Commits
5ba74c6d9b
...
bb4f43fe1c
Author | SHA1 | Date | |
---|---|---|---|
bb4f43fe1c | |||
9df0fe406f |
@ -26,8 +26,6 @@ pub struct ChannelState {
|
||||
pub adc_calibration: ad7172::ChannelCalibration,
|
||||
pub adc_time: Instant,
|
||||
pub adc_interval: Duration,
|
||||
/// VREF for the TEC (1.5V)
|
||||
pub vref: ElectricPotential,
|
||||
/// i_set 0A center point
|
||||
pub center: CenterPoint,
|
||||
pub dac_value: ElectricPotential,
|
||||
@ -44,8 +42,6 @@ impl ChannelState {
|
||||
adc_time: Instant::from_secs(0),
|
||||
// default: 10 Hz
|
||||
adc_interval: Duration::from_millis(100),
|
||||
// updated later with Channels.read_vref()
|
||||
vref: ElectricPotential::new::<volt>(1.5),
|
||||
center: CenterPoint::Vref,
|
||||
dac_value: ElectricPotential::new::<volt>(0.0),
|
||||
pid_engaged: false,
|
||||
|
@ -58,7 +58,6 @@ impl Channels {
|
||||
let pwm = pins.pwm;
|
||||
let mut channels = Channels { channel0, channel1, adc, pins_adc, pwm };
|
||||
for channel in 0..CHANNELS {
|
||||
channels.channel_state(channel).vref = channels.read_vref(channel);
|
||||
channels.calibrate_dac_value(channel);
|
||||
channels.set_i(channel, ElectricCurrent::new::<ampere>(0.0));
|
||||
}
|
||||
@ -98,11 +97,8 @@ impl Channels {
|
||||
/// calculate the TEC i_set centerpoint
|
||||
pub fn get_center(&mut self, channel: usize) -> ElectricPotential {
|
||||
match self.channel_state(channel).center {
|
||||
CenterPoint::Vref => {
|
||||
let vref = self.read_vref(channel);
|
||||
self.channel_state(channel).vref = vref;
|
||||
vref
|
||||
},
|
||||
CenterPoint::Vref =>
|
||||
self.read_vref(channel),
|
||||
CenterPoint::Override(center_point) =>
|
||||
ElectricPotential::new::<volt>(center_point.into()),
|
||||
}
|
||||
@ -432,7 +428,6 @@ impl Channels {
|
||||
}
|
||||
|
||||
fn report(&mut self, channel: usize) -> Report {
|
||||
let vref = self.channel_state(channel).vref;
|
||||
let i_set = self.get_i(channel);
|
||||
let i_tec = self.read_itec(channel);
|
||||
let tec_i = self.get_tec_i(channel);
|
||||
@ -449,7 +444,6 @@ impl Channels {
|
||||
.map(|temperature| temperature.get::<degree_celsius>()),
|
||||
pid_engaged: state.pid_engaged,
|
||||
i_set,
|
||||
vref,
|
||||
dac_value,
|
||||
dac_feedback: self.read_dac_feedback(channel),
|
||||
i_tec,
|
||||
@ -547,7 +541,6 @@ pub struct Report {
|
||||
temperature: Option<f64>,
|
||||
pid_engaged: bool,
|
||||
i_set: ElectricCurrent,
|
||||
vref: ElectricPotential,
|
||||
dac_value: ElectricPotential,
|
||||
dac_feedback: ElectricPotential,
|
||||
i_tec: ElectricPotential,
|
||||
|
Loading…
Reference in New Issue
Block a user