mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
BladeRF1 output: implemented baseband or device sample rate input option
This commit is contained in:
parent
60cb77fe2d
commit
66bfff90da
@ -38,7 +38,8 @@ Bladerf1OutputGui::Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent)
|
|||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_forceSettings(true),
|
m_forceSettings(true),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_deviceSampleSink(NULL),
|
m_sampleRateMode(true),
|
||||||
|
m_deviceSampleSink(nullptr),
|
||||||
m_sampleRate(0),
|
m_sampleRate(0),
|
||||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
|
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
|
||||||
{
|
{
|
||||||
@ -189,13 +190,42 @@ void Bladerf1OutputGui::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(QString("%1k").arg(QString::number(m_sampleRate/1000.0, 'g', 5)));
|
displaySampleRate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bladerf1OutputGui::displaySampleRate()
|
||||||
|
{
|
||||||
|
ui->sampleRate->blockSignals(true);
|
||||||
|
|
||||||
|
if (m_sampleRateMode)
|
||||||
|
{
|
||||||
|
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
|
||||||
|
ui->sampleRateMode->setText("SR");
|
||||||
|
ui->sampleRate->setValueRange(8, BLADERF_SAMPLERATE_MIN, BLADERF_SAMPLERATE_REC_MAX);
|
||||||
|
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_log2Interp);
|
||||||
|
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, BLADERF_SAMPLERATE_MIN/(1<<m_settings.m_log2Interp), BLADERF_SAMPLERATE_REC_MAX/(1<<m_settings.m_log2Interp));
|
||||||
|
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2Interp));
|
||||||
|
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 Bladerf1OutputGui::displaySettings()
|
void Bladerf1OutputGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
displaySampleRate();
|
||||||
|
|
||||||
unsigned int bandwidthIndex = BladerfBandwidths::getBandwidthIndex(m_settings.m_bandwidth);
|
unsigned int bandwidthIndex = BladerfBandwidths::getBandwidthIndex(m_settings.m_bandwidth);
|
||||||
ui->bandwidth->setCurrentIndex(bandwidthIndex);
|
ui->bandwidth->setCurrentIndex(bandwidthIndex);
|
||||||
@ -225,7 +255,12 @@ void Bladerf1OutputGui::on_centerFrequency_changed(quint64 value)
|
|||||||
|
|
||||||
void Bladerf1OutputGui::on_sampleRate_changed(quint64 value)
|
void Bladerf1OutputGui::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_log2Interp);
|
||||||
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +273,19 @@ void Bladerf1OutputGui::on_bandwidth_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void Bladerf1OutputGui::on_interp_currentIndexChanged(int index)
|
void Bladerf1OutputGui::on_interp_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index <0) || (index > 6))
|
if ((index <0) || (index > 6)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_settings.m_log2Interp = index;
|
m_settings.m_log2Interp = index;
|
||||||
|
displaySampleRate();
|
||||||
|
|
||||||
|
if (m_sampleRateMode) {
|
||||||
|
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
|
||||||
|
} else {
|
||||||
|
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Interp);
|
||||||
|
}
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +378,12 @@ void Bladerf1OutputGui::on_startStop_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bladerf1OutputGui::on_sampleRateMode_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_sampleRateMode = checked;
|
||||||
|
displaySampleRate();
|
||||||
|
}
|
||||||
|
|
||||||
void Bladerf1OutputGui::updateHardware()
|
void Bladerf1OutputGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "BladerfGui::updateHardware";
|
qDebug() << "BladerfGui::updateHardware";
|
||||||
|
@ -59,6 +59,7 @@ private:
|
|||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
bool m_forceSettings;
|
bool m_forceSettings;
|
||||||
BladeRF1OutputSettings m_settings;
|
BladeRF1OutputSettings 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;
|
||||||
DeviceSampleSink* m_deviceSampleSink;
|
DeviceSampleSink* m_deviceSampleSink;
|
||||||
@ -69,6 +70,7 @@ private:
|
|||||||
|
|
||||||
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
|
void displaySampleRate();
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter);
|
unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter);
|
||||||
void updateSampleRateAndFrequency();
|
void updateSampleRateAndFrequency();
|
||||||
@ -83,6 +85,7 @@ private slots:
|
|||||||
void on_vga2_valueChanged(int value);
|
void on_vga2_valueChanged(int value);
|
||||||
void on_xb200_currentIndexChanged(int index);
|
void on_xb200_currentIndexChanged(int index);
|
||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
|
void on_sampleRateMode_toggled(bool checked);
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void openDeviceSettingsDialog(const QPoint& p);
|
void openDeviceSettingsDialog(const QPoint& p);
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="deviceRateLayout">
|
<layout class="QHBoxLayout" name="deviceRateLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="deviceRateLabel">
|
<widget class="QLabel" name="deviceRateText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>50</width>
|
<width>50</width>
|
||||||
@ -300,16 +300,31 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<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 name="toolTip">
|
||||||
|
<string>Toggle between device to host (SR) and base band (BB) sample rate input</string>
|
||||||
</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>
|
||||||
|
Loading…
Reference in New Issue
Block a user