DSSS sequence matcher works
This commit is contained in:
parent
000ced2b54
commit
5997a24fcb
1 changed files with 2 additions and 19 deletions
|
|
@ -58,12 +58,6 @@ void dsss_demod_init(struct dsss_demod_state *st) {
|
||||||
|
|
||||||
#ifdef SIMULATION
|
#ifdef SIMULATION
|
||||||
void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts, int record_channel) {
|
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
|
#else
|
||||||
void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
|
void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
|
||||||
#endif
|
#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++)
|
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);
|
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]);
|
st->correlation_wpos = (st->correlation_wpos + 1) % ARRAY_LENGTH(st->correlation[0]);
|
||||||
|
|
||||||
float cwt[DSSS_GOLD_CODE_COUNT];
|
float cwt[DSSS_GOLD_CODE_COUNT];
|
||||||
|
|
@ -127,9 +118,6 @@ void dsss_demod_step(struct dsss_demod_state *st, float new_value) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* A group ended. Process result. */
|
/* 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);
|
group_received(st, ts);
|
||||||
|
|
||||||
/* reset grouping state */
|
/* 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;
|
(1.0f - score_depreciation) * states[i].candidate_score;
|
||||||
states[i].candidate_score = 0.0f;
|
states[i].candidate_score = 0.0f;
|
||||||
states[i].last_skips += states[i].candidate_skips;
|
states[i].last_skips += states[i].candidate_skips;
|
||||||
DEBUG_PRINT("skips %d", states[i].last_skips);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (states[i].last_skips > max_skips) {
|
if (states[i].last_skips > max_skips) {
|
||||||
states[i].last_phase = -1; / invalidate entry /
|
states[i].last_phase = -1; /* invalidate entry */
|
||||||
|
|
||||||
} else
|
} else if (states[i].data_pos == TRANSMISSION_SYMBOLS) {
|
||||||
*/
|
|
||||||
if (states[i].data_pos == TRANSMISSION_SYMBOLS) {
|
|
||||||
/* Frame received completely */
|
/* 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);
|
handle_dsss_received(states[i].data);
|
||||||
states[i].last_phase = -1; /* invalidate entry */
|
states[i].last_phase = -1; /* invalidate entry */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue