1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Fixes for the new signature, fix bugprone-* warnings, fix typo in block factory

This commit is contained in:
Carles Fernandez 2020-07-11 13:06:32 +02:00
parent 0883e13a51
commit 200a5b8cd4
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 22 additions and 32 deletions

View File

@ -54,7 +54,7 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
@ -67,7 +67,7 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac
}
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0F : 1.0F));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -196,11 +196,7 @@ void GalileoE5bPcpsAcquisition::set_state(int state)
void GalileoE5bPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if ((item_type_ == "gr_complex") || (item_type_ == "cshort"))
{
// nothing to connect
}
@ -213,11 +209,7 @@ void GalileoE5bPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute
void GalileoE5bPcpsAcquisition::disconnect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if ((item_type_ == "gr_complex") || (item_type_ == "cshort"))
{
// nothing to disconnect
}

View File

@ -33,7 +33,7 @@
#include <cmath> // for abs, pow, floor
#include <complex> // for complex
GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -41,32 +41,31 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "../data/acquisition.dat";
DLOG(INFO) << "Role " << role;
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 1);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
acq_pilot_ = configuration->property(role + ".acquire_pilot", false);
acq_iq_ = configuration->property(role + ".acquire_iq", false);
if (acq_iq_)
{
acq_pilot_ = false;
@ -76,12 +75,12 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
@ -163,12 +162,12 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;

View File

@ -42,7 +42,7 @@ public:
/*!
* \brief Constructor
*/
GalileoE5bPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -192,7 +192,6 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
std::string item_type_;
std::string dump_filename_;

View File

@ -1749,7 +1749,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
#if ENABLE_FPGA
else if (implementation == "Galileo_E5b_PCPS_Acquisition_FPGA")
{
std::unique_ptr<GNSSBlockInterface> block = std::make_unique<GalileoE5bPcpsAcquisitionFpga>(configuration, role, in_streams,
std::unique_ptr<GNSSBlockInterface> block_ = std::make_unique<GalileoE5bPcpsAcquisitionFpga>(configuration, role, in_streams,
out_streams);
block = std::move(block_);
}