thermostst: Patch hw related settings for rev0_3

master
linuswck 2024-01-24 12:25:45 +08:00
parent 5bea3f0e5f
commit 07ea733b34
1 changed files with 2 additions and 5 deletions

View File

@ -32,11 +32,10 @@ pub struct TecSettings {
}
impl TecSettings{
// FixMe: Rev0_2 is 3.3V max while Rev0_3 is 3.0V max
pub const DAC_OUT_V_MAX: ElectricPotential = ElectricPotential {
dimension: PhantomData,
units: PhantomData,
value: 3.3,
value: 3.0,
};
pub const TEC_VSEC_BIAS_V: ElectricPotential = ElectricPotential {
dimension: PhantomData,
@ -214,9 +213,7 @@ impl Thermostat{
}
pub fn get_tec_v(&mut self) -> ElectricPotential {
// Fixme: Rev0_2 has Analog Input Polarity Reversed
// Remove the -ve sign for Rev0_3
-(self.max1968.adc_read(AdcReadTarget::VTec, 16) - TecSettings::TEC_VSEC_BIAS_V) * 4.0
(self.max1968.adc_read(AdcReadTarget::VTec, 16) - TecSettings::TEC_VSEC_BIAS_V) * 4.0
}
/// Calibrates the DAC output to match vref of the MAX driver to reduce zero-current offset of the MAX driver output.