correct typo

This commit is contained in:
linuswck 2024-05-10 12:27:34 +08:00
parent 266110ba14
commit 0dceb8c3c6
1 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ impl TecSettings {
units: PhantomData,
value: 1.0,
};
const MAX_V_DUTY_TO_CURRENT_RATE: ElectricPotential = ElectricPotential {
const MAX_V_DUTY_TO_VOLTAGE_RATE: ElectricPotential = ElectricPotential {
dimension: PhantomData,
units: PhantomData,
value: 4.0 * 3.3,
@ -77,7 +77,7 @@ impl TecSettings {
value: 5.0,
};
const MAX_V_DUTY_MAX: f64 =
TecSettings::MAX_V_MAX.value as f64 / TecSettings::MAX_V_DUTY_TO_CURRENT_RATE.value as f64;
TecSettings::MAX_V_MAX.value as f64 / TecSettings::MAX_V_DUTY_TO_VOLTAGE_RATE.value as f64;
const MAX_I_POS_NEG_DUTY_TO_CURRENT_RATE: ElectricCurrent = ElectricCurrent {
dimension: PhantomData,
units: PhantomData,
@ -243,11 +243,11 @@ impl Thermostat {
}
pub fn set_max_v(&mut self, max_v: ElectricPotential) -> ElectricPotential {
let duty = (max_v / TecSettings::MAX_V_DUTY_TO_CURRENT_RATE).get::<ratio>();
let duty = (max_v / TecSettings::MAX_V_DUTY_TO_VOLTAGE_RATE).get::<ratio>();
let duty = self
.max1968
.set_pwm(PwmPinsEnum::MaxV, duty as f64, TecSettings::MAX_V_DUTY_MAX);
self.tec_settings.max_v_set = duty as f32 * TecSettings::MAX_V_DUTY_TO_CURRENT_RATE;
self.tec_settings.max_v_set = duty as f32 * TecSettings::MAX_V_DUTY_TO_VOLTAGE_RATE;
self.tec_settings.max_v_set
}