From 31d23a3e0c784452343841d13d29e8d90d34f3ad Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Sat, 9 Jan 2021 12:57:13 -0800 Subject: [PATCH] lock-in: use same method for batch_index branching in both instances --- dsp/src/lockin.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dsp/src/lockin.rs b/dsp/src/lockin.rs index 5b82313..4ab6f02 100644 --- a/dsp/src/lockin.rs +++ b/dsp/src/lockin.rs @@ -165,8 +165,9 @@ impl Lockin { frequency = self.last_frequency.unwrap(); } None => { - self.batch_index += 1; - if self.batch_index == ADC_BATCHES as u32 { + if self.batch_index < ADC_BATCHES as u32 - 1 { + self.batch_index += 1; + } else { self.batch_index = 0; } return Err("insufficient timestamps");