rx: make receiver more robust

This commit is contained in:
Thomas Kolb 2022-02-27 21:25:33 +01:00
parent 934b18e382
commit 9817896914

View file

@ -13,7 +13,7 @@
#define HEADER_SIZE_BYTES 4
#define FREQ_EST_L 8
#define AGC_BW_ACQUISITION 2e-2
#define AGC_BW_ACQUISITION 5e-2
#define AGC_BW_TRACKING 1e-4
#define SHOW_DEBUG_LOG 0
@ -42,7 +42,7 @@ static bool acquire_preamble(layer1_rx_t *rx, const float complex sample)
// preamble search
float complex corr_out = correlator_step(&rx->preamble_correlator, sample);
if(cabsf(corr_out) > 0.5f * preamble_get_symbol_count()) {
if(cabsf(corr_out) > 0.9f * preamble_get_symbol_count()) {
// Preamble found!
DEBUG_LOG("Preamble found: %.3f > %.3f\n", cabsf(corr_out), 0.5f * preamble_get_symbol_count());
@ -128,6 +128,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
// Preamble found and frequency corrected!
rx->callback(RX_EVT_PREAMBLE_FOUND, NULL, 0);
// switch AGC to tracking mode
agc_crcf_set_bandwidth(rx->agc, AGC_BW_TRACKING);
// go on with decoding the header
@ -168,6 +169,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
// check the received information
if(!MODCOD_IS_VALID(rx->modcod)) {
DEBUG_LOG("Decoded MODCOD %d is invalid!\n", rx->modcod);
rx->state = RX_STATE_ACQUISITION;
break;
}