diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp
index d254eb016..5fd10cf60 100644
--- a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp
+++ b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp
@@ -129,6 +129,15 @@ void RTLSDRGui::on_centerFrequency_changed(quint64 value)
sendSettings();
}
+void RTLSDRGui::on_ppm_valueChanged(int value)
+{
+ if((value > 99) || (value < -99))
+ return;
+ ui->ppmText->setText(tr("%1").arg(value));
+ m_settings.m_loPpmCorrection = value;
+ sendSettings();
+}
+
void RTLSDRGui::on_gain_valueChanged(int value)
{
if(value > (int)m_gains.size())
diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.h b/plugins/samplesource/rtlsdr/rtlsdrgui.h
index c5031dba0..5fe3ee225 100644
--- a/plugins/samplesource/rtlsdr/rtlsdrgui.h
+++ b/plugins/samplesource/rtlsdr/rtlsdrgui.h
@@ -44,6 +44,7 @@ private:
private slots:
void on_centerFrequency_changed(quint64 value);
+ void on_ppm_valueChanged(int value);
void on_gain_valueChanged(int value);
void on_samplerate_valueChanged(int value);
void on_checkBox_stateChanged(int state);
diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.ui b/plugins/samplesource/rtlsdr/rtlsdrgui.ui
index a363e470b..182db9797 100644
--- a/plugins/samplesource/rtlsdr/rtlsdrgui.ui
+++ b/plugins/samplesource/rtlsdr/rtlsdrgui.ui
@@ -6,8 +6,8 @@
0
0
- 132
- 119
+ 198
+ 155
@@ -214,6 +214,53 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ 3
+
+
-
+
+
+ -99
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 40
+ 0
+
+
+
+ 0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ ppm
+
+
+
+
+
-
diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp
index f27a0844c..a1d6f1a71 100644
--- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp
+++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp
@@ -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
diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.h b/plugins/samplesource/rtlsdr/rtlsdrinput.h
index 34dfb71a0..f3fdbc64e 100644
--- a/plugins/samplesource/rtlsdr/rtlsdrinput.h
+++ b/plugins/samplesource/rtlsdr/rtlsdrinput.h
@@ -29,6 +29,7 @@ public:
struct Settings {
qint32 m_gain;
qint32 m_samplerate;
+ qint32 m_loPpmCorrection;
Settings();
void resetToDefaults();