diff --git a/lib/burst_downmix_next_impl.cc b/lib/burst_downmix_next_impl.cc index 4076323..e22fc08 100644 --- a/lib/burst_downmix_next_impl.cc +++ b/lib/burst_downmix_next_impl.cc @@ -228,7 +228,10 @@ burst_downmix_next_impl::generate_sync_word(::iridium::direction direction) //std::vector uw_dl = { s0, s1, s1, s1, s1, s0, s0, s0, s1, s0, s0, s1 }; //std::vector uw_dl = { s0, s0, s0, s0, s0, s1, s1, s0, s1, s1, s0, s1 s0, s1, s0, s1, s1, s0, s0, s1, s0, s1, s1, s1, s1, s0, s1, s1, s1, s0, s1, s0, s0}; std::vector uw_dl = { s1, s1, s0, s1, s1, s0, s1, s0, s1, s0, s1, s1 };//, s0, s0, s1, s0, s1, s1, s1, s1, s0, s1, s1, s1, s0, s1, s0, s0}; - std::vector uw_ul = { s1, s1, s0, s0, s0, s1, s0, s0, s1, s0, s1, s1 }; + // 101 000 111 001 10001001 + //std::vector uw_ul = { s1, s0, s1, s0, s0, s0, s1, s1, s1, s0, s0, s1 }; + // 01 00 00 00 10 10 00 11 10 01 10001001 + std::vector uw_ul = { s0, s1, s0, s0, s0, s0, s0, s0, s1, s0, s1, s0 }; int i; if (direction == ::iridium::direction::DOWNLINK) { @@ -653,7 +656,7 @@ int burst_downmix_next_impl::process_next_frame(float sample_rate, float correction; ::iridium::direction direction; - if (max_dl > max_ul || 1) { + if (max_dl > max_ul) { direction = ::iridium::direction::DOWNLINK; corr_offset = corr_offset_dl; correction = correction_dl; diff --git a/lib/iridium.h b/lib/iridium.h index b9c3e9d..85eac8a 100644 --- a/lib/iridium.h +++ b/lib/iridium.h @@ -6,6 +6,7 @@ enum class direction { DOWNLINK = 1, UPLINK = 2, DOWNLINK_NEXT = 3, + UPLINK_NEXT = 4, }; const int SYMBOLS_PER_SECOND = 25000; @@ -28,4 +29,8 @@ const int UW_UL[] = { 2, 2, 0, 0, 0, 2, 0, 0, 2, 0, 2, 2 }; // std::vector uw_dl = { s1, s1, s0, s1, s1, s0, s1, s0, s1, s0, s1, s1 };//, s0, s0, s1, s0, s1, s1, s1, s1, s0, s1, s1, s1, s0, s1, s0, s0}; const int UW_DL_NEXT[] = { 2, 2, 0, 2, 2, 0, 2, 0, 2, 0, 2, 2 }; +// std::vector uw_ul = { s1, s0, s1, s0, s0, s0, s1, s1, s1, s0, s0, s1 }; +//const int UW_UL_NEXT[] = { 2, 0, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2 }; +// std::vector uw_ul = { s0, s1, s0, s0, s0, s0, s0, s0, s1, s0, s1, s0 }; +const int UW_UL_NEXT[] = { 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0 }; } // namespace iridium diff --git a/lib/iridium_qpsk_demod_impl.cc b/lib/iridium_qpsk_demod_impl.cc index 882c13a..673f4a2 100644 --- a/lib/iridium_qpsk_demod_impl.cc +++ b/lib/iridium_qpsk_demod_impl.cc @@ -306,6 +306,11 @@ bool iridium_qpsk_demod_impl::check_sync_word(int* demodulated_burst, uw_len = sizeof(::iridium::UW_DL) / sizeof(*::iridium::UW_DL); } + if (direction == ::iridium::direction::UPLINK_NEXT) { + uw = ::iridium::UW_UL_NEXT; + uw_len = sizeof(::iridium::UW_UL_NEXT) / sizeof(*::iridium::UW_UL_NEXT); + } + int diffs = 0; for (int i = 0; i < uw_len; i++) { int diff = abs(demodulated_burst[i] - uw[i]); @@ -390,9 +395,11 @@ void iridium_qpsk_demod_impl::handler(int channel, pmt::pmt_t msg) check_sync_word(d_demodulated_burst, n_symbols, ::iridium::direction::UPLINK); bool dl_next_uw_ok = check_sync_word(d_demodulated_burst, n_symbols, ::iridium::direction::DOWNLINK_NEXT); + bool ul_next_uw_ok = + check_sync_word(d_demodulated_burst, n_symbols, ::iridium::direction::UPLINK_NEXT); d_n_handled_bursts++; - if (!dl_uw_ok && !ul_uw_ok && !dl_next_uw_ok) { + if (!dl_uw_ok && !ul_uw_ok && !dl_next_uw_ok && !ul_next_uw_ok) { // Drop frames which have no valid sync word return; }