From bbf8587970d6bfd4ac2d0b9a7df238b80a441d98 Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Thu, 4 Jan 2018 12:16:12 +0100 Subject: [PATCH] Clean code --- .../gnuradio_blocks/pcps_acquisition_cc.cc | 3 - .../gnuradio_blocks/pcps_acquisition_cc.h | 1 - src/algorithms/channel/libs/channel_fsm.cc | 85 +------------------ src/algorithms/channel/libs/channel_fsm.h | 9 +- src/core/receiver/gnss_flowgraph.cc | 23 ----- 5 files changed, 4 insertions(+), 117 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index fdcd895b4..60ad2e82c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -329,7 +329,6 @@ int pcps_acquisition_cc::general_work(int noutput_items, d_input_power = 0.0; d_test_statistics = 0.0; d_state = 1; - LOG(INFO) << "ACQ. general_work changing to state 1 (active)"; } d_sample_counter += d_fft_size * ninput_items[0]; // sample counter @@ -369,9 +368,7 @@ int pcps_acquisition_cc::general_work(int noutput_items, if( d_blocking ) { - LOG(INFO) << "ACQ. general_work waiting for acquisition_core"; d_cond.wait( lk, [&]{ return !this->d_new_data_available; } ); - LOG(INFO) << "ACQ. Exiting general_work"; } } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h index 1c6162492..e33746f2b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h @@ -195,7 +195,6 @@ public: { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler d_active = active; - LOG(INFO) << "ACQ RESET"; } /*! diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index e5cb34493..75ac0e3da 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -1,11 +1,11 @@ /*! * \file channel_fsm.cc - * \brief Implementation of a State Machine for channel using boost::statechart - * \author Luis Esteve, 2011. luis(at)epsilon-formacion.com + * \brief Implementation of a State Machine for channel + * \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -33,83 +33,6 @@ #include #include "control_message_factory.h" -/* -struct Ev_channel_start_acquisition: sc::event -{}; - -struct Ev_channel_valid_acquisition: sc::event -{}; - -struct Ev_channel_failed_acquisition_repeat: sc::event -{}; - -struct Ev_channel_failed_acquisition_no_repeat: sc::event -{}; - -struct Ev_channel_failed_tracking_standby: sc::event -{}; -*/ - -/* -struct channel_idle_fsm_S0: public sc::state -{ -public: - // sc::transition(event, next state) - typedef sc::transition reactions; - channel_idle_fsm_S0(my_context ctx) : my_base(ctx){} - -}; - - -struct channel_acquiring_fsm_S1: public sc::state -{ -public: - typedef mpl::list, - sc::transition, - sc::transition > reactions; - - channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx) - { - context ().start_acquisition(); - } - ~channel_acquiring_fsm_S1(){} - -}; - - -struct channel_tracking_fsm_S2: public sc::state -{ -public: - typedef mpl::list, - sc::transition> reactions; - - channel_tracking_fsm_S2(my_context ctx) : my_base(ctx) - { - context ().start_tracking(); - } - - ~channel_tracking_fsm_S2() - { - context ().notify_stop_tracking(); - } - -}; - - -struct channel_waiting_fsm_S3: public sc::state -{ -public: - typedef sc::transition reactions; - - channel_waiting_fsm_S3(my_context ctx) : my_base(ctx) - { - context ().request_satellite(); - } - ~channel_waiting_fsm_S3(){} -}; -*/ - ChannelFsm::ChannelFsm() { @@ -136,7 +59,6 @@ void ChannelFsm::Event_start_acquisition() mx.lock(); d_state = 1; start_acquisition(); - LOG(INFO) << "FSM Event_start_acquisition"; DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition"; mx.unlock(); } @@ -203,7 +125,6 @@ void ChannelFsm::set_channel(unsigned int channel) void ChannelFsm::start_acquisition() { acq_->reset(); - LOG(INFO) << "FSM. start_acquisition()"; } void ChannelFsm::start_tracking() diff --git a/src/algorithms/channel/libs/channel_fsm.h b/src/algorithms/channel/libs/channel_fsm.h index 02be4f1fc..55068dc85 100644 --- a/src/algorithms/channel/libs/channel_fsm.h +++ b/src/algorithms/channel/libs/channel_fsm.h @@ -38,15 +38,8 @@ #include "tracking_interface.h" #include "telemetry_decoder_interface.h" -/* -struct channel_idle_fsm_S0; -struct channel_acquiring_fsm_S1; -struct channel_tracking_fsm_S2; -struct channel_waiting_fsm_S3; -*/ - /*! - * \brief This class implements a State Machine for channel using boost::statechart + * \brief This class implements a State Machine for channel */ class ChannelFsm { diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index ed47b1a3e..c63b56435 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -405,29 +405,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) } DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; } - /* - if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_)) - { - for (unsigned int i = 0; i < channels_count_; i++) - { - if (channels_state_[i] == 0) - { - channels_state_[i] = 1; - while (channels_.at(i)->get_signal().get_signal_str().compare(available_GNSS_signals_.front().get_signal_str()) != 0 ) - { - available_GNSS_signals_.push_back(available_GNSS_signals_.front()); - available_GNSS_signals_.pop_front(); - } - channels_.at(i)->set_signal(available_GNSS_signals_.front()); - available_GNSS_signals_.pop_front(); - acq_channels_count_++; - channels_.at(i)->start_acquisition(); - break; - } - DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; - } - } - */ break; case 2: