mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
RTLSDR: impemented RTLSDR AGC control
This commit is contained in:
parent
3b095f4253
commit
e9aa78a916
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
@ -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.
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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">
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ struct RTLSDRSettings {
|
||||
fcPos_t m_fcPos;
|
||||
bool m_dcBlock;
|
||||
bool m_iqImbalance;
|
||||
bool m_agc;
|
||||
|
||||
RTLSDRSettings();
|
||||
void resetToDefaults();
|
||||
|
Loading…
Reference in New Issue
Block a user