mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
HackRF output plugin: fixed Tx output power setting
This commit is contained in:
parent
64246c5c6a
commit
095b1cbab1
@ -313,34 +313,15 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (hackrf_error) hackrf_set_vga_gain(m_dev, m_settings.m_vgaGain);
|
||||
rc = (hackrf_error) hackrf_set_txvga_gain(m_dev, m_settings.m_vgaGain);
|
||||
|
||||
if(rc != HACKRF_SUCCESS)
|
||||
{
|
||||
qDebug("HackRFOutput::applySettings: hackrf_set_vga_gain failed: %s", hackrf_error_name(rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "HackRFOutput:applySettings: VGA gain set to " << m_settings.m_vgaGain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_txvgaGain != settings.m_txvgaGain) || force)
|
||||
{
|
||||
m_settings.m_txvgaGain = settings.m_txvgaGain;
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
rc = (hackrf_error) hackrf_set_txvga_gain(m_dev, m_settings.m_txvgaGain);
|
||||
|
||||
if (rc != HACKRF_SUCCESS)
|
||||
{
|
||||
qDebug("HackRFOutput::applySettings: hackrf_set_txvga_gain failed: %s", hackrf_error_name(rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "HackRFOutput:applySettings: TxVGA gain set to " << m_settings.m_txvgaGain;
|
||||
qDebug() << "HackRFOutput:applySettings: TxVGA gain set to " << m_settings.m_vgaGain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,14 +174,11 @@ void HackRFOutputGui::displaySettings()
|
||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||
|
||||
ui->lnaExt->setChecked(m_settings.m_lnaExt);
|
||||
ui->vgaGainText->setText(tr("%1dB").arg(m_settings.m_vgaGain));
|
||||
ui->vga->setValue(m_settings.m_vgaGain);
|
||||
ui->txvgaGainText->setText(tr("%1dB").arg(m_settings.m_vgaGain));
|
||||
ui->txvga->setValue(m_settings.m_vgaGain);
|
||||
|
||||
unsigned int bandwidthIndex = HackRFBandwidths::getBandwidthIndex(m_settings.m_bandwidth/1000);
|
||||
ui->bbFilter->setCurrentIndex(bandwidthIndex);
|
||||
|
||||
ui->txvgaGainText->setText(tr("%1dB").arg(m_settings.m_txvgaGain));
|
||||
ui->txvga->setValue(m_settings.m_txvgaGain);
|
||||
}
|
||||
|
||||
void HackRFOutputGui::displaySampleRates()
|
||||
@ -283,16 +280,6 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void HackRFOutputGui::on_vga_valueChanged(int value)
|
||||
{
|
||||
if ((value < 0) || (value > 62))
|
||||
return;
|
||||
|
||||
ui->vgaGainText->setText(tr("%1dB").arg(value));
|
||||
m_settings.m_vgaGain = value;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void HackRFOutputGui::on_txvga_valueChanged(int value)
|
||||
{
|
||||
if ((value < 0) || (value > 47))
|
||||
|
@ -83,7 +83,6 @@ private slots:
|
||||
void on_biasT_stateChanged(int state);
|
||||
void on_interp_currentIndexChanged(int index);
|
||||
void on_lnaExt_stateChanged(int state);
|
||||
void on_vga_valueChanged(int value);
|
||||
void on_bbFilter_currentIndexChanged(int index);
|
||||
void on_txvga_valueChanged(int value);
|
||||
void on_startStop_toggled(bool checked);
|
||||
|
@ -348,73 +348,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_vga">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="vgaGainLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>42</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>VGA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="vga">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>LNA gain dB</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>62</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="vgaGainText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_txvga" columnstretch="0,0,0">
|
||||
<property name="spacing">
|
||||
@ -422,14 +355,8 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="txvgaGainLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>42</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TxVGA</string>
|
||||
<string>VGA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -464,7 +391,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0dB</string>
|
||||
<string>22 dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -33,9 +33,8 @@ void HackRFOutputSettings::resetToDefaults()
|
||||
m_biasT = false;
|
||||
m_log2Interp = 0;
|
||||
m_lnaExt = false;
|
||||
m_vgaGain = 30;
|
||||
m_vgaGain = 22;
|
||||
m_bandwidth = 1750000;
|
||||
m_txvgaGain = 22;
|
||||
}
|
||||
|
||||
QByteArray HackRFOutputSettings::serialize() const
|
||||
@ -49,7 +48,6 @@ QByteArray HackRFOutputSettings::serialize() const
|
||||
s.writeBool(5, m_lnaExt);
|
||||
s.writeU32(6, m_vgaGain);
|
||||
s.writeU32(7, m_bandwidth);
|
||||
s.writeU32(8, m_txvgaGain);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -75,7 +73,6 @@ bool HackRFOutputSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(5, &m_lnaExt, false);
|
||||
d.readU32(6, &m_vgaGain, 30);
|
||||
d.readU32(7, &m_bandwidth, 1750000);
|
||||
d.readU32(8, &m_txvgaGain, 22);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ struct HackRFOutputSettings {
|
||||
quint32 m_devSampleRate;
|
||||
quint32 m_bandwidth;
|
||||
quint32 m_vgaGain;
|
||||
quint32 m_txvgaGain;
|
||||
quint32 m_log2Interp;
|
||||
bool m_biasT;
|
||||
bool m_lnaExt;
|
||||
|
Loading…
Reference in New Issue
Block a user