mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Add more parameter guards
This commit is contained in:
parent
df4a218ab4
commit
0dbba0500d
@ -283,10 +283,11 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
double default_tx_attenuation_db = -10.0;
|
||||
double default_manual_gain_rx1 = 64.0;
|
||||
double default_manual_gain_rx2 = 64.0;
|
||||
uint64_t default_bandwidth = 12500000;
|
||||
std::string default_rf_port_select("A_BALANCED");
|
||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 12500000);
|
||||
bandwidth_ = configuration->property(role + ".bandwidth", 12500000);
|
||||
bandwidth_ = configuration->property(role + ".bandwidth", default_bandwidth);
|
||||
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||
@ -297,6 +298,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
rf_port_select_ = configuration->property(role + ".rf_port_select", default_rf_port_select);
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
|
||||
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
|
||||
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000);
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - freq_dds_tx_hz_);
|
||||
@ -408,6 +410,15 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
|
||||
}
|
||||
}
|
||||
|
||||
if (bandwidth_ < 200000 or bandwidth_ > 56000000)
|
||||
{
|
||||
std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << std::endl;
|
||||
bandwidth_ = default_bandwidth;
|
||||
LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth;
|
||||
}
|
||||
|
||||
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
|
||||
try
|
||||
{
|
||||
|
@ -67,11 +67,19 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
rf_gain_rx2_ = configuration->property(role + ".gain_rx2", 64.0);
|
||||
rf_port_select_ = configuration->property(role + ".rf_port_select", std::string("A_BALANCED"));
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Auto"));
|
||||
}
|
||||
else
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
}
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", filter_file_);
|
||||
Fpass_ = configuration->property(role + ".Fpass", 0.0);
|
||||
Fstop_ = configuration->property(role + ".Fstop", 0.0);
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
@ -119,10 +127,6 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx2=" << default_gain_mode;
|
||||
}
|
||||
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = std::string("Auto");
|
||||
}
|
||||
if ((filter_source_ != "Off") and (filter_source_ != "Auto") and (filter_source_ != "File") and (filter_source_ != "Design"))
|
||||
{
|
||||
std::cout << "Configuration parameter filter_source should take one of these values:" << std::endl;
|
||||
@ -160,6 +164,15 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
}
|
||||
}
|
||||
|
||||
if (bandwidth_ < 200000 or bandwidth_ > 56000000)
|
||||
{
|
||||
std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value bandwidth=2000000" << std::endl;
|
||||
bandwidth_ = 2000000;
|
||||
LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=2000000";
|
||||
}
|
||||
|
||||
std::cout << "device address: " << uri_ << std::endl;
|
||||
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
|
||||
std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl;
|
||||
|
@ -56,7 +56,14 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
rf_gain_ = configuration->property(role + ".gain", 50.0);
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Auto"));
|
||||
}
|
||||
else
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
}
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", filter_file_);
|
||||
Fpass_ = configuration->property(role + ".Fpass", 0.0);
|
||||
Fstop_ = configuration->property(role + ".Fstop", 0.0);
|
||||
@ -65,11 +72,6 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = std::string("Auto");
|
||||
}
|
||||
|
||||
if (item_type_ != "gr_complex")
|
||||
{
|
||||
std::cout << "Configuration error: item_type must be gr_complex" << std::endl;
|
||||
@ -112,6 +114,15 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off";
|
||||
}
|
||||
|
||||
if (bandwidth_ < 200000 or bandwidth_ > 56000000)
|
||||
{
|
||||
std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz" << std::endl;
|
||||
std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values" << std::endl;
|
||||
std::cout << " This parameter has been set to its default value bandwidth=2000000" << std::endl;
|
||||
bandwidth_ = 2000000;
|
||||
LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=2000000";
|
||||
}
|
||||
|
||||
item_size_ = sizeof(gr_complex);
|
||||
|
||||
std::cout << "device address: " << uri_ << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user