PlutoSDR: some minor changes to pull request #269 (Get LO range from device) and get Tx LO range also from device

This commit is contained in:
f4exb 2019-01-04 11:23:54 +01:00
parent 01269ac07e
commit b5a7425f1e
8 changed files with 59 additions and 16 deletions

View File

@ -16,8 +16,11 @@
#include "deviceplutosdr.h"
const uint64_t DevicePlutoSDR::loLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs
const uint64_t DevicePlutoSDR::loHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs
const uint64_t DevicePlutoSDR::rxLOLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs
const uint64_t DevicePlutoSDR::rxLOHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs
const uint64_t DevicePlutoSDR::txLOLowLimitFreq = 46875000UL; // 46.875 MHz: take AD9364 specs
const uint64_t DevicePlutoSDR::txLOHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs
const uint32_t DevicePlutoSDR::srLowLimitFreq = (25000000U/12U)+3U; // 25/12 MS/s without FIR interpolation/decimation (+3 so it is the next multiple of 4)
const uint32_t DevicePlutoSDR::srHighLimitFreq = 20000000U; // 20 MS/s: take AD9363 speces

View File

@ -36,8 +36,10 @@ public:
DevicePlutoSDRBox* getDeviceFromURI(const std::string& uri);
DevicePlutoSDRBox* getDeviceFromSerial(const std::string& serial);
static const uint64_t loLowLimitFreq; //!< LO lower frequency limit (Hz)
static const uint64_t loHighLimitFreq; //!< LO lower frequency limit (Hz)
static const uint64_t rxLOLowLimitFreq; //!< Rx LO hard coded lower frequency limit (Hz)
static const uint64_t rxLOHighLimitFreq; //!< Rx LO hard coded lower frequency limit (Hz)
static const uint64_t txLOLowLimitFreq; //!< Tx LO hard coded lower frequency limit (Hz)
static const uint64_t txLOHighLimitFreq; //!< Tx LO hard coded lower frequency limit (Hz)
static const uint32_t srLowLimitFreq; //!< Device sample rate lower limit in S/s
static const uint32_t srHighLimitFreq; //!< Device sample rate higher limit in S/s
static const uint32_t bbLPRxLowLimitFreq; //!< Analog base band Rx low pass filter lower frequency limit (Hz)

View File

@ -713,22 +713,45 @@ bool DevicePlutoSDRBox::getTxRSSI(std::string& rssiStr, unsigned int chan)
return get_param(DEVICE_PHY, buff, rssiStr);
}
void DevicePlutoSDRBox::getRxLORange(uint64_t& minLimit, uint64_t& maxLimit, unsigned int chan)
void DevicePlutoSDRBox::getRxLORange(uint64_t& minLimit, uint64_t& maxLimit)
{
// values are returned in Hz
qint64 stepLimit;
std::string rangeStr;
chan = chan % 2;
char buff[50];
snprintf(buff, sizeof(buff), "out_altvoltage%i_RX_LO_frequency_available", chan);
snprintf(buff, sizeof(buff), "out_altvoltage0_RX_LO_frequency_available");
if(get_param(DEVICE_PHY, buff, rangeStr)) {
if (get_param(DEVICE_PHY, buff, rangeStr))
{
std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
instream >> minLimit >> stepLimit >> maxLimit;
} else {
minLimit = DevicePlutoSDR::loLowLimitFreq;
maxLimit = DevicePlutoSDR::loHighLimitFreq;
instream >> minLimit >> stepLimit >> maxLimit;
}
else
{
minLimit = DevicePlutoSDR::rxLOLowLimitFreq;
maxLimit = DevicePlutoSDR::rxLOHighLimitFreq;
}
}
void DevicePlutoSDRBox::getTxLORange(uint64_t& minLimit, uint64_t& maxLimit)
{
// values are returned in Hz
qint64 stepLimit;
std::string rangeStr;
char buff[50];
snprintf(buff, sizeof(buff), "out_altvoltage1_TX_LO_frequency_available");
if (get_param(DEVICE_PHY, buff, rangeStr))
{
std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
instream >> minLimit >> stepLimit >> maxLimit;
}
else
{
minLimit = DevicePlutoSDR::txLOLowLimitFreq;
maxLimit = DevicePlutoSDR::txLOHighLimitFreq;
}
}

View File

@ -105,7 +105,8 @@ public:
bool getRxGain(int& gaindB, unsigned int chan);
bool getRxRSSI(std::string& rssiStr, unsigned int chan);
bool getTxRSSI(std::string& rssiStr, unsigned int chan);
void getRxLORange(uint64_t& minLimit, uint64_t& maxLimit, unsigned int chan);
void getRxLORange(uint64_t& minLimit, uint64_t& maxLimit);
void getTxLORange(uint64_t& minLimit, uint64_t& maxLimit);
bool fetchTemp();
float getTemp() const { return m_temp; }
bool getRateGovernors(std::string& rateGovernors);

View File

@ -590,6 +590,16 @@ void PlutoSDROutput::getRSSI(std::string& rssiStr)
}
}
void PlutoSDROutput::getLORange(qint64& minLimit, qint64& maxLimit)
{
uint64_t min, max;
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
plutoBox->getTxLORange(min, max);
minLimit = min;
maxLimit = max;
}
bool PlutoSDROutput::fetchTemperature()
{
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();

View File

@ -122,6 +122,7 @@ public:
uint32_t getDACSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
void getRSSI(std::string& rssiStr);
void getLORange(qint64& minLimit, qint64& maxLimit);
bool fetchTemperature();
float getTemperature();

View File

@ -393,10 +393,13 @@ void PlutoSDROutputGUI::setSampleRateLimits()
void PlutoSDROutputGUI::updateFrequencyLimits()
{
qint64 minLimit, maxLimit;
// values in kHz
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
qint64 minLimit = DevicePlutoSDR::loLowLimitFreq/1000 + deltaFrequency;
qint64 maxLimit = DevicePlutoSDR::loHighLimitFreq/1000 + deltaFrequency;
((PlutoSDROutput *) m_sampleSink)->getLORange(minLimit, maxLimit);
minLimit = minLimit/1000 + deltaFrequency;
maxLimit = maxLimit/1000 + deltaFrequency;
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;

View File

@ -680,7 +680,7 @@ void PlutoSDRInput::getLORange(qint64& minLimit, qint64& maxLimit)
uint64_t min, max;
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
plutoBox->getRxLORange(min, max, 0);
plutoBox->getRxLORange(min, max);
minLimit = min;
maxLimit = max;
}