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

Minor changes

This commit is contained in:
Antonio Ramos 2018-01-19 13:50:33 +01:00
parent 4873ea2b88
commit 7a2a02252a
2 changed files with 45 additions and 15 deletions

View File

@ -54,6 +54,8 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
filename_ = configuration->property(role + ".filename", default_filename); filename_ = configuration->property(role + ".filename", default_filename);
repeat_ = configuration->property(role + ".repeat", false); repeat_ = configuration->property(role + ".repeat", false);
dump_ = configuration->property(role + ".dump", false); dump_ = configuration->property(role + ".dump", false);
dump_test_ = configuration->property(role + ".dump_test", false);
endian_swap_ = configuration->property(role + ".endian", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
adc_bits_ = configuration->property(role + ".adc_bits", 4); adc_bits_ = configuration->property(role + ".adc_bits", 4);
@ -70,7 +72,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
{ {
null_sinks_.push_back(gr::blocks::null_sink::make(item_size_)); null_sinks_.push_back(gr::blocks::null_sink::make(item_size_));
} }
std::cout << "NUMBER OF NULL SINKS = " << null_sinks_.size() << std::endl; DLOG(INFO)<< "NUMBER OF NULL SINKS = " << null_sinks_.size();
} }
try try
{ {
@ -78,7 +80,6 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
file_source_->seek(bytes_seek / item_size_, SEEK_SET); file_source_->seek(bytes_seek / item_size_, SEEK_SET);
unpack_spir_ = make_unpack_spir_gss6450_samples(adc_bits_); unpack_spir_ = make_unpack_spir_gss6450_samples(adc_bits_);
deint_ = gr::blocks::deinterleave::make(item_size_); deint_ = gr::blocks::deinterleave::make(item_size_);
endian_ = gr::blocks::endian_swap::make(item_size_);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
@ -147,13 +148,20 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
if (dump_) if (dump_)
{ {
sink_ = gr::blocks::file_sink::make(sizeof(gr_complex), dump_filename_.c_str()); sink_ = gr::blocks::file_sink::make(sizeof(gr_complex), dump_filename_.c_str());
//sink_test = gr::blocks::file_sink::make(sizeof(int), "/home/aramos/Escritorio/test_int.dat");
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
} }
if (dump_test_)
{
sink_test = gr::blocks::file_sink::make(sizeof(int), (dump_filename_ + "int").c_str());
}
if (enable_throttle_control_) if (enable_throttle_control_)
{ {
throttle_ = gr::blocks::throttle::make(sizeof(gr_complex), sampling_frequency_); throttle_ = gr::blocks::throttle::make(sizeof(gr_complex), sampling_frequency_);
} }
if (endian_swap_)
{
endian_ = gr::blocks::endian_swap::make(item_size_);
}
DLOG(INFO) << "File source filename " << filename_; DLOG(INFO) << "File source filename " << filename_;
DLOG(INFO) << "Samples " << samples_; DLOG(INFO) << "Samples " << samples_;
DLOG(INFO) << "Sampling frequency " << sampling_frequency_; DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
@ -174,11 +182,15 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block)
if (samples_ > 0) if (samples_ > 0)
{ {
top_block->connect(file_source_, 0, deint_, 0); top_block->connect(file_source_, 0, deint_, 0);
/* if(endian_swap_)
top_block->connect(deint_, sel_ch_ - 1, endian_ ,0); {
top_block->connect(endian_, 0, unpack_spir_, 0); top_block->connect(deint_, sel_ch_ - 1, endian_ ,0);
*/ top_block->connect(endian_, 0, unpack_spir_, 0);
top_block->connect(deint_, sel_ch_ - 1, unpack_spir_, 0); }
else
{
top_block->connect(deint_, sel_ch_ - 1, unpack_spir_, 0);
}
if(n_channels_ > 1) if(n_channels_ > 1)
{ {
unsigned int aux = 0; unsigned int aux = 0;
@ -203,7 +215,11 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block)
if(dump_) if(dump_)
{ {
top_block->connect(valve_, 0, sink_, 0); top_block->connect(valve_, 0, sink_, 0);
//top_block->connect(deint_, sel_ch_ - 1, sink_test, 0); }
if(dump_test_)
{
if(endian_swap_) top_block->connect(endian_, 0, sink_test, 0);
else top_block->connect(deint_, sel_ch_ - 1, sink_test, 0);
} }
} }
else else
@ -218,7 +234,15 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block)
if (samples_ > 0) if (samples_ > 0)
{ {
top_block->disconnect(file_source_, 0, deint_, 0); top_block->disconnect(file_source_, 0, deint_, 0);
top_block->disconnect(deint_, sel_ch_ - 1, unpack_spir_, 0); if(endian_swap_)
{
top_block->disconnect(deint_, sel_ch_ - 1, endian_ ,0);
top_block->disconnect(endian_, 0, unpack_spir_, 0);
}
else
{
top_block->disconnect(deint_, sel_ch_ - 1, unpack_spir_, 0);
}
if(n_channels_ > 1) if(n_channels_ > 1)
{ {
unsigned int aux = 0; unsigned int aux = 0;
@ -241,10 +265,14 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block)
top_block->disconnect(unpack_spir_, 0, valve_, 0); top_block->disconnect(unpack_spir_, 0, valve_, 0);
} }
if(dump_) if(dump_)
{ {
top_block->disconnect(valve_, 0, sink_, 0); top_block->disconnect(valve_, 0, sink_, 0);
//top_block->disconnect(deint_, sel_ch_ - 1, sink_test, 0); }
} if(dump_test_)
{
if(endian_swap_) top_block->disconnect(endian_, 0, sink_test, 0);
else top_block->disconnect(deint_, sel_ch_ - 1, sink_test, 0);
}
} }
else else
{ {

View File

@ -111,8 +111,10 @@ private:
double sampling_frequency_; double sampling_frequency_;
std::string filename_; std::string filename_;
bool repeat_; bool repeat_;
bool dump_; bool dump_; //Enables dumping the gr_complex sample output
bool dump_test_; //Enables dumping the raw 32-bits deinterleaved (and endian swapped if enabled) words
bool enable_throttle_control_; bool enable_throttle_control_;
bool endian_swap_;
std::string dump_filename_; std::string dump_filename_;
std::string role_; std::string role_;
std::string item_type_; std::string item_type_;