mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-07 06:30:11 +00:00
Improve LimeSDR PPS capability detection
This commit is contained in:
parent
e33a5d2dac
commit
c41ea05137
@ -152,6 +152,9 @@ if(GRLIMESDR_FOUND AND NOT TARGET Gnuradio::limesdr)
|
|||||||
if("static sptr make(std::string serial, int channel_mode, const std::string& filename);" STREQUAL "${_file_line}")
|
if("static sptr make(std::string serial, int channel_mode, const std::string& filename);" STREQUAL "${_file_line}")
|
||||||
set(_g38_branch FALSE)
|
set(_g38_branch FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
if("make(std::string serial, int channel_mode, const std::string& filename, bool enable_PPS_mode);" STREQUAL "${_file_line}")
|
||||||
|
set(_g38_branch FALSE)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if(${_g38_branch})
|
if(${_g38_branch})
|
||||||
set(GR_LIMESDR_IS_G38_BRANCH TRUE)
|
set(GR_LIMESDR_IS_G38_BRANCH TRUE)
|
||||||
|
@ -26,10 +26,13 @@
|
|||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configuration,
|
LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configuration,
|
||||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
const std::string& role,
|
||||||
|
unsigned int in_stream,
|
||||||
|
unsigned int out_stream,
|
||||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||||
: SignalSourceBase(configuration, role, "Limesdr_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
: SignalSourceBase(configuration, role, "Limesdr_Signal_Source"s),
|
||||||
|
in_stream_(in_stream),
|
||||||
|
out_stream_(out_stream)
|
||||||
{
|
{
|
||||||
// DUMP PARAMETERS
|
// DUMP PARAMETERS
|
||||||
const std::string empty;
|
const std::string empty;
|
||||||
@ -37,8 +40,7 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
const std::string default_item_type("gr_complex");
|
const std::string default_item_type("gr_complex");
|
||||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||||
dump_ = configuration->property(role + ".dump", false);
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
default_dump_file);
|
|
||||||
|
|
||||||
// Driver parameters
|
// Driver parameters
|
||||||
channel_ = configuration->property(role + ".channel", 0);
|
channel_ = configuration->property(role + ".channel", 0);
|
||||||
@ -58,9 +60,7 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
limechannel_mode_ = configuration->property(role + ".limechannel_mode", 0);
|
limechannel_mode_ = configuration->property(role + ".limechannel_mode", 0);
|
||||||
if ((limechannel_mode_ < 0) || (limechannel_mode_ > 2))
|
if ((limechannel_mode_ < 0) || (limechannel_mode_ > 2))
|
||||||
{
|
{
|
||||||
std::cout
|
std::cerr << "ERROR: source_impl::source_impl(): ChannelMode must be A(0), B(1) or (A+B) MIMO(2)\n";
|
||||||
<< "ERROR: source_impl::source_impl(): ChannelMode must be A(0), B(1) or (A+B) MIMO(2)"
|
|
||||||
<< std::endl;
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,10 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
// 1. Make the driver instance
|
// 1. Make the driver instance
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#ifdef LimeSDR_PPS
|
#ifdef LimeSDR_PPS
|
||||||
|
#ifdef GR_LIMESDR_IS_G38_BRANCH
|
||||||
#ifdef GR_GREATER_38
|
|
||||||
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false, PPS_mode_);
|
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false, PPS_mode_);
|
||||||
#else
|
#else
|
||||||
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, PPS_mode_);
|
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, PPS_mode_);
|
||||||
@ -97,15 +95,13 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
{
|
{
|
||||||
limesdr_source_->disable_ext_clk();
|
limesdr_source_->disable_ext_clk();
|
||||||
}
|
}
|
||||||
#else
|
#else // LimeSDR_PPS
|
||||||
|
|
||||||
#ifdef GR_LIMESDR_IS_G38_BRANCH
|
#ifdef GR_LIMESDR_IS_G38_BRANCH
|
||||||
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false);
|
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false);
|
||||||
#else
|
#else
|
||||||
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_);
|
limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_);
|
||||||
#endif
|
#endif
|
||||||
|
#endif // LimeSDR_PPS
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch (const boost::exception& e)
|
catch (const boost::exception& e)
|
||||||
{
|
{
|
||||||
@ -126,7 +122,7 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
std::cout << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_ << '\n';
|
std::cout << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_ << '\n';
|
||||||
LOG(INFO) << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_;
|
LOG(INFO) << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_;
|
||||||
|
|
||||||
// 2 set sampling rate
|
// 2. set sampling rate
|
||||||
double actual_sample_rate = limesdr_source_->set_sample_rate(sample_rate_);
|
double actual_sample_rate = limesdr_source_->set_sample_rate(sample_rate_);
|
||||||
std::cout << "Actual RX Rate: " << actual_sample_rate << " [SPS]...\n";
|
std::cout << "Actual RX Rate: " << actual_sample_rate << " [SPS]...\n";
|
||||||
LOG(INFO) << "Actual RX Rate: " << actual_sample_rate << " [SPS]...";
|
LOG(INFO) << "Actual RX Rate: " << actual_sample_rate << " [SPS]...";
|
||||||
@ -177,6 +173,7 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
|||||||
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_stream_ > 0)
|
if (in_stream_ > 0)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "A signal source does not have an input stream";
|
LOG(ERROR) << "A signal source does not have an input stream";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user