From 86d994ad42a376ca22aa40cd0f583fe20388bbdd Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Thu, 10 Jan 2019 09:52:27 +0000 Subject: [PATCH] - reduced spurious detection of preamble git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@398 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- gr-jay/lib/preamble_sync_impl.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/gr-jay/lib/preamble_sync_impl.cc b/gr-jay/lib/preamble_sync_impl.cc index 2912c1c..9bfca19 100644 --- a/gr-jay/lib/preamble_sync_impl.cc +++ b/gr-jay/lib/preamble_sync_impl.cc @@ -81,6 +81,7 @@ int preamble_sync_impl::general_work (int noutput_items, gr_vector_int &ninput_i { m_state = PreambleSlow; m_wordCount = 0; + m_dataCount = 0; fprintf(stderr, "Reset\n"); } continue; @@ -107,8 +108,18 @@ int preamble_sync_impl::general_work (int noutput_items, gr_vector_int &ninput_i case PreambleSlow: if ((m_word & 0xFF) == 0xCC) { - m_wordSize = 1; - m_stateNext = SyncSlow; + m_wordSize = 8; + m_dataCount++; + if (m_dataCount == 8) + { + m_wordSize = 1; + m_stateNext = SyncSlow; + } + + } + else + { + m_dataCount = 0; } break; case SyncSlow: @@ -133,8 +144,17 @@ int preamble_sync_impl::general_work (int noutput_items, gr_vector_int &ninput_i if ((m_word & 0xFF) == 0xAA) { m_wordSize = 8; + m_dataCount++; + if (m_dataCount == 32) + { + m_wordSize = 8; + m_dataCount = 0; + m_stateNext = SyncFast; + } + } + else + { m_dataCount = 0; - m_stateNext = SyncFast; } break; case SyncFast: