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