mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-27 06:25:45 -04:00
Implemented rtl-sdr ppm LO correction
This commit is contained in:
parent
bce4aff21d
commit
31fb81c66a
@ -129,6 +129,15 @@ void RTLSDRGui::on_centerFrequency_changed(quint64 value)
|
|||||||
sendSettings();
|
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)
|
void RTLSDRGui::on_gain_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if(value > (int)m_gains.size())
|
if(value > (int)m_gains.size())
|
||||||
|
@ -44,6 +44,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
|
void on_ppm_valueChanged(int value);
|
||||||
void on_gain_valueChanged(int value);
|
void on_gain_valueChanged(int value);
|
||||||
void on_samplerate_valueChanged(int value);
|
void on_samplerate_valueChanged(int value);
|
||||||
void on_checkBox_stateChanged(int state);
|
void on_checkBox_stateChanged(int state);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>132</width>
|
<width>198</width>
|
||||||
<height>119</height>
|
<height>155</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -214,6 +214,53 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_1">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSlider" name="ppm">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-99</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="ppmText">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>ppm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -35,6 +35,7 @@ void RTLSDRInput::Settings::resetToDefaults()
|
|||||||
{
|
{
|
||||||
m_gain = 0;
|
m_gain = 0;
|
||||||
m_samplerate = 1024000;
|
m_samplerate = 1024000;
|
||||||
|
m_loPpmCorrection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray RTLSDRInput::Settings::serialize() const
|
QByteArray RTLSDRInput::Settings::serialize() const
|
||||||
@ -42,6 +43,7 @@ QByteArray RTLSDRInput::Settings::serialize() const
|
|||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
s.writeS32(1, m_gain);
|
s.writeS32(1, m_gain);
|
||||||
s.writeS32(2, m_samplerate);
|
s.writeS32(2, m_samplerate);
|
||||||
|
s.writeS32(3, m_loPpmCorrection);
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ bool RTLSDRInput::Settings::deserialize(const QByteArray& data)
|
|||||||
if(d.getVersion() == 1) {
|
if(d.getVersion() == 1) {
|
||||||
d.readS32(1, &m_gain, 0);
|
d.readS32(1, &m_gain, 0);
|
||||||
//d.readS32(2, &m_samplerate, 0);
|
//d.readS32(2, &m_samplerate, 0);
|
||||||
|
d.readS32(3, &m_loPpmCorrection, 0);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
resetToDefaults();
|
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;
|
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
|
||||||
if(m_dev != NULL) {
|
if(m_dev != NULL) {
|
||||||
if(rtlsdr_set_center_freq( m_dev, m_generalSettings.m_centerFrequency
|
if(rtlsdr_set_center_freq( m_dev, m_generalSettings.m_centerFrequency
|
||||||
|
@ -29,6 +29,7 @@ public:
|
|||||||
struct Settings {
|
struct Settings {
|
||||||
qint32 m_gain;
|
qint32 m_gain;
|
||||||
qint32 m_samplerate;
|
qint32 m_samplerate;
|
||||||
|
qint32 m_loPpmCorrection;
|
||||||
|
|
||||||
Settings();
|
Settings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user