Minor Tweaks

This commit is contained in:
Sebastian 2021-11-13 22:31:16 +01:00
parent fb67d421a2
commit 7b30081320
1 changed files with 4 additions and 1 deletions

View File

@ -124,7 +124,7 @@ fn main() -> ! {
let mut last_ic = 0u32;
let mut avg = 10f64;
let max_pwm = pwm.get_max_duty() as u32;
let mut cur_pwm = max_pwm / 2;
let mut cur_pwm = 3000; //max_pwm / 2;
// Skip the first measurement, it will be garbage
while !tim1.sr.read().cc1if().bit_is_set() || !tim2.sr.read().cc1if().bit_is_set() {
@ -155,6 +155,9 @@ fn main() -> ! {
let freq = (diff_ic as f64) / 1_000_000f64;
let diff = freq - avg;
led.toggle().unwrap();
if diff > 0.000_030 || diff < -0.000_030 {
continue;
}