Skip to content

Commit

Permalink
dt670: vref
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Sep 17, 2024
1 parent b428965 commit 8328875
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hardware/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub enum Sensor {
},
/// DT-670 Silicon diode
Dt670 {
v_ref_inv: f32, // effective inverse reference voltage (V)
v_ref: f32, // effective reference voltage (V)
},
}

Expand All @@ -133,7 +133,7 @@ impl Sensor {
}

pub fn dt670(v_ref: f32) -> Self {
Self::Dt670 { v_ref_inv: v_ref }
Self::Dt670 { v_ref }
}
}

Expand Down Expand Up @@ -172,8 +172,8 @@ impl Sensor {
// https://en.wikipedia.org/wiki/Thermistor#B_or_%CE%B2_parameter_equation
1.0 / (*t0_inv as f64 + *beta_inv as f64 * relative_resistance.ln()) - ZERO_C as f64
}
Self::Dt670 { v_ref_inv } => {
let voltage = f32::from(code) * v_ref_inv;
Self::Dt670 { v_ref } => {
let voltage = f32::from(code) * v_ref;
let curve = &super::dt670::CURVE;
let idx = curve.partition_point(|&(_t, v, _dvdt)| v < voltage);
curve
Expand Down

0 comments on commit 8328875

Please sign in to comment.