aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/SDRDevice.h2
-rw-r--r--src/output/Soapy.cpp13
-rw-r--r--src/output/UHD.cpp21
3 files changed, 25 insertions, 11 deletions
diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h
index bcd5a39..bd1a518 100644
--- a/src/output/SDRDevice.h
+++ b/src/output/SDRDevice.h
@@ -53,6 +53,8 @@ using complexf = std::complex<float>;
struct SDRDeviceConfig {
std::string device;
std::string subDevice; // For UHD
+ std::string tx_antenna;
+ std::string rx_antenna;
long masterClockRate = 32768000;
unsigned sampleRate = 2048000;
diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp
index 44f8f58..8ee420e 100644
--- a/src/output/Soapy.cpp
+++ b/src/output/Soapy.cpp
@@ -71,23 +71,32 @@ Soapy::Soapy(SDRDeviceConfig& config) :
m_device->setMasterClockRate(m_conf.masterClockRate);
etiLog.level(info) << "SoapySDR master clock rate set to " <<
+ std::fixed << std::setprecision(4) <<
m_device->getMasterClockRate()/1000.0 << " kHz";
m_device->setSampleRate(SOAPY_SDR_TX, 0, m_conf.sampleRate);
etiLog.level(info) << "SoapySDR:Actual TX rate: " <<
+ std::fixed << std::setprecision(4) <<
m_device->getSampleRate(SOAPY_SDR_TX, 0) / 1000.0 <<
" ksps.";
tune(m_conf.lo_offset, m_conf.frequency);
m_conf.frequency = m_device->getFrequency(SOAPY_SDR_TX, 0);
etiLog.level(info) << "SoapySDR:Actual frequency: " <<
- m_conf.frequency / 1000.0 <<
- " kHz.";
+ std::fixed << std::setprecision(3) <<
+ m_conf.frequency / 1000.0 << " kHz.";
m_device->setGain(SOAPY_SDR_TX, 0, m_conf.txgain);
etiLog.level(info) << "SoapySDR:Actual tx gain: " <<
+ std::fixed << std::setprecision(2) <<
m_device->getGain(SOAPY_SDR_TX, 0);
+ if (not m_conf.tx_antenna.empty()) {
+ m_device->setAntenna(SOAPY_SDR_TX, 0, m_conf.tx_antenna);
+ }
+ etiLog.level(info) << "SoapySDR:Actual tx antenna: " <<
+ m_device->getAntenna(SOAPY_SDR_TX, 0);
+
const std::vector<size_t> channels({0});
m_tx_stream = m_device->setupStream(SOAPY_SDR_TX, "CF32", channels);
m_device->activateStream(m_tx_stream);
diff --git a/src/output/UHD.cpp b/src/output/UHD.cpp
index 8876b0e..2c571fd 100644
--- a/src/output/UHD.cpp
+++ b/src/output/UHD.cpp
@@ -159,10 +159,10 @@ UHD::UHD(SDRDeviceConfig& config) :
tune(m_conf.lo_offset, m_conf.frequency);
m_conf.frequency = m_usrp->get_tx_freq();
- etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ etiLog.level(debug) << std::fixed << std::setprecision(3) <<
"OutputUHD:Actual TX frequency: " << m_conf.frequency;
- etiLog.level(info) << std::fixed << std::setprecision(3) <<
+ etiLog.level(debug) << std::fixed << std::setprecision(3) <<
"OutputUHD:Actual RX frequency: " << m_usrp->get_tx_freq();
m_usrp->set_tx_gain(m_conf.txgain);
@@ -175,18 +175,21 @@ UHD::UHD(SDRDeviceConfig& config) :
m_usrp->set_rx_rate(m_conf.sampleRate);
etiLog.log(debug, "OutputUHD:Actual RX Rate: %f sps.", m_usrp->get_rx_rate());
- m_usrp->set_rx_antenna("RX2");
- etiLog.log(debug, "OutputUHD:Set RX Antenna: %s",
+ if (not m_conf.rx_antenna.empty()) {
+ m_usrp->set_rx_antenna(m_conf.rx_antenna);
+ }
+ etiLog.log(debug, "OutputUHD:Actual RX Antenna: %s",
m_usrp->get_rx_antenna().c_str());
+ if (not m_conf.tx_antenna.empty()) {
+ m_usrp->set_tx_antenna(m_conf.tx_antenna);
+ }
+ etiLog.log(debug, "OutputUHD:Actual TX Antenna: %s",
+ m_usrp->get_tx_antenna().c_str());
+
m_usrp->set_rx_gain(m_conf.rxgain);
etiLog.log(debug, "OutputUHD:Actual RX Gain: %f", m_usrp->get_rx_gain());
- /* TODO
- uhdFeedback = std::make_shared<OutputUHDFeedback>(
- m_usrp, m_conf.dpdFeedbackServerPort, m_conf.sampleRate);
- */
-
const uhd::stream_args_t stream_args("fc32"); //complex floats
m_rx_stream = m_usrp->get_rx_stream(stream_args);
m_tx_stream = m_usrp->get_tx_stream(stream_args);