1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 15:04:38 -04:00

Implemented rtl-sdr ppm LO correction

This commit is contained in:
f4exb
2015-05-09 00:54:01 +02:00
parent bce4aff21d
commit 31fb81c66a
5 changed files with 74 additions and 2 deletions
@@ -35,6 +35,7 @@ void RTLSDRInput::Settings::resetToDefaults()
{
m_gain = 0;
m_samplerate = 1024000;
m_loPpmCorrection = 0;
}
QByteArray RTLSDRInput::Settings::serialize() const
@@ -42,6 +43,7 @@ QByteArray RTLSDRInput::Settings::serialize() const
SimpleSerializer s(1);
s.writeS32(1, m_gain);
s.writeS32(2, m_samplerate);
s.writeS32(3, m_loPpmCorrection);
return s.final();
}
@@ -57,6 +59,7 @@ bool RTLSDRInput::Settings::deserialize(const QByteArray& data)
if(d.getVersion() == 1) {
d.readS32(1, &m_gain, 0);
//d.readS32(2, &m_samplerate, 0);
d.readS32(3, &m_loPpmCorrection, 0);
return true;
} else {
resetToDefaults();
@@ -231,6 +234,17 @@ bool RTLSDRInput::applySettings(const GeneralSettings& generalSettings, const Se
}
}
if((m_settings.m_loPpmCorrection != settings.m_loPpmCorrection) || force) {
if(m_dev != NULL) {
if( rtlsdr_set_freq_correction(m_dev, settings.m_loPpmCorrection) < 0)
qCritical("could not set LO ppm correction: %d", settings.m_loPpmCorrection);
else {
m_settings.m_loPpmCorrection = settings.m_loPpmCorrection;
//m_rtlSDRThread->setSamplerate(settings.m_samplerate);
}
}
}
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
if(m_dev != NULL) {
if(rtlsdr_set_center_freq( m_dev, m_generalSettings.m_centerFrequency