fan: Avoid reading tec_i every cycle pre v3.0

This is the last remaining tec_i read, involving vref.
This commit is contained in:
atse 2024-02-28 12:56:07 +08:00
parent 76547be90a
commit 40fee0d51c

View File

@ -525,9 +525,15 @@ impl<'a> Channels<'a> {
}
pub fn current_abs_max_tec_i(&mut self) -> ElectricCurrent {
max_by(self.get_tec_i(0).abs(),
self.get_tec_i(1).abs(),
|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
if self.hwrev.major > 2 {
max_by(self.get_tec_i(0).abs(),
self.get_tec_i(1).abs(),
|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
} else {
max_by(self.get_i(0).abs(),
self.get_i(1).abs(),
|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
}
}
}