1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

LimeSDR input: use a value dial for the analog lowpass filter

This commit is contained in:
f4exb 2017-04-18 01:16:39 +02:00
parent 35f7124a74
commit c07d4483e0
5 changed files with 42 additions and 47 deletions

View File

@ -37,7 +37,8 @@ LimeSDRInput::LimeSDRInput(DeviceSourceAPI *deviceAPI) :
m_settings(),
m_limeSDRInputThread(0),
m_deviceDescription(),
m_running(false)
m_running(false),
m_firstConfig(true)
{
openDevice();
}
@ -255,27 +256,12 @@ void LimeSDRInput::getSRRange(float& minF, float& maxF, float& stepF) const
void LimeSDRInput::getLPRange(float& minF, float& maxF, float& stepF) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
float step = range.step < 1000.0f ? 1000.0 : range.step;
minF = range.min;
maxF = range.max;
stepF = step;
stepF = range.step;
qDebug("LimeSDRInput::getLPRange: min: %f max: %f step: %f", range.min, range.max, range.step);
}
int LimeSDRInput::getLPIndex(float lpfBW) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
float step = range.step < 1000.0f ? 1000.0 : range.step;
return (int) ((lpfBW - range.min) / step);
}
float LimeSDRInput::getLPValue(int index) const
{
lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx;
float step = range.step < 1000.0f ? 1000.0 : range.step;
return index * step;
}
uint32_t LimeSDRInput::getHWLog2Decim() const
{
return m_deviceShared.m_deviceParams->m_log2OvSRRx;
@ -288,10 +274,14 @@ bool LimeSDRInput::handleMessage(const Message& message)
MsgConfigureLimeSDR& conf = (MsgConfigureLimeSDR&) message;
qDebug() << "LimeSDRInput::handleMessage: MsgConfigureLimeSDR";
if (!applySettings(conf.getSettings(), false))
if (!applySettings(conf.getSettings(), m_firstConfig))
{
qDebug("LimeSDRInput::handleMessage config error");
}
else
{
m_firstConfig = false;
}
return true;
}

View File

@ -113,8 +113,6 @@ public:
void getLORange(float& minF, float& maxF, float& stepF) const;
void getSRRange(float& minF, float& maxF, float& stepF) const;
void getLPRange(float& minF, float& maxF, float& stepF) const;
int getLPIndex(float lpfBW) const;
float getLPValue(int index) const;
uint32_t getHWLog2Decim() const;
private:
@ -125,6 +123,7 @@ private:
QString m_deviceDescription;
bool m_running;
DeviceLimeSDRShared m_deviceShared;
bool m_firstConfig;
lms_stream_t m_streamId;

View File

@ -54,11 +54,8 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
m_limeSDRInput->getLPRange(minF, maxF, stepF);
int minLP = (int) (minF / stepF);
int maxLP = (int) (maxF / stepF);
int nbSteps = (int) ((maxF - minF) / stepF);
ui->lpf->setMinimum(minLP);
ui->lpf->setMaximum(maxLP);
ui->lpf->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->lpf->setValueRange(6, (minF/1000)+1, maxF/1000);
ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->lpFIR->setValueRange(5, 1U, 56000U);
@ -203,8 +200,7 @@ void LimeSDRInputGUI::displaySettings()
ui->hwDecim->setCurrentIndex(m_settings.m_log2HardDecim);
ui->swDecim->setCurrentIndex(m_settings.m_log2SoftDecim);
ui->lpf->setValue(m_limeSDRInput->getLPIndex(m_settings.m_lpfBW));
ui->lpfText->setText(tr("%1k").arg(QString::number(m_settings.m_lpfBW / 1000.0f, 'f', 0)));
ui->lpf->setValue(m_settings.m_lpfBW / 1000);
ui->lpFIREnable->setChecked(m_settings.m_lpfFIREnable);
ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000);
@ -223,7 +219,7 @@ void LimeSDRInputGUI::updateHardware()
{
if (m_doApplySettings)
{
qDebug() << "BladerfGui::updateHardware";
qDebug() << "LimeSDRInputGUI::updateHardware";
LimeSDRInput::MsgConfigureLimeSDR* message = LimeSDRInput::MsgConfigureLimeSDR::create(m_settings);
m_sampleSource->getInputMessageQueue()->push(message);
m_updateTimer.stop();
@ -334,10 +330,9 @@ void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index)
sendSettings();
}
void LimeSDRInputGUI::on_lpf_valueChanged(int value)
void LimeSDRInputGUI::on_lpf_changed(int value)
{
m_settings.m_lpfBW = m_limeSDRInput->getLPValue(value);
ui->lpfText->setText(tr("%1k").arg(QString::number(m_settings.m_lpfBW / 1000.0f, 'f', 0)));
m_settings.m_lpfBW = value * 1000;
sendSettings();
}

View File

@ -78,7 +78,7 @@ private slots:
void on_sampleRate_changed(quint64 value);
void on_hwDecim_currentIndexChanged(int index);
void on_swDecim_currentIndexChanged(int index);
void on_lpf_valueChanged(int value);
void on_lpf_changed(int value);
void on_lpFIREnable_toggled(bool checked);
void on_lpFIR_changed(quint64 value);
void on_gain_valueChanged(int value);

View File

@ -265,7 +265,6 @@
<pointsize>12</pointsize>
</font>
</property>
<zorder>samplerateUnit</zorder>
</widget>
</item>
<item row="0" column="4">
@ -452,22 +451,34 @@
</widget>
</item>
<item>
<widget class="QSlider" name="lpf">
<widget class="ValueDial" name="lpf" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="toolTip">
<string>Analog lowpass filter bandwidth (kHz)</string>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>Analog lowpass filers bandwidth (kHz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lpfText">
<widget class="QLabel" name="lpfUnits">
<property name="text">
<string>00000k</string>
<string>k</string>
</property>
</widget>
</item>
@ -490,7 +501,7 @@
<string>Enable or disable the digital FIR lowpass filters</string>
</property>
<property name="text">
<string>LPFIR</string>
<string>FIR</string>
</property>
</widget>
</item>
@ -515,14 +526,14 @@
</font>
</property>
<property name="toolTip">
<string>Digital FIR lowpass filers bandwidth (Hz)</string>
<string>Digital FIR lowpass filers bandwidth (kHz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="lpFIRUnits">
<property name="text">
<string>Hz</string>
<string>k</string>
</property>
</widget>
</item>