mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
SoapySDR support: output: AGC GUI
This commit is contained in:
parent
f97091e0f3
commit
ef672300d2
@ -201,6 +201,11 @@ void SoapySDROutput::getGlobalGainRange(int& min, int& max)
|
||||
}
|
||||
}
|
||||
|
||||
bool SoapySDROutput::isAGCSupported()
|
||||
{
|
||||
const DeviceSoapySDRParams::ChannelSettings* channelSettings = m_deviceShared.m_deviceParams->getTxChannelSettings(m_deviceShared.m_channel);
|
||||
return channelSettings->m_hasAGC;
|
||||
}
|
||||
|
||||
const SoapySDR::RangeList& SoapySDROutput::getRateRanges()
|
||||
{
|
||||
@ -888,6 +893,22 @@ bool SoapySDROutput::applySettings(const SoapySDROutputSettings& settings, bool
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_autoGain != settings.m_autoGain) || force)
|
||||
{
|
||||
if (dev != 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
dev->setGainMode(SOAPY_SDR_TX, requestedChannel, settings.m_autoGain);
|
||||
qDebug("SoapySDROutput::applySettings: %s AGC", settings.m_autoGain ? "set" : "unset");
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
qCritical("SoapySDROutput::applySettings: cannot %s AGC", settings.m_autoGain ? "set" : "unset");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (forwardChangeOwnDSP)
|
||||
{
|
||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Interp);
|
||||
|
@ -127,6 +127,7 @@ public:
|
||||
|
||||
void getFrequencyRange(uint64_t& min, uint64_t& max);
|
||||
void getGlobalGainRange(int& min, int& max);
|
||||
bool isAGCSupported();
|
||||
const SoapySDR::RangeList& getRateRanges();
|
||||
const std::vector<std::string>& getAntennas();
|
||||
const SoapySDR::RangeList& getBandwidthRanges();
|
||||
|
@ -15,6 +15,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
@ -43,7 +44,8 @@ SoapySDROutputGui::SoapySDROutputGui(DeviceUISet *deviceUISet, QWidget* parent)
|
||||
m_antennas(0),
|
||||
m_sampleRateGUI(0),
|
||||
m_bandwidthGUI(0),
|
||||
m_gainSliderGUI(0)
|
||||
m_gainSliderGUI(0),
|
||||
m_autoGain(0)
|
||||
{
|
||||
m_sampleSink = (SoapySDROutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
||||
ui->setupUi(this);
|
||||
@ -196,6 +198,21 @@ void SoapySDROutputGui::createGlobalGainControl()
|
||||
m_gainSliderGUI->setUnits(QString(""));
|
||||
|
||||
QVBoxLayout *layout = (QVBoxLayout *) ui->scrollAreaWidgetContents->layout();
|
||||
|
||||
QFrame *line = new QFrame(this);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
layout->addWidget(line);
|
||||
|
||||
if (m_sampleSink->isAGCSupported())
|
||||
{
|
||||
m_autoGain = new QCheckBox(this);
|
||||
m_autoGain->setText(QString("AGC"));
|
||||
layout->addWidget(m_autoGain);
|
||||
|
||||
connect(m_autoGain, SIGNAL(toggled(bool)), this, SLOT(autoGainChanged(bool)));
|
||||
}
|
||||
|
||||
layout->addWidget(m_gainSliderGUI);
|
||||
|
||||
connect(m_gainSliderGUI, SIGNAL(valueChanged(double)), this, SLOT(globalGainChanged(double)));
|
||||
@ -375,6 +392,12 @@ void SoapySDROutputGui::globalGainChanged(double gain)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SoapySDROutputGui::autoGainChanged(bool set)
|
||||
{
|
||||
m_settings.m_autoGain = set;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SoapySDROutputGui::individualGainChanged(QString name, double value)
|
||||
{
|
||||
m_settings.m_individualGains[name] = value;
|
||||
@ -439,6 +462,9 @@ void SoapySDROutputGui::displaySettings()
|
||||
if (m_gainSliderGUI) {
|
||||
m_gainSliderGUI->setValue(m_settings.m_globalGain);
|
||||
}
|
||||
if (m_autoGain) {
|
||||
m_autoGain->setChecked(m_settings.m_autoGain);
|
||||
}
|
||||
|
||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||
|
||||
|
@ -32,6 +32,7 @@ class ItemSettingGUI;
|
||||
class StringRangeGUI;
|
||||
class DynamicItemSettingGUI;
|
||||
class IntervalSliderGUI;
|
||||
class QCheckBox;
|
||||
|
||||
namespace Ui {
|
||||
class SoapySDROutputGui;
|
||||
@ -87,6 +88,7 @@ private:
|
||||
std::vector<DynamicItemSettingGUI*> m_tunableElementsGUIs;
|
||||
IntervalSliderGUI *m_gainSliderGUI;
|
||||
std::vector<DynamicItemSettingGUI*> m_individualGainsGUIs;
|
||||
QCheckBox *m_autoGain;
|
||||
|
||||
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
||||
void displaySettings();
|
||||
@ -104,6 +106,7 @@ private slots:
|
||||
void bandwidthChanged(double bandwidth);
|
||||
void tunableElementChanged(QString name, double value);
|
||||
void globalGainChanged(double gain);
|
||||
void autoGainChanged(bool set);
|
||||
void individualGainChanged(QString name, double value);
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_LOppm_valueChanged(int value);
|
||||
|
@ -289,13 +289,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_freq">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
@ -307,7 +300,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>318</width>
|
||||
<height>51</height>
|
||||
<height>53</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
@ -37,6 +37,7 @@ void SoapySDROutputSettings::resetToDefaults()
|
||||
m_antenna = "NONE";
|
||||
m_bandwidth = 1000000;
|
||||
m_globalGain = 0;
|
||||
m_autoGain = false;
|
||||
}
|
||||
|
||||
QByteArray SoapySDROutputSettings::serialize() const
|
||||
@ -53,6 +54,7 @@ QByteArray SoapySDROutputSettings::serialize() const
|
||||
s.writeBlob(8, serializeNamedElementMap(m_tunableElements));
|
||||
s.writeS32(12, m_globalGain);
|
||||
s.writeBlob(13, serializeNamedElementMap(m_individualGains));
|
||||
s.writeBool(14, m_autoGain);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -83,6 +85,7 @@ bool SoapySDROutputSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(12, &m_globalGain, 0);
|
||||
d.readBlob(13, &blob);
|
||||
deserializeNamedElementMap(blob, m_individualGains);
|
||||
d.readBool(14, &m_autoGain, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -108,4 +111,4 @@ void SoapySDROutputSettings::deserializeNamedElementMap(const QByteArray& data,
|
||||
QDataStream *stream = new QDataStream(data);
|
||||
(*stream) >> map;
|
||||
delete stream;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ struct SoapySDROutputSettings {
|
||||
QMap<QString, double> m_tunableElements;
|
||||
qint32 m_globalGain;
|
||||
QMap<QString, double> m_individualGains;
|
||||
bool m_autoGain;
|
||||
|
||||
SoapySDROutputSettings();
|
||||
void resetToDefaults();
|
||||
|
Loading…
Reference in New Issue
Block a user