kopia lustrzana https://github.com/OpenRTX/OpenRTX
Add syncword fuzzy detection
Frame decoder now tolerates bit error in syncword, removed syncword type detection in demodulator code. TG-81pull/68/head
rodzic
b998d3b78f
commit
c3c984d504
|
@ -145,7 +145,6 @@ private:
|
|||
uint16_t frame_index; ///< Index for filling the raw frame.
|
||||
frame_t *activeFrame; ///< Half frame, in demodulation.
|
||||
frame_t *idleFrame; ///< Half frame, free to be processed.
|
||||
bool isLSF; ///< Indicates that we demodualated an LSF.
|
||||
bool syncDetected; ///< A syncword was detected.
|
||||
bool locked; ///< A syncword was correctly demodulated.
|
||||
bool newFrame; ///< A new frame has been fully decoded.
|
||||
|
|
|
@ -271,11 +271,6 @@ const frame_t& M17Demodulator::getFrame()
|
|||
return *activeFrame;
|
||||
}
|
||||
|
||||
bool M17Demodulator::isFrameLSF()
|
||||
{
|
||||
return isLSF;
|
||||
}
|
||||
|
||||
bool M17::M17Demodulator::isLocked()
|
||||
{
|
||||
return locked;
|
||||
|
@ -324,7 +319,6 @@ bool M17Demodulator::update()
|
|||
if (syncword.index != -1) // Valid syncword found
|
||||
{
|
||||
syncDetected = true;
|
||||
isLSF = syncword.lsf;
|
||||
offset = syncword.index + 1;
|
||||
phase = 0;
|
||||
frame_index = 0;
|
||||
|
@ -402,7 +396,7 @@ bool M17Demodulator::update()
|
|||
lsf_syncword_bytes[1]);
|
||||
|
||||
// Too many errors in the syncword, lock is lost
|
||||
if ((hammingSync > 1) && (hammingLsf > 1))
|
||||
if ((hammingSync > 4) && (hammingLsf > 4))
|
||||
{
|
||||
syncDetected = false;
|
||||
locked = false;
|
||||
|
|
|
@ -65,7 +65,9 @@ M17FrameType M17FrameDecoder::decodeFrame(const frame_t& frame)
|
|||
}
|
||||
|
||||
// Stream data frame
|
||||
if(syncWord == STREAM_SYNC_WORD)
|
||||
uint8_t hd = __builtin_popcount(syncWord[0] ^ STREAM_SYNC_WORD[0])
|
||||
+ __builtin_popcount(syncWord[1] ^ STREAM_SYNC_WORD[1]);
|
||||
if(hd <= 4)
|
||||
{
|
||||
decodeStream(data);
|
||||
return M17FrameType::STREAM;
|
||||
|
|
Ładowanie…
Reference in New Issue