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_forceSettings(true),
|
||||
m_settings(),
|
||||
m_sampleRateMode(true),
|
||||
m_deviceSampleSink(0),
|
||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
|
||||
m_doApplySettings(true)
|
||||
@ -196,7 +197,36 @@ void HackRFOutputGui::updateSampleRateAndFrequency()
|
||||
{
|
||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||
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()
|
||||
@ -209,7 +239,7 @@ void HackRFOutputGui::displaySettings()
|
||||
|
||||
ui->biasT->setChecked(m_settings.m_biasT);
|
||||
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||
displaySampleRate();
|
||||
|
||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||
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)
|
||||
{
|
||||
if (m_sampleRateMode) {
|
||||
m_settings.m_devSampleRate = value;
|
||||
} else {
|
||||
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Interp);
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -294,9 +329,19 @@ void HackRFOutputGui::on_lnaExt_stateChanged(int state)
|
||||
|
||||
void HackRFOutputGui::on_interp_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index <0) || (index > 6))
|
||||
if ((index <0) || (index > 6)) {
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -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()
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
DeviceUISet* m_deviceUISet;
|
||||
bool m_forceSettings;
|
||||
HackRFOutputSettings m_settings;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
DeviceSampleSink* m_deviceSampleSink;
|
||||
@ -78,6 +79,7 @@ private:
|
||||
bool m_doApplySettings;
|
||||
|
||||
void displaySettings();
|
||||
void displaySampleRate();
|
||||
void displayBandwidths();
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
@ -95,6 +97,7 @@ private slots:
|
||||
void on_bbFilter_currentIndexChanged(int index);
|
||||
void on_txvga_valueChanged(int value);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_sampleRateMode_toggled(bool checked);
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
void openDeviceSettingsDialog(const QPoint& p);
|
||||
|
@ -292,16 +292,31 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QToolButton" name="sampleRateMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>0</height>
|
||||
</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 name="text">
|
||||
<string>SR</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user