rx: fix header checksum verification
This commit is contained in:
parent
79d7f74dfc
commit
171a4a369c
|
@ -217,7 +217,8 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
||||||
modem_demodulate(rx->hdr_demod, mixed_sample, &sym_demod);
|
modem_demodulate(rx->hdr_demod, mixed_sample, &sym_demod);
|
||||||
|
|
||||||
float phase_error = modem_get_demodulator_phase_error(rx->hdr_demod);
|
float phase_error = modem_get_demodulator_phase_error(rx->hdr_demod);
|
||||||
//DEBUG_LOG("Sym: %d; Phase error: %f\n", sym_demod, phase_error);
|
DEBUG_LOG("Sym: %d; Phase error: %f %s\n", sym_demod, phase_error,
|
||||||
|
(fabs(phase_error) > 0.3) ? "!!!" : "");
|
||||||
|
|
||||||
|
|
||||||
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_HEADER);
|
update_nco_pll(rx->carrier_fine_nco, phase_error, PLL_BW_HEADER);
|
||||||
|
@ -243,8 +244,10 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
// CRC check
|
// CRC check
|
||||||
if(crc_check_key(LIQUID_CRC_8, header, HEADER_SIZE_BYTES-1) != LIQUID_OK) {
|
if(crc_check_key(LIQUID_CRC_8, header, HEADER_SIZE_BYTES) != LIQUID_OK) {
|
||||||
DEBUG_LOG("Header CRC check failed!\n");
|
uint8_t expected_crc = crc_generate_key(LIQUID_CRC_8, header, 4);
|
||||||
|
DEBUG_LOG("Header CRC check failed! Expected: 0x%02x, received: 0x%02x\n",
|
||||||
|
expected_crc, header[4]);
|
||||||
rx->state = RX_STATE_ACQUISITION;
|
rx->state = RX_STATE_ACQUISITION;
|
||||||
rx->callback(RX_EVT_HEADER_ERROR, NULL, 0);
|
rx->callback(RX_EVT_HEADER_ERROR, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue