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: