diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index acbdc32ac..37a3ef99d 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -540,7 +540,7 @@ void radio::set_channel_rx_offset(uint32_t ch, int32_t offset_samples) return; } - rx_offset_n[ch] = offset_samples; + rx_offset_n[device_idx] = offset_samples; } void radio::set_tx_freq(const uint32_t& carrier_idx, const double& freq) diff --git a/srsue/hdr/phy/sync.h b/srsue/hdr/phy/sync.h index 6ed0e2ffa..417657806 100644 --- a/srsue/hdr/phy/sync.h +++ b/srsue/hdr/phy/sync.h @@ -201,7 +201,7 @@ private: srslte_ue_sync_t ue_sync = {}; // Object for synchronization secondary serving cells - std::vector > scell_sync; + std::map > scell_sync; // Buffer for primary and secondary cell samples const static uint32_t sync_nof_rx_subframes = 5; diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index 66adf1484..d0a60da32 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -107,7 +107,7 @@ void sync::init(srslte::radio_interface_phy* _radio, // Allocate Secondary serving cell synchronization for (uint32_t i = 1; i < worker_com->args->nof_carriers; i++) { // Give the logical channel - scell_sync.push_back(std::unique_ptr(new scell::sync(this, i * worker_com->args->nof_rx_ant))); + scell_sync[i] = std::unique_ptr(new scell::sync(this, i * worker_com->args->nof_rx_ant)); } reset(); @@ -388,7 +388,7 @@ void sync::run_camping_in_sync_state(sf_worker* worker, srslte::rf_buffer_t& syn // Run secondary serving cell synchronization for (auto& e : scell_sync) { - e->run(tti, sync_buffer.get(e->get_channel(), 0, worker_com->args->nof_rx_ant)); + e.second->run(tti, sync_buffer.get(e.first, 0, worker_com->args->nof_rx_ant)); } if (is_overflow) { @@ -940,27 +940,19 @@ void sync::meas_stop() void sync::scell_sync_set(uint32_t cc_idx, const srslte_cell_t& _cell) { - // Ignore if PCell - if (cc_idx == 0) { - return; - } - - // Decrement to match SCell index - cc_idx--; - // Ignore if out of range - if (cc_idx >= scell_sync.size()) { + if (scell_sync.count(cc_idx) == 0) { return; } // Set secondary serving cell - scell_sync[cc_idx]->set_cell(_cell); + scell_sync.at(cc_idx)->set_cell(_cell); } void sync::scell_sync_stop() { for (auto& e : scell_sync) { - e->stop(); + e.second->stop(); } }