From f0eb58dfb251d412b1c0efdb96d7c081a724597c Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Thu, 14 Jan 2021 14:49:07 -0800 Subject: [PATCH] swap sin and cos for demodulation The in-phase component should be multiplied by the sin value and the quadrature component should be multiplied by the cos value. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index d128357..a6559f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1019,9 +1019,9 @@ const APP: () = { // shift cos/sin before multiplying to avoid i64 multiplication signal.0 = - adc_samples[0][i] as i16 as i32 * shift_round(cos, 16); - signal.1 = adc_samples[0][i] as i16 as i32 * shift_round(sin, 16); + signal.1 = + adc_samples[0][i] as i16 as i32 * shift_round(cos, 16); signal.0 = iir_lockin.update(&mut iir_state_lockin[0], signal.0);