RTLSDR: impemented RTLSDR AGC control

pull/60/head
f4exb 2017-07-23 16:57:13 +02:00
rodzic 3b095f4253
commit e9aa78a916
9 zmienionych plików z 38 dodań i 3 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 24 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 25 KiB

Wyświetl plik

@ -76,6 +76,8 @@ The I/Q stream from the RTLSDR ADC is doensampled by a power of two before being
Use this checkbox to activate the special RTLSDR direct sampling. This can be used to tune to HF frequencies.
<h3>9: RF gain</h2>
<h3>9: RF gain and AGC</h2>
This is the RF gain setting in dB. The values are defined in the RTLSDR device and generally are: 0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6
The slider sets RF gain in dB. The values are defined in the RTLSDR device and generally are: 0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6
The AGC checkbox can be used to switch on or off the RTL2838 AGC. This is independent of the gain setting as this AGC acts after the gain block.

Wyświetl plik

@ -407,6 +407,12 @@ void RTLSDRGui::on_checkBox_stateChanged(int state)
sendSettings();
}
void RTLSDRGui::on_agc_stateChanged(int state)
{
m_settings.m_agc = (state == Qt::Checked);
sendSettings();
}
void RTLSDRGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;

Wyświetl plik

@ -80,6 +80,7 @@ private slots:
void on_gain_valueChanged(int value);
void on_sampleRate_currentIndexChanged(int index);
void on_checkBox_stateChanged(int state);
void on_agc_stateChanged(int state);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void updateHardware();

Wyświetl plik

@ -483,6 +483,16 @@
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="3">
<widget class="QCheckBox" name="agc">
<property name="toolTip">
<string>Toggles RTLSDR AGC</string>
</property>
<property name="text">
<string>AGC</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="gainLabel">
<property name="sizePolicy">

Wyświetl plik

@ -256,6 +256,18 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
{
bool forwardChange = false;
if ((m_settings.m_agc != settings.m_agc) || force)
{
if (rtlsdr_set_agc_mode(m_dev, settings.m_agc ? 1 : 0) < 0)
{
qCritical("could not set AGC mode %s", settings.m_agc ? "on" : "off");
}
else
{
m_settings.m_agc = settings.m_agc;
}
}
if ((m_settings.m_gain != settings.m_gain) || force)
{
m_settings.m_gain = settings.m_gain;

Wyświetl plik

@ -11,7 +11,7 @@
const PluginDescriptor RTLSDRPlugin::m_pluginDescriptor = {
QString("RTL-SDR Input"),
QString("3.5.0"),
QString("3.5.2"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -34,6 +34,7 @@ void RTLSDRSettings::resetToDefaults()
m_fcPos = FC_POS_CENTER;
m_dcBlock = false;
m_iqImbalance = false;
m_agc = false;
}
QByteArray RTLSDRSettings::serialize() const
@ -48,6 +49,7 @@ QByteArray RTLSDRSettings::serialize() const
s.writeS32(7, (int) m_fcPos);
s.writeS32(8, m_devSampleRate);
s.writeBool(9, m_lowSampleRate);
s.writeBool(10, m_agc);
return s.final();
}
@ -75,6 +77,7 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
m_fcPos = (fcPos_t) intval;
d.readS32(8, &m_devSampleRate, 1024*1000);
d.readBool(9, &m_lowSampleRate, false);
d.readBool(10, &m_agc, false);
return true;
}

Wyświetl plik

@ -33,6 +33,7 @@ struct RTLSDRSettings {
fcPos_t m_fcPos;
bool m_dcBlock;
bool m_iqImbalance;
bool m_agc;
RTLSDRSettings();
void resetToDefaults();