DSSS sequence matcher works

This commit is contained in:
jaseg 2020-03-09 13:53:56 +01:00
parent 000ced2b54
commit 5997a24fcb

View file

@ -58,12 +58,6 @@ void dsss_demod_init(struct dsss_demod_state *st) {
#ifdef SIMULATION
void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts, int record_channel) {
//bool debug = false;
bool debug = (record_channel == -1)
&& (ts > 1000)
&& (ts % DSSS_CORRELATION_LENGTH == DSSS_CORRELATION_LENGTH-1);
if (debug) DEBUG_PRINT("Iteration %zd: signal=%f", ts, new_value);
#else
void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
#endif
@ -77,9 +71,6 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
for (size_t i=0; i<DSSS_GOLD_CODE_COUNT; i++)
st->correlation[i][st->correlation_wpos] = gold_correlate_step(i, st->signal, st->signal_wpos, false);
debug_print_vector("correlation",
DSSS_GOLD_CODE_COUNT, &st->correlation[0][st->correlation_wpos], DSSS_WAVELET_LUT_SIZE, true, debug);
st->correlation_wpos = (st->correlation_wpos + 1) % ARRAY_LENGTH(st->correlation[0]);
float cwt[DSSS_GOLD_CODE_COUNT];
@ -127,9 +118,6 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
return;
/* A group ended. Process result. */
if (record_channel == -1)
DEBUG_PRINT("GROUP FOUND: %8d len=%3d max=%f ch=%d offx=%d",
ts, st->group.len, st->group.max, st->group.max_ch, st->group.max_ts);
group_received(st, ts);
/* reset grouping state */
@ -195,17 +183,12 @@ void matcher_tick(struct matcher_state states[static DSSS_MATCHER_CACHE_SIZE], u
(1.0f - score_depreciation) * states[i].candidate_score;
states[i].candidate_score = 0.0f;
states[i].last_skips += states[i].candidate_skips;
DEBUG_PRINT("skips %d", states[i].last_skips);
/*
if (states[i].last_skips > max_skips) {
states[i].last_phase = -1; / invalidate entry /
states[i].last_phase = -1; /* invalidate entry */
} else
*/
if (states[i].data_pos == TRANSMISSION_SYMBOLS) {
} else if (states[i].data_pos == TRANSMISSION_SYMBOLS) {
/* Frame received completely */
DEBUG_PRINT("match on index %d phase %d score %.5f", i, states[i].last_phase, states[i].last_score);
handle_dsss_received(states[i].data);
states[i].last_phase = -1; /* invalidate entry */
}