diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 83ad6807a..c8a59e106 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -763,10 +763,35 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { std::lock_guard lock(signal_list_mutex); available_GNSS_signals_.push_back(channels_[who]->get_signal()); - channels_[who]->set_signal(search_next_signal(channels_[who]->get_signal().get_signal_str(), true)); } - DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); - channels_[who]->start_acquisition(); + channels_state_[who] = 0; + acq_channels_count_--; + for (unsigned int i = 0; i < channels_count_; i++) + { + unsigned int ii = (i + 1) % channels_count_; + unsigned int sat_ = 0; + try + { + sat_ = configuration_->property("Channel" + std::to_string(ii) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } + if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[ii] == 0)) + { + channels_state_[ii] = 1; + if (sat_ == 0) + { + std::lock_guard lock(signal_list_mutex); + channels_[ii]->set_signal(search_next_signal(channels_[ii]->get_signal().get_signal_str(), true)); + } + acq_channels_count_++; + DLOG(INFO) << "Channel " << ii << " Starting acquisition " << channels_[ii]->get_signal().get_satellite() << ", Signal " << channels_[ii]->get_signal().get_signal_str(); + channels_[ii]->start_acquisition(); + } + DLOG(INFO) << "Channel " << ii << " in state " << channels_state_[ii]; + } break; case 1: