mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -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_sampleSink(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();
|
||||
ui->setupUi(this);
|
||||
@ -322,7 +325,16 @@ void SoapySDROutputGui::displaySettings()
|
||||
blockApplySettings(true);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -76,8 +76,8 @@ private:
|
||||
int m_lastEngineState;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
ItemSettingGUI *m_sampleRateGUI;
|
||||
StringRangeGUI *m_antennas;
|
||||
ItemSettingGUI *m_sampleRateGUI;
|
||||
ItemSettingGUI *m_bandwidthGUI;
|
||||
|
||||
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)
|
||||
{
|
||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
||||
|
@ -40,6 +40,7 @@ SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_sampleRate(0),
|
||||
m_deviceCenterFrequency(0),
|
||||
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted),
|
||||
m_antennas(0),
|
||||
m_sampleRateGUI(0),
|
||||
m_bandwidthGUI(0)
|
||||
{
|
||||
@ -170,7 +171,11 @@ void SoapySDRInputGui::createTunableElementsControl(const std::vector<DeviceSoap
|
||||
for (int i = 0; it != tunableElementsList.end(); ++it, i++)
|
||||
{
|
||||
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()));
|
||||
m_tunableElementsGUIs.push_back(gui);
|
||||
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)
|
||||
{
|
||||
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)
|
||||
@ -387,9 +394,16 @@ void SoapySDRInputGui::displaySettings()
|
||||
blockApplySettings(true);
|
||||
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
m_antennas->setValue(m_settings.m_antenna.toStdString());
|
||||
m_sampleRateGUI->setValue(m_settings.m_devSampleRate);
|
||||
m_bandwidthGUI->setValue(m_settings.m_bandwidth);
|
||||
|
||||
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->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||
@ -400,9 +414,23 @@ void SoapySDRInputGui::displaySettings()
|
||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
|
||||
displayTunableElementsControlSettings();
|
||||
|
||||
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()
|
||||
{
|
||||
if (!m_updateTimer.isActive()) {
|
||||
|
@ -83,6 +83,7 @@ private:
|
||||
std::vector<DynamicItemSettingGUI*> m_tunableElementsGUIs;
|
||||
|
||||
void displaySettings();
|
||||
void displayTunableElementsControlSettings();
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateFrequencyLimits();
|
||||
|
@ -28,6 +28,7 @@ public:
|
||||
|
||||
const QString& getName() const { return m_name; }
|
||||
double getValue() const { return m_itemSettingGUI->getCurrentValue(); }
|
||||
void setValue(double value) { m_itemSettingGUI->setValue(value); }
|
||||
|
||||
signals:
|
||||
void valueChanged(QString itemName, double value);
|
||||
@ -38,4 +39,4 @@ private slots:
|
||||
private:
|
||||
ItemSettingGUI *m_itemSettingGUI;
|
||||
QString m_name;
|
||||
};
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ void IntervalRangeGUI::reset()
|
||||
ui->rangeInterval->blockSignals(true);
|
||||
ui->rangeInterval->setCurrentIndex(0);
|
||||
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) {
|
||||
@ -88,14 +88,14 @@ void IntervalRangeGUI::setValue(double value)
|
||||
ui->value->setValue(value);
|
||||
}
|
||||
|
||||
void IntervalRangeGUI::on_value_changed(quint64 value)
|
||||
void IntervalRangeGUI::on_value_changed(qint64 value)
|
||||
{
|
||||
emit ItemSettingGUI::valueChanged(value);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
virtual void setValue(double value);
|
||||
|
||||
private slots:
|
||||
void on_value_changed(quint64 value);
|
||||
void on_value_changed(qint64 value);
|
||||
void on_rangeInterval_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>263</width>
|
||||
<height>30</height>
|
||||
<width>295</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -30,7 +30,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>262</width>
|
||||
<width>292</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -43,7 +43,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDial" name="value" native="true">
|
||||
<widget class="ValueDialZ" name="value" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
@ -52,7 +52,7 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<width>150</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -92,9 +92,9 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
Loading…
Reference in New Issue
Block a user