From abfe237d23d34462a24c46878b73eabc9d15e726 Mon Sep 17 00:00:00 2001 From: TT Date: Fri, 27 Jan 2017 00:11:24 +0900 Subject: [PATCH] fix correlation detection --- dsp.c | 12 ++++++------ main.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dsp.c b/dsp.c index b73d42d..42dae33 100644 --- a/dsp.c +++ b/dsp.c @@ -65,10 +65,10 @@ dsp_process(int16_t *capture, size_t length) samp_buf[i] = smp; int32_t s = sincos_tbl[i][0]; int32_t c = sincos_tbl[i][1]; - samp_s += smp * s / 64; - samp_c += smp * c / 64; - ref_s += ref * s / 64; - ref_c += ref * c / 64; + samp_s += smp * s / 16; + samp_c += smp * c / 16; + ref_s += ref * s / 16; + ref_c += ref * c / 16; #if 0 uint32_t sc = *(uint32_t)&sincos_tbl[i]; samp_s = __SMLABB(sr, sc, samp_s); @@ -91,8 +91,8 @@ calculate_gamma(float gamma[2]) float rr = rs * rs + rc * rc; float ss = acc_samp_s; float sc = acc_samp_c; - gamma[0] = (sc * rc + ss * rs) / rr; - gamma[1] = (sc * rs - sc * rc) / rr; + gamma[0] = (sc * rc + ss * rs) / rr; + gamma[1] = (ss * rc - sc * rs) / rr; } void diff --git a/main.c b/main.c index 7b7e5d5..8555e8b 100644 --- a/main.c +++ b/main.c @@ -452,7 +452,7 @@ void sweep(void) rewind: frequency_updated = FALSE; - delay = 5; + delay = 3; for (i = 0; i < sweep_points; i++) { set_frequency(frequencies[i]);