1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Miscelaneous code improvements

This commit is contained in:
Carles Fernandez 2018-12-04 13:20:49 +01:00
parent bdb912e9da
commit 7261bec2ad
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
21 changed files with 44 additions and 90 deletions

View File

@ -338,7 +338,7 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -323,7 +323,7 @@ gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -322,7 +322,7 @@ gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -311,7 +311,7 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -325,7 +325,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -313,7 +313,7 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_left_block()
{ {
return acquisition_; return acquisition_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }

View File

@ -274,10 +274,7 @@ bool pcps_acquisition::is_fdma()
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
return true; return true;
} }
else return false;
{
return false;
}
} }

View File

@ -287,7 +287,7 @@ gr::basic_block_sptr FirFilter::get_left_block()
{ {
return cshort_to_float_x2_; return cshort_to_float_x2_;
} }
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{ {
return cbyte_to_float_x2_; return cbyte_to_float_x2_;
} }
@ -317,7 +317,7 @@ gr::basic_block_sptr FirFilter::get_right_block()
{ {
return short_x2_to_cshort_; return short_x2_to_cshort_;
} }
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex")) if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
{ {
return float_to_complex_; return float_to_complex_;
} }

View File

@ -327,7 +327,7 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
{ {
return freq_xlating_fir_filter_fcf_; return freq_xlating_fir_filter_fcf_;
} }
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{ {
return freq_xlating_fir_filter_scf_; return freq_xlating_fir_filter_scf_;
} }
@ -361,7 +361,7 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_right_block()
{ {
return freq_xlating_fir_filter_fcf_; return freq_xlating_fir_filter_fcf_;
} }
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex")) if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
{ {
return freq_xlating_fir_filter_scf_; return freq_xlating_fir_filter_scf_;
} }

View File

@ -160,11 +160,8 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block()
} }
return pulse_blanking_cc_; return pulse_blanking_cc_;
} }
else LOG(ERROR) << " Unknown input filter input/output item type conversion";
{ return nullptr;
LOG(ERROR) << " Unknown input filter input/output item type conversion";
return nullptr;
}
} }

View File

@ -69,7 +69,7 @@ DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter,
static bool ValidateC(const char* flagname, const std::string& value) static bool ValidateC(const char* flagname, const std::string& value)
{ {
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok if (boost::filesystem::exists(value) or value == "-") // value is ok
return true; return true;
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl; std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl; std::cout << "GNSS-SDR program ended." << std::endl;
@ -78,7 +78,7 @@ static bool ValidateC(const char* flagname, const std::string& value)
static bool ValidateConfigFile(const char* flagname, const std::string& value) static bool ValidateConfigFile(const char* flagname, const std::string& value)
{ {
if (boost::filesystem::exists(value) or value.compare(std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) == 0) // value is ok if (boost::filesystem::exists(value) or value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) // value is ok
return true; return true;
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl; std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl; std::cout << "GNSS-SDR program ended." << std::endl;
@ -87,7 +87,7 @@ static bool ValidateConfigFile(const char* flagname, const std::string& value)
static bool ValidateS(const char* flagname, const std::string& value) static bool ValidateS(const char* flagname, const std::string& value)
{ {
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok if (boost::filesystem::exists(value) or value == "-") // value is ok
return true; return true;
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl; std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl; std::cout << "GNSS-SDR program ended." << std::endl;
@ -96,7 +96,7 @@ static bool ValidateS(const char* flagname, const std::string& value)
static bool ValidateSignalSource(const char* flagname, const std::string& value) static bool ValidateSignalSource(const char* flagname, const std::string& value)
{ {
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok if (boost::filesystem::exists(value) or value == "-") // value is ok
return true; return true;
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl; std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl; std::cout << "GNSS-SDR program ended." << std::endl;

View File

@ -153,7 +153,7 @@ gr::basic_block_sptr Pass_Through::get_left_block()
{ {
return conjugate_sc_; return conjugate_sc_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return conjugate_ic_; return conjugate_ic_;
} }
@ -180,7 +180,7 @@ gr::basic_block_sptr Pass_Through::get_right_block()
{ {
return conjugate_sc_; return conjugate_sc_;
} }
else if (item_type_ == "cbyte") if (item_type_ == "cbyte")
{ {
return conjugate_ic_; return conjugate_ic_;
} }

View File

@ -411,18 +411,11 @@ bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
} }
return false; return false;
} }
else // std::cout << "ALERT: Channel " << ch << " interp buff idx " << nearest_element
{ // << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
// std::cout << "ALERT: Channel " << ch << " interp buff idx " << nearest_element // usleep(1000);
// << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
// usleep(1000);
return false;
}
}
else
{
return false;
} }
return false;
} }

View File

@ -224,11 +224,8 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_left_block()
{ {
return tracking_sc; return tracking_sc;
} }
else LOG(WARNING) << item_type_ << " unknown tracking item type";
{ return nullptr;
LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr;
}
} }
@ -242,9 +239,8 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block()
{ {
return tracking_sc; return tracking_sc;
} }
else
{
LOG(WARNING) << item_type_ << " unknown tracking item type"; LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr; return nullptr;
}
} }

View File

@ -222,11 +222,8 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_left_block()
{ {
return tracking_sc; return tracking_sc;
} }
else LOG(WARNING) << item_type_ << " unknown tracking item type";
{ return nullptr;
LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr;
}
} }
@ -240,9 +237,6 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block()
{ {
return tracking_sc; return tracking_sc;
} }
else LOG(WARNING) << item_type_ << " unknown tracking item type";
{ return nullptr;
LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr;
}
} }

View File

@ -218,11 +218,8 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_left_block()
{ {
return tracking_sc; return tracking_sc;
} }
else LOG(WARNING) << item_type_ << " unknown tracking item type";
{ return nullptr;
LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr;
}
} }
gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block() gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block()
@ -235,9 +232,6 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block()
{ {
return tracking_sc; return tracking_sc;
} }
else LOG(WARNING) << item_type_ << " unknown tracking item type";
{ return nullptr;
LOG(WARNING) << item_type_ << " unknown tracking item type";
return nullptr;
}
} }

View File

@ -496,12 +496,8 @@ bool Galileo_Fnav_Message::have_new_ephemeris() // Check if we have a new ephem
std::cout << "Batch number: " << IOD_ephemeris << std::endl; std::cout << "Batch number: " << IOD_ephemeris << std::endl;
return true; return true;
} }
return false;
}
else
{
return false;
} }
return false;
} }

View File

@ -439,12 +439,8 @@ bool Galileo_Navigation_Message::have_new_ephemeris() // Check if we have a new
std::cout << "Batch number: " << IOD_ephemeris << std::endl; std::cout << "Batch number: " << IOD_ephemeris << std::endl;
return true; return true;
} }
return false;
} }
else return false;
return false;
} }

View File

@ -204,11 +204,9 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
{ {
return true; return true;
} }
else
// All other conditions are assumed errors. TODO: Add correction for case B // All other conditions are assumed errors. TODO: Add correction for case B
{ return false;
return false;
}
} }

View File

@ -337,12 +337,8 @@ bool Gps_CNAV_Navigation_Message::have_new_ephemeris() // Check if we have a ne
b_flag_ephemeris_2 = false; // clear the flag b_flag_ephemeris_2 = false; // clear the flag
return true; return true;
} }
return false;
}
else
{
return false;
} }
return false;
} }

View File

@ -255,10 +255,7 @@ bool FrontEndCal::get_ephemeris()
} }
return false; return false;
} }
else return true;
{
return true;
}
} }
else else
{ {