diff --git a/src/bin/lockin-external.rs b/src/bin/lockin-external.rs index b3b9d4f..f24f251 100644 --- a/src/bin/lockin-external.rs +++ b/src/bin/lockin-external.rs @@ -118,12 +118,12 @@ const APP: () = { .zip(Accu::new(sample_phase, sample_frequency)) // Convert to signed, MSB align the ADC sample, update the Lockin (demodulate, filter) .map(|(&sample, phase)| { - let s = (sample as i16 as i32) - << (15 - design_parameters::SAMPLE_BUFFER_SIZE_LOG2 + 1); + let s = (sample as i16 as i32) << (15 + 1); lockin.update(s, phase, time_constant) }) // Decimate - .sum(); + .last() + .unwrap(); let conf = "frequency_discriminator"; let output = match conf { diff --git a/src/bin/lockin-internal.rs b/src/bin/lockin-internal.rs index 6913f0a..393130e 100644 --- a/src/bin/lockin-internal.rs +++ b/src/bin/lockin-internal.rs @@ -101,12 +101,12 @@ const APP: () = { .zip(Accu::new(sample_phase, sample_frequency)) // Convert to signed, MSB align the ADC sample, update the Lockin (demodulate, filter) .map(|(&sample, phase)| { - let s = (sample as i16 as i32) - << (15 - design_parameters::SAMPLE_BUFFER_SIZE_LOG2 + 1); + let s = (sample as i16 as i32) << (15 + 1); lockin.update(s, phase, time_constant) }) // Decimate - .sum(); + .last() + .unwrap(); for value in dac_samples[1].iter_mut() { *value = (output.arg() >> 16) as u16 ^ 0x8000;