mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
SoapySDR support: tunable elements GUIs fixes
This commit is contained in:
parent
0f14527039
commit
6ea676d5c4
@ -37,7 +37,10 @@ SoapySDROutputGui::SoapySDROutputGui(DeviceUISet *deviceUISet, QWidget* parent)
|
|||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_sampleSink(0),
|
m_sampleSink(0),
|
||||||
m_sampleRate(0),
|
m_sampleRate(0),
|
||||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
|
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
|
||||||
|
m_antennas(0),
|
||||||
|
m_sampleRateGUI(0),
|
||||||
|
m_bandwidthGUI(0)
|
||||||
{
|
{
|
||||||
m_sampleSink = (SoapySDROutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
m_sampleSink = (SoapySDROutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -322,7 +325,16 @@ void SoapySDROutputGui::displaySettings()
|
|||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
|
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
|
|
||||||
|
if (m_antennas) {
|
||||||
|
m_antennas->setValue(m_settings.m_antenna.toStdString());
|
||||||
|
}
|
||||||
|
if (m_sampleRateGUI) {
|
||||||
|
m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
|
||||||
|
}
|
||||||
|
if (m_bandwidthGUI) {
|
||||||
|
m_bandwidthGUI->setValue(m_settings.m_bandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ private:
|
|||||||
int m_lastEngineState;
|
int m_lastEngineState;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
ItemSettingGUI *m_sampleRateGUI;
|
|
||||||
StringRangeGUI *m_antennas;
|
StringRangeGUI *m_antennas;
|
||||||
|
ItemSettingGUI *m_sampleRateGUI;
|
||||||
ItemSettingGUI *m_bandwidthGUI;
|
ItemSettingGUI *m_bandwidthGUI;
|
||||||
|
|
||||||
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
||||||
|
@ -812,6 +812,31 @@ bool SoapySDRInput::applySettings(const SoapySDRInputSettings& settings, bool fo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto &oname : m_settings.m_tunableElements.keys())
|
||||||
|
{
|
||||||
|
auto nvalue = settings.m_tunableElements.find(oname);
|
||||||
|
|
||||||
|
if (nvalue != settings.m_tunableElements.end() && (m_settings.m_tunableElements[oname] != *nvalue))
|
||||||
|
{
|
||||||
|
if (dev != 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dev->setFrequency(SOAPY_SDR_RX, requestedChannel, oname.toStdString(), *nvalue);
|
||||||
|
qDebug("SoapySDRInput::applySettings: tunable element %s frequency set to %lf",
|
||||||
|
oname.toStdString().c_str(), *nvalue);
|
||||||
|
}
|
||||||
|
catch (const std::exception &ex)
|
||||||
|
{
|
||||||
|
qCritical("SoapySDRInput::applySettings: cannot set tunable element %s to %lf: %s",
|
||||||
|
oname.toStdString().c_str(), *nvalue, ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings.m_tunableElements[oname] = *nvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (forwardChangeOwnDSP)
|
if (forwardChangeOwnDSP)
|
||||||
{
|
{
|
||||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
||||||
|
@ -40,6 +40,7 @@ SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
m_sampleRate(0),
|
m_sampleRate(0),
|
||||||
m_deviceCenterFrequency(0),
|
m_deviceCenterFrequency(0),
|
||||||
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted),
|
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted),
|
||||||
|
m_antennas(0),
|
||||||
m_sampleRateGUI(0),
|
m_sampleRateGUI(0),
|
||||||
m_bandwidthGUI(0)
|
m_bandwidthGUI(0)
|
||||||
{
|
{
|
||||||
@ -170,7 +171,11 @@ void SoapySDRInputGui::createTunableElementsControl(const std::vector<DeviceSoap
|
|||||||
for (int i = 0; it != tunableElementsList.end(); ++it, i++)
|
for (int i = 0; it != tunableElementsList.end(); ++it, i++)
|
||||||
{
|
{
|
||||||
ItemSettingGUI *rangeGUI;
|
ItemSettingGUI *rangeGUI;
|
||||||
createRangesControl(&rangeGUI, it->m_ranges, QString("%1 freq").arg(it->m_name.c_str()), QString("Hz"));
|
createRangesControl(
|
||||||
|
&rangeGUI,
|
||||||
|
it->m_ranges,
|
||||||
|
QString("%1 freq").arg(it->m_name.c_str()),
|
||||||
|
QString((it->m_name == "CORR") ? "ppm" : "Hz"));
|
||||||
DynamicItemSettingGUI *gui = new DynamicItemSettingGUI(rangeGUI, QString(it->m_name.c_str()));
|
DynamicItemSettingGUI *gui = new DynamicItemSettingGUI(rangeGUI, QString(it->m_name.c_str()));
|
||||||
m_tunableElementsGUIs.push_back(gui);
|
m_tunableElementsGUIs.push_back(gui);
|
||||||
connect(m_tunableElementsGUIs.back(), SIGNAL(valueChanged(QString, double)), this, SLOT(tunableElementChanged(QString, double)));
|
connect(m_tunableElementsGUIs.back(), SIGNAL(valueChanged(QString, double)), this, SLOT(tunableElementChanged(QString, double)));
|
||||||
@ -302,6 +307,8 @@ void SoapySDRInputGui::bandwidthChanged(double bandwidth)
|
|||||||
void SoapySDRInputGui::tunableElementChanged(QString name, double value)
|
void SoapySDRInputGui::tunableElementChanged(QString name, double value)
|
||||||
{
|
{
|
||||||
qDebug("SoapySDRInputGui::tunableElementChanged: name: %s value: %lf", name.toStdString().c_str(), value);
|
qDebug("SoapySDRInputGui::tunableElementChanged: name: %s value: %lf", name.toStdString().c_str(), value);
|
||||||
|
m_settings.m_tunableElements[name] = value;
|
||||||
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoapySDRInputGui::on_centerFrequency_changed(quint64 value)
|
void SoapySDRInputGui::on_centerFrequency_changed(quint64 value)
|
||||||
@ -387,9 +394,16 @@ void SoapySDRInputGui::displaySettings()
|
|||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
|
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
m_antennas->setValue(m_settings.m_antenna.toStdString());
|
|
||||||
m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
|
if (m_antennas) {
|
||||||
m_bandwidthGUI->setValue(m_settings.m_bandwidth);
|
m_antennas->setValue(m_settings.m_antenna.toStdString());
|
||||||
|
}
|
||||||
|
if (m_sampleRateGUI) {
|
||||||
|
m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
|
||||||
|
}
|
||||||
|
if (m_bandwidthGUI) {
|
||||||
|
m_bandwidthGUI->setValue(m_settings.m_bandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||||
@ -400,9 +414,23 @@ void SoapySDRInputGui::displaySettings()
|
|||||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||||
|
|
||||||
|
displayTunableElementsControlSettings();
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoapySDRInputGui::displayTunableElementsControlSettings()
|
||||||
|
{
|
||||||
|
for (const auto &it : m_tunableElementsGUIs)
|
||||||
|
{
|
||||||
|
QMap<QString, double>::const_iterator elIt = m_settings.m_tunableElements.find(it->getName());
|
||||||
|
|
||||||
|
if (elIt != m_settings.m_tunableElements.end()) {
|
||||||
|
it->setValue(*elIt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SoapySDRInputGui::sendSettings()
|
void SoapySDRInputGui::sendSettings()
|
||||||
{
|
{
|
||||||
if (!m_updateTimer.isActive()) {
|
if (!m_updateTimer.isActive()) {
|
||||||
|
@ -83,6 +83,7 @@ private:
|
|||||||
std::vector<DynamicItemSettingGUI*> m_tunableElementsGUIs;
|
std::vector<DynamicItemSettingGUI*> m_tunableElementsGUIs;
|
||||||
|
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
|
void displayTunableElementsControlSettings();
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
void updateSampleRateAndFrequency();
|
void updateSampleRateAndFrequency();
|
||||||
void updateFrequencyLimits();
|
void updateFrequencyLimits();
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
const QString& getName() const { return m_name; }
|
const QString& getName() const { return m_name; }
|
||||||
double getValue() const { return m_itemSettingGUI->getCurrentValue(); }
|
double getValue() const { return m_itemSettingGUI->getCurrentValue(); }
|
||||||
|
void setValue(double value) { m_itemSettingGUI->setValue(value); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged(QString itemName, double value);
|
void valueChanged(QString itemName, double value);
|
||||||
@ -38,4 +39,4 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
ItemSettingGUI *m_itemSettingGUI;
|
ItemSettingGUI *m_itemSettingGUI;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ void IntervalRangeGUI::reset()
|
|||||||
ui->rangeInterval->blockSignals(true);
|
ui->rangeInterval->blockSignals(true);
|
||||||
ui->rangeInterval->setCurrentIndex(0);
|
ui->rangeInterval->setCurrentIndex(0);
|
||||||
ui->rangeInterval->blockSignals(false);
|
ui->rangeInterval->blockSignals(false);
|
||||||
ui->value->setValueRange(m_nbDigits, m_minima[0], m_maxima[0]);
|
ui->value->setValueRange(m_minima[0] >= 0, m_nbDigits, m_minima[0], m_maxima[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_minima.size() == 1) {
|
if (m_minima.size() == 1) {
|
||||||
@ -88,14 +88,14 @@ void IntervalRangeGUI::setValue(double value)
|
|||||||
ui->value->setValue(value);
|
ui->value->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntervalRangeGUI::on_value_changed(quint64 value)
|
void IntervalRangeGUI::on_value_changed(qint64 value)
|
||||||
{
|
{
|
||||||
emit ItemSettingGUI::valueChanged(value);
|
emit ItemSettingGUI::valueChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntervalRangeGUI::on_rangeInterval_currentIndexChanged(int index)
|
void IntervalRangeGUI::on_rangeInterval_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
ui->value->setValueRange(m_nbDigits, m_minima[index], m_maxima[index]);
|
ui->value->setValueRange(m_minima[index] >= 0, m_nbDigits, m_minima[index], m_maxima[index]);
|
||||||
emit ItemSettingGUI::valueChanged(ui->value->getValueNew());
|
emit ItemSettingGUI::valueChanged(ui->value->getValueNew());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
virtual void setValue(double value);
|
virtual void setValue(double value);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_value_changed(quint64 value);
|
void on_value_changed(qint64 value);
|
||||||
void on_rangeInterval_currentIndexChanged(int index);
|
void on_rangeInterval_currentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>263</width>
|
<width>295</width>
|
||||||
<height>30</height>
|
<height>33</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>262</width>
|
<width>292</width>
|
||||||
<height>29</height>
|
<height>29</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ValueDial" name="value" native="true">
|
<widget class="ValueDialZ" name="value" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>120</width>
|
<width>150</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -92,9 +92,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ValueDial</class>
|
<class>ValueDialZ</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>gui/valuedial.h</header>
|
<header>gui/valuedialz.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
Loading…
Reference in New Issue
Block a user