1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

LimeSDR input: debug (2)

This commit is contained in:
f4exb 2017-04-18 00:50:03 +02:00
parent 0013ab89ea
commit 35f7124a74
5 changed files with 53 additions and 41 deletions

View File

@ -19,13 +19,15 @@
bool DeviceLimeSDRParams::open(lms_info_str_t deviceStr)
{
if (LMS_Open(&m_dev, deviceStr, 0))
qDebug("DeviceLimeSDRParams::open: serial: %s", (const char *) deviceStr);
if (LMS_Open(&m_dev, deviceStr, 0) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot open device " << deviceStr;
return false;
}
if (LMS_Init(m_dev) != 0)
if (LMS_Init(m_dev) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot init device " << deviceStr;
return false;
@ -55,37 +57,37 @@ bool DeviceLimeSDRParams::open(lms_info_str_t deviceStr)
qDebug() << "DeviceLimeSDRParams::open: " << n << " Tx channels for device " << deviceStr;
}
if (LMS_GetLPFBWRange(m_dev, LMS_CH_RX, &m_lpfRangeRx) != 0)
if (LMS_GetLPFBWRange(m_dev, LMS_CH_RX, &m_lpfRangeRx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Rx LPF range for device " << deviceStr;
return false;
}
if (LMS_GetLPFBWRange(m_dev, LMS_CH_TX, &m_lpfRangeTx) != 0)
if (LMS_GetLPFBWRange(m_dev, LMS_CH_TX, &m_lpfRangeTx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Tx LPF range for device " << deviceStr;
return false;
}
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_RX, &m_lpfRangeRx) != 0)
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_RX, &m_loRangeRx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Rx LO range for device " << deviceStr;
return false;
}
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_TX, &m_lpfRangeTx) != 0)
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_TX, &m_loRangeTx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Tx LO range for device " << deviceStr;
return false;
}
if (LMS_GetSampleRateRange(m_dev, LMS_CH_RX, &m_srRangeRx) != 0)
if (LMS_GetSampleRateRange(m_dev, LMS_CH_RX, &m_srRangeRx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Rx sample rate range for device " << deviceStr;
return false;
}
if (LMS_GetSampleRateRange(m_dev, LMS_CH_TX, &m_srRangeTx) != 0)
if (LMS_GetSampleRateRange(m_dev, LMS_CH_TX, &m_srRangeTx) < 0)
{
qDebug() << "DeviceLimeSDRParams::open: cannot get the Tx sample rate range for device " << deviceStr;
return false;

View File

@ -240,6 +240,7 @@ void LimeSDRInput::getLORange(float& minF, float& maxF, float& stepF) const
minF = range.min;
maxF = range.max;
stepF = range.step;
qDebug("LimeSDRInput::getLORange: min: %f max: %f step: %f", range.min, range.max, range.step);
}
void LimeSDRInput::getSRRange(float& minF, float& maxF, float& stepF) const
@ -248,26 +249,31 @@ void LimeSDRInput::getSRRange(float& minF, float& maxF, float& stepF) const
minF = range.min;
maxF = range.max;
stepF = range.step;
qDebug("LimeSDRInput::getSRRange: min: %f max: %f step: %f", range.min, range.max, range.step);
}
void LimeSDRInput::getLPRange(float& minF, float& maxF, float& stepF) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
float step = range.step < 1000.0f ? 1000.0 : range.step;
minF = range.min;
maxF = range.max;
stepF = range.step;
stepF = step;
qDebug("LimeSDRInput::getLPRange: min: %f max: %f step: %f", range.min, range.max, range.step);
}
int LimeSDRInput::getLPIndex(float lpfBW) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
return (int) ((lpfBW - range.min) / range.step);
float step = range.step < 1000.0f ? 1000.0 : range.step;
return (int) ((lpfBW - range.min) / step);
}
float LimeSDRInput::getLPValue(int index) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
return range.min + index * range.step;
float step = range.step < 1000.0f ? 1000.0 : range.step;
return index * step;
}
uint32_t LimeSDRInput::getHWLog2Decim() const
@ -309,8 +315,6 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
bool forwardChangeAllDSP = false;
// QMutexLocker mutexLocker(&m_mutex);
qDebug() << "LimeSDRInput::applySettings";
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
{
m_settings.m_dcBlock = settings.m_dcBlock;
@ -380,10 +384,10 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (LMS_SetLPF(m_deviceShared.m_deviceParams->getDevice(),
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_lpfBW))
m_settings.m_lpfBW) < 0)
{
qCritical("LimeSDRInput::applySettings: could not set LPF to %f Hz", m_settings.m_lpfBW);
}
@ -406,7 +410,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_lpfFIREnable,
m_settings.m_lpfFIRBW))
m_settings.m_lpfFIRBW) < 0)
{
qCritical("LimeSDRInput::applySettings: could %s and set LPF FIR to %f Hz",
m_settings.m_lpfFIREnable ? "enable" : "disable",
@ -435,16 +439,21 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
forwardChangeRxDSP = true;
if (m_deviceShared.m_deviceParams->getDevice() != NULL)
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (LMS_SetLOFrequency(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel, // same for both channels anyway but switches antenna port automatically
m_settings.m_centerFrequency ) != 0)
m_settings.m_centerFrequency ) < 0)
{
qDebug("LimeSDRInput::applySettings: LMS_SetLOFrequency(%lu) failed", m_settings.m_centerFrequency);
qCritical("LimeSDRInput::applySettings: could not set frequency to %lu", m_settings.m_centerFrequency);
}
else
{
qDebug("LimeSDRInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency);
}
}
}
@ -506,7 +515,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
qDebug() << "LimeSDRInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
<< " device sample rate: " << m_settings.m_devSampleRate << "S/s"
<< " Actual sample rate: " << m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim) << "S/s";
<< " sample rate after soft decimation: " << m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim) << "S/s";
return true;
}

View File

@ -60,6 +60,9 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->lpf->setMinimum(minLP);
ui->lpf->setMaximum(maxLP);
ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->lpFIR->setValueRange(5, 1U, 56000U);
ui->channelNumberText->setText(tr("#%1").arg(m_limeSDRInput->getChannelIndex()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
@ -200,11 +203,11 @@ void LimeSDRInputGUI::displaySettings()
ui->hwDecim->setCurrentIndex(m_settings.m_log2HardDecim);
ui->swDecim->setCurrentIndex(m_settings.m_log2SoftDecim);
ui->lpf->setValue(m_limeSDRInput->getLPIndex(m_settings.m_lpfFIRBW));
ui->lpfText->setText(tr("%1k").arg(QString::number(m_settings.m_lpfFIRBW / 1000.0f, 'f', 0)));
ui->lpf->setValue(m_limeSDRInput->getLPIndex(m_settings.m_lpfBW));
ui->lpfText->setText(tr("%1k").arg(QString::number(m_settings.m_lpfBW / 1000.0f, 'f', 0)));
ui->lpFIREnable->setChecked(m_settings.m_lpfFIREnable);
ui->sampleRate->setValue(m_settings.m_lpfFIRBW);
ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000);
ui->gain->setValue(m_settings.m_gain);
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
@ -334,6 +337,7 @@ void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index)
void LimeSDRInputGUI::on_lpf_valueChanged(int value)
{
m_settings.m_lpfBW = m_limeSDRInput->getLPValue(value);
ui->lpfText->setText(tr("%1k").arg(QString::number(m_settings.m_lpfBW / 1000.0f, 'f', 0)));
sendSettings();
}
@ -345,7 +349,7 @@ void LimeSDRInputGUI::on_lpFIREnable_toggled(bool checked)
void LimeSDRInputGUI::on_lpFIR_changed(quint64 value)
{
m_settings.m_lpfFIRBW = value;
m_settings.m_lpfFIRBW = value * 1000;
sendSettings();
}

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>310</width>
<width>340</width>
<height>265</height>
</rect>
</property>
@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>310</width>
<width>340</width>
<height>250</height>
</size>
</property>
@ -456,6 +456,9 @@
<property name="toolTip">
<string>Analog lowpass filter bandwidth (kHz)</string>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View File

@ -80,22 +80,16 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources()
{
for (int i = 0; i < nbDevices; i++)
{
std::string serial;
std::string serial("N/D");
findSerial((const char *) deviceList[i], serial);
if (findSerial((const char *) deviceList[i], serial))
{
qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d: %s", i, (char *) deviceList[i]);
QString displayedName(QString("LimeSDR[%1] %2").arg(i).arg(serial.c_str()));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(serial.c_str()),
i));
}
else
{
qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d: cannot find serial in %s", i, (char *) deviceList[i]);
}
qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d: %s", i, (char *) deviceList[i]);
QString displayedName(QString("LimeSDR[%1] %2").arg(i).arg(serial.c_str()));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(deviceList[i]),
i));
}
}