1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 07:16:48 -04:00

RTLSDR plugin: fixed sample rate display and update

This commit is contained in:
f4exb 2017-04-02 03:34:03 +02:00
parent b2e2c0a106
commit a7fabd5f58
3 changed files with 10 additions and 9 deletions

View File

@ -40,8 +40,8 @@ RTLSDRGui::RTLSDRGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 24000U, 1900000U);
ui->newSampleRate->setColorMapper(ColorMapper(ColorMapper::ReverseGreenYellow));
ui->newSampleRate->setValueRange(7, 950000U, 2400000U);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::ReverseGreenYellow));
ui->sampleRate->setValueRange(7, 950000U, 2400000U);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -190,12 +190,13 @@ void RTLSDRGui::updateSampleRateAndFrequency()
{
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
}
void RTLSDRGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqImbalance);
ui->ppm->setValue(m_settings.m_loPpmCorrection);
@ -392,7 +393,7 @@ void RTLSDRGui::on_checkBox_stateChanged(int state)
sendSettings();
}
void RTLSDRGui::on_newSampleRate_changed(quint64 value)
void RTLSDRGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;
sendSettings();
@ -401,12 +402,12 @@ void RTLSDRGui::on_newSampleRate_changed(quint64 value)
void RTLSDRGui::on_lowSampleRate_toggled(bool checked)
{
if (checked) {
ui->newSampleRate->setValueRange(7, 230000U, 300000U);
ui->sampleRate->setValueRange(7, 230000U, 300000U);
} else {
ui->newSampleRate->setValueRange(7, 950000U, 2400000U);
ui->sampleRate->setValueRange(7, 950000U, 2400000U);
}
m_settings.m_devSampleRate = ui->newSampleRate->getValueNew();
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
qDebug("RTLSDRGui::on_lowSampleRate_toggled: %d S/s", m_settings.m_devSampleRate);
sendSettings();
}

View File

@ -68,7 +68,7 @@ private:
private slots:
void handleDSPMessages();
void on_centerFrequency_changed(quint64 value);
void on_newSampleRate_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_lowSampleRate_toggled(bool checked);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);

View File

@ -339,7 +339,7 @@
</widget>
</item>
<item>
<widget class="ValueDial" name="newSampleRate" native="true">
<widget class="ValueDial" name="sampleRate" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>