LimeSDR output: implemented baseband or device sample rate input option

This commit is contained in:
f4exb 2019-04-09 21:40:33 +02:00
parent 8123cacafd
commit 8ab8fc3e0d
3 changed files with 80 additions and 11 deletions

View File

@ -33,6 +33,7 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
ui(new Ui::LimeSDROutputGUI), ui(new Ui::LimeSDROutputGUI),
m_deviceUISet(deviceUISet), m_deviceUISet(deviceUISet),
m_settings(), m_settings(),
m_sampleRateMode(true),
m_sampleRate(0), m_sampleRate(0),
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted), m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
m_doApplySettings(true), m_doApplySettings(true),
@ -302,7 +303,7 @@ void LimeSDROutputGUI::updateSampleRateAndFrequency()
{ {
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5))); displaySampleRate();
} }
void LimeSDROutputGUI::updateDACRate() void LimeSDROutputGUI::updateDACRate()
@ -316,6 +317,38 @@ void LimeSDROutputGUI::updateDACRate()
} }
} }
void LimeSDROutputGUI::displaySampleRate()
{
float minF, maxF;
m_limeSDROutput->getSRRange(minF, maxF);
ui->sampleRate->blockSignals(true);
if (m_sampleRateMode)
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
ui->sampleRateMode->setText("SR");
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->sampleRate->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setToolTip("Baseband sample rate (S/s)");
uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp);
ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5)));
}
else
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }");
ui->sampleRateMode->setText("BB");
ui->sampleRate->setValueRange(8, (uint32_t) minF/(1<<m_settings.m_log2SoftInterp), (uint32_t) maxF/(1<<m_settings.m_log2SoftInterp));
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftInterp));
ui->sampleRate->setToolTip("Baseband sample rate (S/s)");
ui->deviceRateText->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5)));
}
ui->sampleRate->blockSignals(false);
}
void LimeSDROutputGUI::displaySettings() void LimeSDROutputGUI::displaySettings()
{ {
ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency); ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
@ -325,7 +358,7 @@ void LimeSDROutputGUI::displaySettings()
ui->extClock->setExternalClockActive(m_settings.m_extClock); ui->extClock->setExternalClockActive(m_settings.m_extClock);
setCenterFrequencyDisplay(); setCenterFrequencyDisplay();
ui->sampleRate->setValue(m_settings.m_devSampleRate); displaySampleRate();
ui->hwInterp->setCurrentIndex(m_settings.m_log2HardInterp); ui->hwInterp->setCurrentIndex(m_settings.m_log2HardInterp);
ui->swInterp->setCurrentIndex(m_settings.m_log2SoftInterp); ui->swInterp->setCurrentIndex(m_settings.m_log2SoftInterp);
@ -497,7 +530,12 @@ void LimeSDROutputGUI::on_ncoEnable_toggled(bool checked)
void LimeSDROutputGUI::on_sampleRate_changed(quint64 value) void LimeSDROutputGUI::on_sampleRate_changed(quint64 value)
{ {
m_settings.m_devSampleRate = value; if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2SoftInterp);
}
updateDACRate(); updateDACRate();
setNCODisplay(); setNCODisplay();
sendSettings();} sendSettings();}
@ -514,9 +552,19 @@ void LimeSDROutputGUI::on_hwInterp_currentIndexChanged(int index)
void LimeSDROutputGUI::on_swInterp_currentIndexChanged(int index) void LimeSDROutputGUI::on_swInterp_currentIndexChanged(int index)
{ {
if ((index <0) || (index > 6)) if ((index <0) || (index > 6)) {
return; return;
}
m_settings.m_log2SoftInterp = index; m_settings.m_log2SoftInterp = index;
displaySampleRate();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftInterp);
}
sendSettings(); sendSettings();
} }
@ -569,6 +617,12 @@ void LimeSDROutputGUI::on_transverter_clicked()
sendSettings(); sendSettings();
} }
void LimeSDROutputGUI::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
displaySampleRate();
}
void LimeSDROutputGUI::openDeviceSettingsDialog(const QPoint& p) void LimeSDROutputGUI::openDeviceSettingsDialog(const QPoint& p)
{ {
BasicDeviceSettingsDialog dialog(this); BasicDeviceSettingsDialog dialog(this);

View File

@ -57,6 +57,7 @@ private:
DeviceUISet* m_deviceUISet; DeviceUISet* m_deviceUISet;
LimeSDROutput* m_limeSDROutput; //!< Same object as above but gives easy access to LimeSDROutput methods and attributes that are used intensively LimeSDROutput* m_limeSDROutput; //!< Same object as above but gives easy access to LimeSDROutput methods and attributes that are used intensively
LimeSDROutputSettings m_settings; LimeSDROutputSettings m_settings;
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer; QTimer m_statusTimer;
int m_sampleRate; int m_sampleRate;
@ -69,6 +70,7 @@ private:
MessageQueue m_inputMessageQueue; MessageQueue m_inputMessageQueue;
void displaySettings(); void displaySettings();
void displaySampleRate();
void setNCODisplay(); void setNCODisplay();
void setCenterFrequencyDisplay(); void setCenterFrequencyDisplay();
void setCenterFrequencySetting(uint64_t kHzValue); void setCenterFrequencySetting(uint64_t kHzValue);
@ -94,6 +96,7 @@ private slots:
void on_antenna_currentIndexChanged(int index); void on_antenna_currentIndexChanged(int index);
void on_extClock_clicked(); void on_extClock_clicked();
void on_transverter_clicked(); void on_transverter_clicked();
void on_sampleRateMode_toggled(bool checked);
void openDeviceSettingsDialog(const QPoint& p); void openDeviceSettingsDialog(const QPoint& p);
void updateHardware(); void updateHardware();

View File

@ -177,7 +177,7 @@
<item> <item>
<layout class="QHBoxLayout" name="freqRightBotLayout"> <layout class="QHBoxLayout" name="freqRightBotLayout">
<item> <item>
<widget class="QLabel" name="deviceRateLabel"> <widget class="QLabel" name="deviceRateText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>54</width> <width>54</width>
@ -439,16 +439,28 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="samplerateLabel"> <widget class="QToolButton" name="sampleRateMode">
<property name="sizePolicy"> <property name="minimumSize">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <size>
<horstretch>0</horstretch> <width>24</width>
<verstretch>0</verstretch> <height>0</height>
</sizepolicy> </size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property> </property>
<property name="text"> <property name="text">
<string>SR</string> <string>SR</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>