From 9817896914863e4252752ea830275d3b2faa1086 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sun, 27 Feb 2022 21:25:33 +0100 Subject: [PATCH] rx: make receiver more robust --- impl/src/layer1/rx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/impl/src/layer1/rx.c b/impl/src/layer1/rx.c index ffe339f..f85c982 100644 --- a/impl/src/layer1/rx.c +++ b/impl/src/layer1/rx.c @@ -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; }