mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Airspy: implemented LNA and Mixer AGC controls
This commit is contained in:
parent
fa2d9aecf5
commit
2a194ca44e
@ -28,7 +28,7 @@ AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
ui(new Ui::AirspyGui),
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_settings(),
|
||||
m_sampleSource(NULL)
|
||||
m_sampleSource(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||
@ -156,6 +156,9 @@ void AirspyGui::displaySettings()
|
||||
|
||||
ui->vgaText->setText(tr("%1dB").arg(m_settings.m_vgaGain));
|
||||
ui->vga->setValue(m_settings.m_vgaGain);
|
||||
|
||||
ui->lnaAGC->setChecked(m_settings.m_lnaAGC);
|
||||
ui->mixAGC->setChecked(m_settings.m_mixerAGC);
|
||||
}
|
||||
|
||||
void AirspyGui::displaySampleRates()
|
||||
@ -228,6 +231,18 @@ void AirspyGui::on_biasT_stateChanged(int state)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_lnaAGC_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_lnaAGC = (state == Qt::Checked);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_mixAGC_stateChanged(int state)
|
||||
{
|
||||
m_settings.m_mixerAGC = (state == Qt::Checked);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_decim_valueChanged(int value)
|
||||
{
|
||||
if ((value <0) || (value > 6))
|
||||
|
@ -76,6 +76,8 @@ private slots:
|
||||
void on_lna_valueChanged(int value);
|
||||
void on_mix_valueChanged(int value);
|
||||
void on_vga_valueChanged(int value);
|
||||
void on_lnaAGC_stateChanged(int state);
|
||||
void on_mixAGC_stateChanged(int state);
|
||||
void updateHardware();
|
||||
void handleSourceMessages();
|
||||
};
|
||||
|
@ -338,7 +338,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lnaGainText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -346,6 +346,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0dB</string>
|
||||
</property>
|
||||
@ -354,6 +357,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QCheckBox" name="lnaAGC">
|
||||
<property name="toolTip">
|
||||
<string>Toggle LNA AGC</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AGC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -406,6 +419,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="mixAGC">
|
||||
<property name="toolTip">
|
||||
<string>Toggle mixer AGC</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AGC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -463,17 +486,17 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -350,6 +350,25 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lnaAGC != settings.m_lnaAGC) || force)
|
||||
{
|
||||
m_settings.m_lnaAGC = settings.m_lnaAGC;
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_lna_agc(m_dev, (m_settings.m_lnaAGC ? 1 : 0));
|
||||
}
|
||||
|
||||
if(rc != AIRSPY_SUCCESS)
|
||||
{
|
||||
qDebug("AirspyInput::applySettings: airspy_set_lna_agc failed: %s", airspy_error_name(rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "AirspyInput:applySettings: LNA AGC set to " << m_settings.m_lnaAGC;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_mixerGain != settings.m_mixerGain) || force)
|
||||
{
|
||||
m_settings.m_mixerGain = settings.m_mixerGain;
|
||||
@ -369,6 +388,25 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_mixerAGC != settings.m_mixerAGC) || force)
|
||||
{
|
||||
m_settings.m_mixerAGC = settings.m_mixerAGC;
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (airspy_error) airspy_set_mixer_agc(m_dev, (m_settings.m_mixerAGC ? 1 : 0));
|
||||
}
|
||||
|
||||
if(rc != AIRSPY_SUCCESS)
|
||||
{
|
||||
qDebug("AirspyInput::applySettings: airspy_set_mixer_agc failed: %s", airspy_error_name(rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "AirspyInput:applySettings: Mixer AGC set to " << m_settings.m_mixerAGC;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_vgaGain != settings.m_vgaGain) || force)
|
||||
{
|
||||
m_settings.m_vgaGain = settings.m_vgaGain;
|
||||
|
@ -31,6 +31,8 @@ void AirspySettings::resetToDefaults()
|
||||
m_lnaGain = 14;
|
||||
m_mixerGain = 15;
|
||||
m_vgaGain = 4;
|
||||
m_lnaAGC = false;
|
||||
m_mixerAGC = false;
|
||||
m_log2Decim = 0;
|
||||
m_fcPos = FC_POS_CENTER;
|
||||
m_biasT = false;
|
||||
@ -52,6 +54,8 @@ QByteArray AirspySettings::serialize() const
|
||||
s.writeBool(8, m_biasT);
|
||||
s.writeBool(9, m_dcBlock);
|
||||
s.writeBool(10, m_iqCorrection);
|
||||
s.writeBool(11, m_lnaAGC);
|
||||
s.writeBool(12, m_mixerAGC);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -81,6 +85,8 @@ bool AirspySettings::deserialize(const QByteArray& data)
|
||||
d.readBool(8, &m_biasT, false);
|
||||
d.readBool(9, &m_dcBlock, false);
|
||||
d.readBool(10, &m_iqCorrection, false);
|
||||
d.readBool(11, &m_lnaAGC, false);
|
||||
d.readBool(12, &m_mixerAGC, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ struct AirspySettings {
|
||||
quint32 m_lnaGain;
|
||||
quint32 m_mixerGain;
|
||||
quint32 m_vgaGain;
|
||||
bool m_lnaAGC;
|
||||
bool m_mixerAGC;
|
||||
quint32 m_log2Decim;
|
||||
fcPos_t m_fcPos;
|
||||
bool m_biasT;
|
||||
|
Loading…
Reference in New Issue
Block a user