layer1/rx: calculate EVM during header and data reception
This commit is contained in:
parent
c61a7a7cf7
commit
eb802629a1
|
@ -265,6 +265,8 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
static float complex samples2dump_s[8192];
|
||||
static size_t nsamples2dump_s = 0;
|
||||
|
||||
static float evm;
|
||||
|
||||
// cache configuration flags
|
||||
bool is_central_node = options_is_flag_set(OPTIONS_FLAG_IS_CENTRAL_NODE);
|
||||
|
||||
|
@ -344,6 +346,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
// go on with decoding the header
|
||||
rx->state = RX_STATE_HEADER;
|
||||
symbol_counter = 0;
|
||||
evm = 0.0f;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -361,6 +364,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
LOG(LVL_DUMP, "@%zu: Sym: %d; Phase error: %f %s", rx->sample_index, sym_demod, phase_error,
|
||||
(fabs(phase_error) > 0.3) ? "!!!" : "");
|
||||
|
||||
evm += modem_get_demodulator_evm(rx->hdr_demod);
|
||||
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_HEADER);
|
||||
|
||||
|
@ -378,7 +382,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
// store debug info about the header
|
||||
rx->packet_debug_info.noise_floor_level = rx->noise_floor_level;
|
||||
rx->packet_debug_info.header_rssi = agc_crcf_get_rssi(rx->agc);
|
||||
rx->packet_debug_info.header_evm = -1e38f; // FIXME
|
||||
rx->packet_debug_info.header_evm = evm / symbol_counter;
|
||||
|
||||
ERR_CHECK_LIQUID(liquid_repack_bytes(
|
||||
symbols_int, modem_get_bps(rx->hdr_demod), rx->hdr_len_symbols,
|
||||
|
@ -433,6 +437,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
|
||||
rx->state = RX_STATE_DATA;
|
||||
symbol_counter = 0;
|
||||
evm = 0.0f;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -453,6 +458,8 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
float phase_error = modem_get_demodulator_phase_error(rx->payload_demod);
|
||||
//LOG(LVL_DEBUG, "@%zu: Sym: %d; Phase error: %f", rx->sample_index, sym_demod, phase_error);
|
||||
|
||||
evm += modem_get_demodulator_evm(rx->payload_demod);
|
||||
|
||||
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_DATA);
|
||||
|
||||
symbols_int[symbol_counter] = sym_demod;
|
||||
|
@ -471,7 +478,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
|
||||
// store debug info about the data
|
||||
rx->packet_debug_info.data_rssi = agc_crcf_get_rssi(rx->agc);
|
||||
rx->packet_debug_info.data_evm = -1e38f; // FIXME
|
||||
rx->packet_debug_info.data_evm = evm / symbol_counter;
|
||||
|
||||
// deinterleave the message symbols
|
||||
uint8_t symbols_int_deinterleaved[rx->payload_len_symbols];
|
||||
|
|
Loading…
Reference in a new issue