kopia lustrzana https://github.com/OpenRTX/OpenRTX
Changed M17 RX behaviour so that received stream data is forwarded to codec2 decode only when a full valid LSF is received.
rodzic
54af6bf429
commit
9c2091c060
|
@ -122,7 +122,7 @@ public:
|
|||
* @return true if CRC of LSF data matches the one stored in the LSF itself,
|
||||
* false otherwise.
|
||||
*/
|
||||
bool valid();
|
||||
bool valid() const;
|
||||
|
||||
/**
|
||||
* Get underlying data.
|
||||
|
@ -150,7 +150,7 @@ private:
|
|||
* \param len: lenght of the data block, in bytes.
|
||||
* \return computed CRC16 over the data block.
|
||||
*/
|
||||
uint16_t crc16(const void *data, const size_t len);
|
||||
uint16_t crc16(const void *data, const size_t len) const;
|
||||
|
||||
|
||||
struct __attribute__((packed))
|
||||
|
|
|
@ -88,7 +88,7 @@ void M17LinkSetupFrame::updateCrc()
|
|||
data.crc = __builtin_bswap16(crc);
|
||||
}
|
||||
|
||||
bool M17LinkSetupFrame::valid()
|
||||
bool M17LinkSetupFrame::valid() const
|
||||
{
|
||||
uint16_t crc = crc16(&data, 28);
|
||||
if(data.crc == __builtin_bswap16(crc)) return true;
|
||||
|
@ -138,7 +138,7 @@ lich_t M17LinkSetupFrame::generateLichSegment(const uint8_t segmentNum)
|
|||
return result;
|
||||
}
|
||||
|
||||
uint16_t M17LinkSetupFrame::crc16(const void *data, const size_t len)
|
||||
uint16_t M17LinkSetupFrame::crc16(const void *data, const size_t len) const
|
||||
{
|
||||
const uint8_t *ptr = reinterpret_cast< const uint8_t *>(data);
|
||||
uint16_t crc = 0xFFFF;
|
||||
|
|
|
@ -163,8 +163,9 @@ void OpMode_M17::rxState(rtxStatus_t *const status)
|
|||
{
|
||||
auto& frame = demodulator.getFrame();
|
||||
auto type = decoder.decodeFrame(frame);
|
||||
bool lsfOk = decoder.getLsf().valid();
|
||||
|
||||
if(type == M17FrameType::STREAM)
|
||||
if((type == M17FrameType::STREAM) && (lsfOk == true))
|
||||
{
|
||||
M17StreamFrame sf = decoder.getStreamFrame();
|
||||
codec_pushFrame(sf.payload().data(), false);
|
||||
|
|
Ładowanie…
Reference in New Issue