LimeSDR input: individual manually set gains: GUI part

This commit is contained in:
f4exb 2017-07-04 23:48:24 +02:00
parent 4079d84d74
commit c00acc6585
5 changed files with 282 additions and 30 deletions

View File

@ -268,10 +268,30 @@ void LimeSDRInputGUI::displaySettings()
ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000);
ui->gain->setValue(m_settings.m_gain);
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
ui->gainText->setText(tr("%1").arg(m_settings.m_gain));
ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath);
ui->gainMode->setCurrentIndex((int) m_settings.m_gainMode);
ui->lnaGain->setValue(m_settings.m_lnaGain);
ui->tiaGain->setCurrentIndex(m_settings.m_tiaGain - 1);
ui->pgaGain->setValue(m_settings.m_pgaGain);
if (m_settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO)
{
ui->gain->setEnabled(true);
ui->lnaGain->setEnabled(false);
ui->tiaGain->setEnabled(false);
ui->pgaGain->setEnabled(false);
}
else
{
ui->gain->setEnabled(false);
ui->lnaGain->setEnabled(true);
ui->tiaGain->setEnabled(true);
ui->pgaGain->setEnabled(true);
}
setNCODisplay();
ui->ncoEnable->setChecked(m_settings.m_ncoEnable);
@ -477,10 +497,52 @@ void LimeSDRInputGUI::on_lpFIR_changed(quint64 value)
}
}
void LimeSDRInputGUI::on_gainMode_currentIndexChanged(int index)
{
m_settings.m_gainMode = (LimeSDRInputSettings::GainMode) index;
if (index == 0)
{
ui->gain->setEnabled(true);
ui->lnaGain->setEnabled(false);
ui->tiaGain->setEnabled(false);
ui->pgaGain->setEnabled(false);
}
else
{
ui->gain->setEnabled(false);
ui->lnaGain->setEnabled(true);
ui->tiaGain->setEnabled(true);
ui->pgaGain->setEnabled(true);
}
sendSettings();
}
void LimeSDRInputGUI::on_gain_valueChanged(int value)
{
m_settings.m_gain = value;
ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain));
ui->gainText->setText(tr("%1").arg(m_settings.m_gain));
sendSettings();
}
void LimeSDRInputGUI::on_lnaGain_valueChanged(int value)
{
m_settings.m_lnaGain = value;
ui->lnaGainText->setText(tr("%1").arg(m_settings.m_lnaGain));
sendSettings();
}
void LimeSDRInputGUI::on_tiaGain_currentIndexChanged(int index)
{
m_settings.m_tiaGain = index + 1;
sendSettings();
}
void LimeSDRInputGUI::on_pgaGain_valueChanged(int value)
{
m_settings.m_pgaGain = value;
ui->pgaGainText->setText(tr("%1").arg(m_settings.m_pgaGain));
sendSettings();
}

View File

@ -87,7 +87,11 @@ private slots:
void on_lpf_changed(quint64 value);
void on_lpFIREnable_toggled(bool checked);
void on_lpFIR_changed(quint64 value);
void on_gainMode_currentIndexChanged(int index);
void on_gain_valueChanged(int value);
void on_lnaGain_valueChanged(int value);
void on_tiaGain_currentIndexChanged(int index);
void on_pgaGain_valueChanged(int value);
void on_antenna_currentIndexChanged(int index);
void updateHardware();

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<width>374</width>
<height>290</height>
</rect>
</property>
@ -550,19 +550,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="lpFIREnable">
<property name="toolTip">
@ -619,19 +606,38 @@
<number>2</number>
</property>
<item>
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>Gain</string>
<widget class="QComboBox" name="gainMode">
<property name="maximumSize">
<size>
<width>54</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Automatic or Manual gain selection</string>
</property>
<item>
<property name="text">
<string>Aut</string>
</property>
</item>
<item>
<property name="text">
<string>Man</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Global gain setting (dB)</string>
<widget class="QDial" name="gain">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="minimum">
<number>0</number>
<property name="toolTip">
<string>Automatic global gain (dB)</string>
</property>
<property name="maximum">
<number>70</number>
@ -642,30 +648,188 @@
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>40</width>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Global gain (dB)</string>
<string>Automatic global gain</string>
</property>
<property name="text">
<string>20dB</string>
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="lnaGain">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Manual LNA gain</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="sliderPosition">
<number>15</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lnaGainText">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Manual LNA gain (dB)</string>
</property>
<property name="text">
<string>15</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="tiaGain">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Manual TIA gain (dB)</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QDial" name="pgaGain">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Manual PGA gain</string>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="pgaGainText">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Manual PGA gain (dB)</string>
</property>
<property name="text">
<string>16</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="antennaLabel">
<property name="pixmap">

View File

@ -37,6 +37,10 @@ void LimeSDRInputSettings::resetToDefaults()
m_ncoEnable = false;
m_ncoFrequency = 0;
m_antennaPath = PATH_RFE_NONE;
m_gainMode = GAIN_AUTO;
m_lnaGain = 15;
m_tiaGain = 2;
m_pgaGain = 16;
}
QByteArray LimeSDRInputSettings::serialize() const
@ -55,6 +59,10 @@ QByteArray LimeSDRInputSettings::serialize() const
s.writeBool(11, m_ncoEnable);
s.writeS32(12, m_ncoFrequency);
s.writeS32(13, (int) m_antennaPath);
s.writeS32(14, (int) m_gainMode);
s.writeU32(15, m_lnaGain);
s.writeU32(16, m_tiaGain);
s.writeU32(17, m_pgaGain);
return s.final();
}
@ -86,6 +94,11 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data)
d.readS32(12, &m_ncoFrequency, 0);
d.readS32(13, &intval, 0);
m_antennaPath = (PathRFE) intval;
d.readS32(14, &intval, 0);
m_gainMode = (GainMode) intval;
d.readU32(15, &m_lnaGain, 15);
d.readU32(16, &m_tiaGain, 2);
d.readU32(17, &m_pgaGain, 16);
return true;
}

View File

@ -42,6 +42,11 @@ struct LimeSDRInputSettings
PATH_RFE_LB2
};
typedef enum {
GAIN_AUTO,
GAIN_MANUAL
} GainMode;
// global settings to be saved
uint64_t m_centerFrequency;
int m_devSampleRate;
@ -57,6 +62,10 @@ struct LimeSDRInputSettings
bool m_ncoEnable; //!< Enable TSP NCO and mixing
int m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed)
PathRFE m_antennaPath;
GainMode m_gainMode; //!< Gain mode: auto or manual
uint32_t m_lnaGain; //!< Manual LAN gain
uint32_t m_tiaGain; //!< Manual TIA gain
uint32_t m_pgaGain; //!< Manual PGA gain
LimeSDRInputSettings();
void resetToDefaults();