1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

RTLSDR: implemented offset tuning

This commit is contained in:
f4exb 2018-11-26 08:54:06 +01:00
parent bc7ad10f9d
commit 772a150136
6 changed files with 38 additions and 5 deletions

View File

@ -261,6 +261,7 @@ void RTLSDRGui::displaySettings()
ui->checkBox->setChecked(m_settings.m_noModMode);
ui->agc->setChecked(m_settings.m_agc);
ui->lowSampleRate->setChecked(m_settings.m_lowSampleRate);
ui->offsetTuning->setChecked(m_settings.m_offsetTuning);
}
void RTLSDRGui::sendSettings()
@ -441,6 +442,12 @@ void RTLSDRGui::on_sampleRate_changed(quint64 value)
sendSettings();
}
void RTLSDRGui::on_offsetTuning_toggled(bool checked)
{
m_settings.m_offsetTuning = checked;
sendSettings();
}
void RTLSDRGui::on_rfBW_changed(quint64 value)
{
m_settings.m_rfBandwidth = value * 1000;

View File

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

View File

@ -493,6 +493,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="offsetTuning">
<property name="toolTip">
<string>Offset tuning</string>
</property>
<property name="text">
<string>Ofs</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWabel">
<property name="text">

View File

@ -507,17 +507,28 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
if (m_dev != 0)
{
if (rtlsdr_set_tuner_bandwidth( m_dev, m_settings.m_rfBandwidth) != 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
{
} else {
qDebug() << "RTLSDRInput::applySettings: set RF bandwidth to " << m_settings.m_rfBandwidth;
}
}
}
if ((m_settings.m_offsetTuning != settings.m_offsetTuning) || force)
{
m_settings.m_offsetTuning = settings.m_offsetTuning;
if (m_dev != 0)
{
if (rtlsdr_set_offset_tuning(m_dev, m_settings.m_offsetTuning ? 0 : 1) != 0) {
qCritical("RTLSDRInput::applySettings: could not set offset tuning to %s", m_settings.m_offsetTuning ? "on" : "off");
} else {
qDebug("RTLSDRInput::applySettings: offset tuning set to %s", m_settings.m_offsetTuning ? "on" : "off");
}
}
}
if (forwardChange)
{
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);

View File

@ -40,6 +40,7 @@ void RTLSDRSettings::resetToDefaults()
m_transverterDeltaFrequency = 0;
m_rfBandwidth = 2500 * 1000; // Hz
m_fileRecordName = "";
m_offsetTuning = false;
}
QByteArray RTLSDRSettings::serialize() const
@ -59,6 +60,7 @@ QByteArray RTLSDRSettings::serialize() const
s.writeBool(12, m_transverterMode);
s.writeS64(13, m_transverterDeltaFrequency);
s.writeU32(14, m_rfBandwidth);
s.writeBool(15, m_offsetTuning);
return s.final();
}
@ -91,6 +93,7 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
d.readBool(12, &m_transverterMode, false);
d.readS64(13, &m_transverterDeltaFrequency, 0);
d.readU32(4, &m_rfBandwidth, 2500 * 1000);
d.readBool(15, &m_offsetTuning, false);
return true;
}

View File

@ -41,6 +41,7 @@ struct RTLSDRSettings {
qint64 m_transverterDeltaFrequency;
quint32 m_rfBandwidth; //!< RF filter bandwidth in Hz
QString m_fileRecordName;
bool m_offsetTuning;
RTLSDRSettings();
void resetToDefaults();