mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
HackRF output: implemented baseband or device sample rate input option
This commit is contained in:
parent
457c873365
commit
1860d20220
@ -41,6 +41,7 @@ HackRFOutputGui::HackRFOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
m_deviceUISet(deviceUISet),
|
m_deviceUISet(deviceUISet),
|
||||||
m_forceSettings(true),
|
m_forceSettings(true),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
|
m_sampleRateMode(true),
|
||||||
m_deviceSampleSink(0),
|
m_deviceSampleSink(0),
|
||||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
|
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
|
||||||
m_doApplySettings(true)
|
m_doApplySettings(true)
|
||||||
@ -196,7 +197,36 @@ void HackRFOutputGui::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->deviceRateText->setText(QString("%1k").arg(QString::number(m_sampleRate/1000.0, 'g', 5)));
|
displaySampleRate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HackRFOutputGui::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, 1000000U, 20000000U);
|
||||||
|
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, 1000000U/(1<<m_settings.m_log2Interp), 20000000U/(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 HackRFOutputGui::displaySettings()
|
void HackRFOutputGui::displaySettings()
|
||||||
@ -209,7 +239,7 @@ void HackRFOutputGui::displaySettings()
|
|||||||
|
|
||||||
ui->biasT->setChecked(m_settings.m_biasT);
|
ui->biasT->setChecked(m_settings.m_biasT);
|
||||||
|
|
||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
displaySampleRate();
|
||||||
|
|
||||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||||
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
|
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
|
||||||
@ -262,7 +292,12 @@ void HackRFOutputGui::on_centerFrequency_changed(quint64 value)
|
|||||||
|
|
||||||
void HackRFOutputGui::on_sampleRate_changed(quint64 value)
|
void HackRFOutputGui::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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,9 +329,19 @@ void HackRFOutputGui::on_lnaExt_stateChanged(int state)
|
|||||||
|
|
||||||
void HackRFOutputGui::on_interp_currentIndexChanged(int index)
|
void HackRFOutputGui::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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +370,12 @@ void HackRFOutputGui::on_startStop_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HackRFOutputGui::on_sampleRateMode_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_sampleRateMode = checked;
|
||||||
|
displaySampleRate();
|
||||||
|
}
|
||||||
|
|
||||||
void HackRFOutputGui::updateHardware()
|
void HackRFOutputGui::updateHardware()
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
|
@ -68,6 +68,7 @@ private:
|
|||||||
DeviceUISet* m_deviceUISet;
|
DeviceUISet* m_deviceUISet;
|
||||||
bool m_forceSettings;
|
bool m_forceSettings;
|
||||||
HackRFOutputSettings m_settings;
|
HackRFOutputSettings 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;
|
||||||
@ -78,6 +79,7 @@ private:
|
|||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
|
void displaySampleRate();
|
||||||
void displayBandwidths();
|
void displayBandwidths();
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
void updateSampleRateAndFrequency();
|
void updateSampleRateAndFrequency();
|
||||||
@ -95,6 +97,7 @@ private slots:
|
|||||||
void on_bbFilter_currentIndexChanged(int index);
|
void on_bbFilter_currentIndexChanged(int index);
|
||||||
void on_txvga_valueChanged(int value);
|
void on_txvga_valueChanged(int value);
|
||||||
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);
|
||||||
|
@ -292,16 +292,31 @@
|
|||||||
<number>4</number>
|
<number>4</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