mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 14:04:46 -04:00
XTRX input: implemented baseband or device sample rate input option
This commit is contained in:
@@ -37,6 +37,7 @@ XTRXInputGUI::XTRXInputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
ui(new Ui::XTRXInputGUI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_settings(),
|
||||
m_sampleRateMode(true),
|
||||
m_sampleRate(0),
|
||||
m_lastEngineState((DSPDeviceSourceEngine::State)-1),
|
||||
m_doApplySettings(true),
|
||||
@@ -277,7 +278,39 @@ void XTRXInputGUI::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 XTRXInputGUI::displaySampleRate()
|
||||
{
|
||||
float minF, maxF, stepF;
|
||||
m_XTRXInput->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_log2SoftDecim);
|
||||
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_log2SoftDecim), (uint32_t) maxF/(1<<m_settings.m_log2SoftDecim));
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim));
|
||||
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 XTRXInputGUI::displaySettings()
|
||||
@@ -286,7 +319,7 @@ void XTRXInputGUI::displaySettings()
|
||||
ui->extClock->setExternalClockActive(m_settings.m_extClock);
|
||||
|
||||
setCenterFrequencyDisplay();
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||
displaySampleRate();
|
||||
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||
@@ -503,7 +536,12 @@ void XTRXInputGUI::on_iqImbalance_toggled(bool checked)
|
||||
|
||||
void XTRXInputGUI::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_log2SoftDecim);
|
||||
}
|
||||
|
||||
updateADCRate();
|
||||
setNCODisplay();
|
||||
sendSettings();}
|
||||
@@ -513,6 +551,14 @@ void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index)
|
||||
if ((index <0) || (index > 5))
|
||||
return;
|
||||
m_settings.m_log2HardDecim = index;
|
||||
displaySampleRate();
|
||||
|
||||
if (m_sampleRateMode) {
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
|
||||
} else {
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftDecim);
|
||||
}
|
||||
|
||||
updateADCRate();
|
||||
setNCODisplay();
|
||||
sendSettings();
|
||||
@@ -520,8 +566,10 @@ void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index)
|
||||
|
||||
void XTRXInputGUI::on_swDecim_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index <0) || (index > 6))
|
||||
if ((index <0) || (index > 6)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.m_log2SoftDecim = index;
|
||||
sendSettings();
|
||||
}
|
||||
@@ -601,6 +649,12 @@ void XTRXInputGUI::on_pwrmode_currentIndexChanged(int index)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void XTRXInputGUI::on_sampleRateMode_toggled(bool checked)
|
||||
{
|
||||
m_sampleRateMode = checked;
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
void XTRXInputGUI::openDeviceSettingsDialog(const QPoint& p)
|
||||
{
|
||||
BasicDeviceSettingsDialog dialog(this);
|
||||
|
||||
Reference in New Issue
Block a user