1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

RTL-SDR: implemented tuner bandwidth control

This commit is contained in:
f4exb 2018-01-16 01:01:24 +01:00
parent bb799a9785
commit 6800bc769e
8 changed files with 79 additions and 4 deletions

3
debian/changelog vendored
View File

@ -1,7 +1,8 @@
sdrangel (3.11.0-1) unstable; urgency=medium
* AirspyHF: support
* RTL-SDR: refactored 8 bit samples shifting during decimation
* Refactored 8 bit samples shifting during decimation (RTL-SDR and HackRF Rx)
* RTL-SDR: implemented RF filter control (tuner bandwidth)
* GUI: show REST API URL in about dialog
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sat, 13 Jan 2018 12:14:18 +0100

View File

@ -32,7 +32,7 @@
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
QString("HackRF Input"),
QString("3.9.0"),
QString("3.11.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -49,6 +49,9 @@ RTLSDRGui::RTLSDRGui(DeviceUISet *deviceUISet, QWidget* parent) :
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(7, RTLSDRInput::sampleRateHighRangeMin, RTLSDRInput::sampleRateHighRangeMax);
ui->rfBW->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->rfBW->setValueRange(4, 350, 8000);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
@ -247,6 +250,7 @@ void RTLSDRGui::displaySettings()
updateFrequencyLimits();
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->rfBW->setValue(m_settings.m_rfBandwidth / 1000);
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqImbalance);
ui->ppm->setValue(m_settings.m_loPpmCorrection);
@ -435,6 +439,12 @@ void RTLSDRGui::on_sampleRate_changed(quint64 value)
sendSettings();
}
void RTLSDRGui::on_rfBW_changed(quint64 value)
{
m_settings.m_rfBandwidth = value * 1000;
sendSettings();
}
void RTLSDRGui::on_lowSampleRate_toggled(bool checked)
{
if (checked) {

View File

@ -78,6 +78,7 @@ private slots:
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_changed(quint64 value);
void on_rfBW_changed(quint64 value);
void on_lowSampleRate_toggled(bool checked);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);

View File

@ -471,7 +471,7 @@
<string>RTLSDR special direct sampling mode (HF Bands)</string>
</property>
<property name="text">
<string>No-mod Direct Sampling</string>
<string>No-mod DS</string>
</property>
</widget>
</item>
@ -488,6 +488,48 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="rfBWabel">
<property name="text">
<string>RFBW</string>
</property>
</widget>
</item>
<item>
<widget class="ValueDial" name="rfBW" 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>DejaVu Sans Mono</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>RF filter bandwidth (kHz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWUnits">
<property name="text">
<string>kHz</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -572,7 +614,7 @@
<item>
<layout class="QHBoxLayout" name="fillerLayout">
<item>
<spacer name="filerVerticalSpacer">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>

View File

@ -515,6 +515,23 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
}
}
if ((m_settings.m_rfBandwidth != settings.m_rfBandwidth) || force)
{
m_settings.m_rfBandwidth = settings.m_rfBandwidth;
if (m_dev != 0)
{
if (rtlsdr_set_tuner_bandwidth( m_dev, m_settings.m_rfBandwidth) != 0)
{
qCritical("RTLSDRInput::applySettings: could not set RF bandwidth to %u", m_settings.m_rfBandwidth);
}
else
{
qDebug() << "RTLSDRInput::applySettings: set RF bandwidth to " << m_settings.m_rfBandwidth;
}
}
}
if (forwardChange)
{
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);

View File

@ -38,6 +38,7 @@ void RTLSDRSettings::resetToDefaults()
m_noModMode = false;
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_rfBandwidth = 2500 * 1000; // Hz
}
QByteArray RTLSDRSettings::serialize() const
@ -56,6 +57,7 @@ QByteArray RTLSDRSettings::serialize() const
s.writeBool(11, m_noModMode);
s.writeBool(12, m_transverterMode);
s.writeS64(13, m_transverterDeltaFrequency);
s.writeU32(14, m_rfBandwidth);
return s.final();
}
@ -87,6 +89,7 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
d.readBool(11, &m_noModMode, false);
d.readBool(12, &m_transverterMode, false);
d.readS64(13, &m_transverterDeltaFrequency, 0);
d.readU32(4, &m_rfBandwidth, 2500 * 1000);
return true;
}

View File

@ -37,6 +37,7 @@ struct RTLSDRSettings {
bool m_noModMode;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
quint32 m_rfBandwidth; //!< RF filter bandwidth in Hz
RTLSDRSettings();
void resetToDefaults();