From e4693349cf862f8c609a0a7586b24d703486fff9 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 6 Mar 2020 11:54:33 +0100 Subject: Correlator seems to be working --- controller/fw/src/dsss_demod.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'controller/fw/src') diff --git a/controller/fw/src/dsss_demod.c b/controller/fw/src/dsss_demod.c index 7a2e0cc..7feb41b 100644 --- a/controller/fw/src/dsss_demod.c +++ b/controller/fw/src/dsss_demod.c @@ -32,6 +32,7 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) { //#define DEBUG_PRINT(...) ((void)0) //#define DEBUG_PRINTN(...) ((void)0) bool debug = sim_pos % DSSS_CORRELATION_LENGTH == DSSS_CORRELATION_LENGTH-1; + //bool debug = sim_pos > 1000; if (debug) DEBUG_PRINT("Iteration %zd", sim_pos); //const float peak_group_threshold = 0.05 * DSSS_CORRELATION_LENGTH; //const float hole_patching_threshold = 0.01 * DSSS_CORRELATION_LENGTH; @@ -42,12 +43,16 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) { /* use new, incremented wpos for gold_correlate_step as first element of old data in ring buffer */ for (size_t i=0; icorrelation[i][st->correlation_wpos] = gold_correlate_step(i, st->signal, st->signal_wpos, debug); + st->correlation[i][st->correlation_wpos] = gold_correlate_step(i, st->signal, st->signal_wpos, false); /* debug */ if (debug) { + DEBUG_PRINTN(" ["); + for (size_t i=0; icorrelation[i][st->correlation_wpos]); + DEBUG_PRINTN("%8.5f, ", st->correlation[i][st->correlation_wpos]); DEBUG_PRINTN("]\n"); } /* end */ @@ -57,24 +62,20 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) { for (size_t i=0; icorrelation[i], st->correlation_wpos); /* debug */ - /* - if (debug) DEBUG_PRINTN(" cwt: ["); + if (debug) DEBUG_PRINTN(" cwt: ["); for (size_t i=0; icwt_filter[i].st); /* debug */ - /* - DEBUG_PRINTN(" avg: ["); + if (debug) DEBUG_PRINTN(" avg: ["); for (size_t i=0; igroup.max; @@ -150,7 +151,7 @@ float cwt_convolve_step(const float v[DSSS_WAVELET_LUT_SIZE], size_t offx) { sum += v[(offx + j) % DSSS_WAVELET_LUT_SIZE] * dsss_cwt_wavelet_table[j]; //DEBUG_PRINT(" j=%d v=%f w=%f", j, v[(offx + j) % DSSS_WAVELET_LUT_SIZE], dsss_cwt_wavelet_table[j]); } - return sum / DSSS_WAVELET_LUT_SIZE; + return sum; } /* Compute last element of correlation for input [a] and hard-coded gold sequences. -- cgit