From 07ea733b34476701e01042d8753de420196b0d5d Mon Sep 17 00:00:00 2001 From: linuswck Date: Wed, 24 Jan 2024 12:25:45 +0800 Subject: [PATCH] thermostst: Patch hw related settings for rev0_3 --- src/thermostat/thermostat.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/thermostat/thermostat.rs b/src/thermostat/thermostat.rs index ef9c095..45894de 100644 --- a/src/thermostat/thermostat.rs +++ b/src/thermostat/thermostat.rs @@ -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.