mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-09 09:25:07 -04:00
XTRX output: implemented baseband or device sample rate input option
This commit is contained in:
@@ -35,6 +35,7 @@ XTRXOutputGUI::XTRXOutputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
ui(new Ui::XTRXOutputGUI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_settings(),
|
||||
m_sampleRateMode(true),
|
||||
m_sampleRate(0),
|
||||
m_lastEngineState((DSPDeviceSinkEngine::State)-1),
|
||||
m_doApplySettings(true),
|
||||
@@ -275,7 +276,39 @@ void XTRXOutputGUI::updateSampleRateAndFrequency()
|
||||
{
|
||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::displaySampleRate()
|
||||
{
|
||||
float minF, maxF, stepF;
|
||||
m_XTRXOutput->getSRRange(minF, maxF, stepF);
|
||||
|
||||
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 XTRXOutputGUI::displaySettings()
|
||||
@@ -284,7 +317,7 @@ void XTRXOutputGUI::displaySettings()
|
||||
ui->extClock->setExternalClockActive(m_settings.m_extClock);
|
||||
|
||||
setCenterFrequencyDisplay();
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||
displaySampleRate();
|
||||
|
||||
ui->hwInterp->setCurrentIndex(m_settings.m_log2HardInterp);
|
||||
ui->swInterp->setCurrentIndex(m_settings.m_log2SoftInterp);
|
||||
@@ -454,16 +487,24 @@ void XTRXOutputGUI::on_ncoEnable_toggled(bool checked)
|
||||
|
||||
void XTRXOutputGUI::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();
|
||||
setNCODisplay();
|
||||
sendSettings();}
|
||||
|
||||
void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index <0) || (index > 5))
|
||||
if ((index <0) || (index > 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.m_log2HardInterp = index;
|
||||
|
||||
updateDACRate();
|
||||
setNCODisplay();
|
||||
sendSettings();
|
||||
@@ -471,9 +512,19 @@ void XTRXOutputGUI::on_hwInterp_currentIndexChanged(int index)
|
||||
|
||||
void XTRXOutputGUI::on_swInterp_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index <0) || (index > 6))
|
||||
if ((index <0) || (index > 6)) {
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -510,6 +561,12 @@ void XTRXOutputGUI::on_pwrmode_currentIndexChanged(int index)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::on_sampleRateMode_toggled(bool checked)
|
||||
{
|
||||
m_sampleRateMode = checked;
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
void XTRXOutputGUI::openDeviceSettingsDialog(const QPoint& p)
|
||||
{
|
||||
BasicDeviceSettingsDialog dialog(this);
|
||||
|
||||
Reference in New Issue
Block a user