Fix incorrect dac calibration algo
- Fix abnormally long calibration time
This commit is contained in:
parent
ae4bea0c8a
commit
680193b34b
@ -297,7 +297,6 @@ impl Channels {
|
||||
let mut best_error = ElectricPotential::new::<volt>(100.0);
|
||||
|
||||
for step in (5..18).rev() {
|
||||
let mut prev_value = start_value;
|
||||
for value in (start_value..=ad5680::MAX_VALUE).step_by(1 << step) {
|
||||
match channel {
|
||||
0 => {
|
||||
@ -316,7 +315,7 @@ impl Channels {
|
||||
break;
|
||||
} else if error < best_error {
|
||||
best_error = error;
|
||||
start_value = prev_value;
|
||||
start_value = value;
|
||||
|
||||
let vref = (value as f64 / ad5680::MAX_VALUE as f64) * DAC_OUT_V_MAX;
|
||||
match channel {
|
||||
@ -325,8 +324,6 @@ impl Channels {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
prev_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ mod hw_rev;
|
||||
|
||||
const HSE: MegaHertz = MegaHertz(8);
|
||||
#[cfg(not(feature = "semihosting"))]
|
||||
const WATCHDOG_INTERVAL: u32 = 2_000;
|
||||
const WATCHDOG_INTERVAL: u32 = 1_000;
|
||||
#[cfg(feature = "semihosting")]
|
||||
const WATCHDOG_INTERVAL: u32 = 30_000;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user