2021-04-11 16:21:36 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
|
|
|
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
#include "sdrplayv3gui.h"
|
|
|
|
#include "sdrplayv3input.h"
|
|
|
|
|
|
|
|
#include "device/deviceapi.h"
|
|
|
|
#include "device/deviceuiset.h"
|
|
|
|
|
|
|
|
#include "ui_sdrplayv3gui.h"
|
|
|
|
#include "gui/colormapper.h"
|
|
|
|
#include "gui/glspectrum.h"
|
|
|
|
#include "gui/basicdevicesettingsdialog.h"
|
2022-12-20 05:31:15 -05:00
|
|
|
#include "gui/dialpopup.h"
|
|
|
|
#include "gui/dialogpositioner.h"
|
2021-04-11 16:21:36 -04:00
|
|
|
#include "dsp/dspengine.h"
|
|
|
|
#include "dsp/dspcommands.h"
|
|
|
|
|
|
|
|
SDRPlayV3Gui::SDRPlayV3Gui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|
|
|
DeviceGUI(parent),
|
|
|
|
ui(new Ui::SDRPlayV3Gui),
|
|
|
|
m_doApplySettings(true),
|
|
|
|
m_forceSettings(true)
|
|
|
|
{
|
2022-05-13 16:24:48 -04:00
|
|
|
m_deviceUISet = deviceUISet;
|
2022-04-07 10:32:03 -04:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
2021-04-11 16:21:36 -04:00
|
|
|
m_sdrPlayV3Input = (SDRPlayV3Input*) m_deviceUISet->m_deviceAPI->getSampleSource();
|
|
|
|
|
2022-04-07 10:32:03 -04:00
|
|
|
ui->setupUi(getContents());
|
2022-11-09 10:53:44 -05:00
|
|
|
sizeToContents();
|
2022-04-23 20:13:18 -04:00
|
|
|
getContents()->setStyleSheet("#SDRPlayV3Gui { background-color: rgb(64, 64, 64); }");
|
2022-04-07 10:32:03 -04:00
|
|
|
m_helpURL = "plugins/samplesource/sdrplayv3/readme.md";
|
2021-04-11 16:21:36 -04:00
|
|
|
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
2022-02-06 14:30:00 -05:00
|
|
|
updateFrequencyLimits();
|
2021-04-11 16:21:36 -04:00
|
|
|
|
|
|
|
ui->ifFrequency->clear();
|
|
|
|
for (unsigned int i = 0; i < SDRPlayV3IF::getNbIFs(); i++)
|
|
|
|
{
|
|
|
|
ui->ifFrequency->addItem(QString::number(SDRPlayV3IF::getIF(i)/1000));
|
|
|
|
}
|
|
|
|
|
2022-07-19 05:10:20 -04:00
|
|
|
ui->samplerate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
2021-04-11 16:21:36 -04:00
|
|
|
ui->samplerate->setValueRange(8, 2000000U, 10660000U);
|
|
|
|
|
|
|
|
ui->bandwidth->clear();
|
|
|
|
for (unsigned int i = 0; i < SDRPlayV3Bandwidths::getNbBandwidths(); i++)
|
|
|
|
{
|
|
|
|
ui->bandwidth->addItem(QString::number(SDRPlayV3Bandwidths::getBandwidth(i)/1000));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
|
|
|
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
|
|
|
m_statusTimer.start(500);
|
|
|
|
|
2022-04-16 19:31:50 -04:00
|
|
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
|
2021-04-11 16:21:36 -04:00
|
|
|
|
|
|
|
ui->tuner->blockSignals(true);
|
|
|
|
ui->antenna->blockSignals(true);
|
|
|
|
ui->tuner->clear();
|
|
|
|
ui->antenna->clear();
|
|
|
|
switch (m_sdrPlayV3Input->getDeviceId())
|
|
|
|
{
|
|
|
|
case SDRPLAY_RSP1_ID:
|
|
|
|
ui->tuner->addItem("1");
|
|
|
|
ui->antenna->addItem("50Ohm");
|
|
|
|
ui->amNotch->setVisible(false);
|
|
|
|
ui->biasTee->setVisible(false);
|
|
|
|
ui->extRef->setVisible(false);
|
|
|
|
break;
|
|
|
|
case SDRPLAY_RSP1A_ID:
|
|
|
|
ui->tuner->addItem("1");
|
|
|
|
ui->antenna->addItem("50Ohm");
|
|
|
|
ui->amNotch->setVisible(false);
|
|
|
|
ui->extRef->setVisible(false);
|
|
|
|
break;
|
|
|
|
case SDRPLAY_RSP2_ID:
|
|
|
|
ui->tuner->addItem("1");
|
|
|
|
ui->antenna->addItem("A");
|
|
|
|
ui->antenna->addItem("B");
|
|
|
|
ui->antenna->addItem("Hi-Z");
|
|
|
|
ui->amNotch->setVisible(false);
|
|
|
|
break;
|
|
|
|
case SDRPLAY_RSPduo_ID:
|
|
|
|
ui->tuner->addItem("1");
|
|
|
|
ui->tuner->addItem("2");
|
|
|
|
ui->antenna->addItem("50Ohm");
|
|
|
|
ui->antenna->addItem("Hi-Z");
|
|
|
|
ui->biasTee->setVisible(false);
|
|
|
|
break;
|
|
|
|
case SDRPLAY_RSPdx_ID:
|
|
|
|
ui->tuner->addItem("1");
|
|
|
|
ui->antenna->addItem("A");
|
|
|
|
ui->antenna->addItem("B");
|
|
|
|
ui->antenna->addItem("C");
|
|
|
|
ui->amNotch->setVisible(false);
|
|
|
|
ui->extRef->setVisible(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ui->tuner->blockSignals(false);
|
|
|
|
ui->antenna->blockSignals(false);
|
|
|
|
|
|
|
|
displaySettings();
|
2022-04-07 10:32:03 -04:00
|
|
|
makeUIConnections();
|
2021-04-11 16:21:36 -04:00
|
|
|
|
|
|
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
|
|
|
m_sdrPlayV3Input->setMessageQueueToGUI(&m_inputMessageQueue);
|
2022-12-20 05:31:15 -05:00
|
|
|
DialPopup::addPopupsToChildDials(this);
|
2021-04-11 16:21:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SDRPlayV3Gui::~SDRPlayV3Gui()
|
|
|
|
{
|
2022-10-05 10:40:09 -04:00
|
|
|
m_statusTimer.stop();
|
|
|
|
m_updateTimer.stop();
|
2021-04-11 16:21:36 -04:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::resetToDefaults()
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
2022-10-28 12:52:08 -04:00
|
|
|
m_forceSettings = true;
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray SDRPlayV3Gui::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SDRPlayV3Gui::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
if(m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
displaySettings();
|
|
|
|
m_forceSettings = true;
|
|
|
|
sendSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SDRPlayV3Gui::handleMessage(const Message& message)
|
|
|
|
{
|
|
|
|
if (SDRPlayV3Input::MsgConfigureSDRPlayV3::match(message))
|
|
|
|
{
|
|
|
|
const SDRPlayV3Input::MsgConfigureSDRPlayV3& cfg = (SDRPlayV3Input::MsgConfigureSDRPlayV3&) message;
|
2022-10-28 12:52:08 -04:00
|
|
|
|
|
|
|
if (cfg.getForce()) {
|
|
|
|
m_settings = cfg.getSettings();
|
|
|
|
} else {
|
|
|
|
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
|
|
|
}
|
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
blockApplySettings(true);
|
|
|
|
displaySettings();
|
|
|
|
blockApplySettings(false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (SDRPlayV3Input::MsgStartStop::match(message))
|
|
|
|
{
|
|
|
|
SDRPlayV3Input::MsgStartStop& notif = (SDRPlayV3Input::MsgStartStop&) message;
|
|
|
|
blockApplySettings(true);
|
|
|
|
ui->startStop->setChecked(notif.getStartStop());
|
|
|
|
blockApplySettings(false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::handleInputMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = m_inputMessageQueue.pop()) != 0)
|
|
|
|
{
|
|
|
|
qDebug("SDRPlayV3Gui::handleInputMessages: message: %s", message->getIdentifier());
|
|
|
|
|
|
|
|
if (DSPSignalNotification::match(*message))
|
|
|
|
{
|
|
|
|
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
|
|
|
m_sampleRate = notif->getSampleRate();
|
|
|
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
|
|
|
qDebug("SDRPlayV3Gui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
|
|
|
updateSampleRateAndFrequency();
|
|
|
|
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::updateSampleRateAndFrequency()
|
|
|
|
{
|
|
|
|
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
|
|
|
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
|
|
|
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
|
|
|
}
|
|
|
|
|
2022-02-06 14:30:00 -05:00
|
|
|
void SDRPlayV3Gui::updateFrequencyLimits()
|
|
|
|
{
|
|
|
|
// values in kHz
|
|
|
|
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
|
|
|
qint64 minLimit = 1U + deltaFrequency;
|
|
|
|
qint64 maxLimit = 2000000U + deltaFrequency;
|
|
|
|
|
2022-10-16 10:04:54 -04:00
|
|
|
if (m_settings.m_transverterMode)
|
|
|
|
{
|
|
|
|
minLimit = minLimit < 0 ? 0 : minLimit > 999999999 ? 999999999 : minLimit;
|
|
|
|
maxLimit = maxLimit < 0 ? 0 : maxLimit > 999999999 ? 999999999 : maxLimit;
|
|
|
|
ui->centerFrequency->setValueRange(9, minLimit, maxLimit);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
|
|
|
|
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
|
|
|
|
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
|
|
|
|
}
|
2022-02-06 14:30:00 -05:00
|
|
|
qDebug("SDRPlayV3Gui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
|
|
|
|
}
|
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
void SDRPlayV3Gui::displaySettings()
|
|
|
|
{
|
2022-02-06 14:30:00 -05:00
|
|
|
ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
|
|
|
|
ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
|
|
|
|
ui->transverter->setIQOrder(m_settings.m_iqOrder);
|
|
|
|
updateFrequencyLimits();
|
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
|
|
|
|
|
|
|
ui->ppm->setValue(m_settings.m_LOppmTenths);
|
|
|
|
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
|
|
|
|
|
|
|
ui->tuner->setCurrentIndex(m_settings.m_tuner);
|
|
|
|
ui->antenna->setCurrentIndex(m_settings.m_antenna);
|
|
|
|
|
|
|
|
ui->samplerate->setValue(m_settings.m_devSampleRate);
|
|
|
|
|
|
|
|
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
|
|
|
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
|
|
|
|
|
|
|
ui->extRef->setChecked(m_settings.m_extRef);
|
|
|
|
ui->biasTee->setChecked(m_settings.m_biasTee);
|
|
|
|
ui->amNotch->setChecked(m_settings.m_amNotch);
|
|
|
|
ui->fmNotch->setChecked(m_settings.m_fmNotch);
|
|
|
|
ui->dabNotch->setChecked(m_settings.m_dabNotch);
|
|
|
|
|
|
|
|
ui->bandwidth->setCurrentIndex(m_settings.m_bandwidthIndex);
|
|
|
|
ui->ifFrequency->setCurrentIndex(m_settings.m_ifFrequencyIndex);
|
|
|
|
ui->samplerate->setValue(m_settings.m_devSampleRate);
|
|
|
|
|
|
|
|
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
|
|
|
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
|
|
|
|
|
|
|
|
updateLNAValues();
|
|
|
|
ui->gainLNA->setCurrentIndex(m_settings.m_lnaIndex);
|
|
|
|
if (m_settings.m_ifAGC)
|
|
|
|
{
|
|
|
|
ui->gainIFAGC->setChecked(true);
|
|
|
|
ui->gainIF->setEnabled(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->gainIFAGC->setChecked(false);
|
|
|
|
ui->gainIF->setEnabled(true);
|
|
|
|
}
|
|
|
|
int gain = m_settings.m_ifGain;
|
|
|
|
ui->gainIF->setValue(gain);
|
|
|
|
QString gainText = QStringLiteral("%1").arg(gain, 2, 10, QLatin1Char('0'));
|
|
|
|
ui->gainIFText->setText(gainText);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::updateLNAValues()
|
|
|
|
{
|
|
|
|
int currentValue = ui->gainLNA->currentText().toInt();
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
const int *attenuations = SDRPlayV3LNA::getAttenuations(m_sdrPlayV3Input->getDeviceId(), m_settings.m_centerFrequency);
|
|
|
|
int len = attenuations[0];
|
|
|
|
ui->gainLNA->clear();
|
|
|
|
for (int i = 1; i <= len; i++)
|
|
|
|
{
|
|
|
|
if (attenuations[i] == 0)
|
|
|
|
ui->gainLNA->addItem("0");
|
|
|
|
else
|
|
|
|
ui->gainLNA->addItem(QString("-%1").arg(attenuations[i]));
|
|
|
|
|
|
|
|
// Find closest match
|
|
|
|
if ((attenuations[i] == -currentValue) || (!found && (attenuations[i] > -currentValue)))
|
|
|
|
{
|
|
|
|
ui->gainLNA->setCurrentIndex(i - 1);
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::sendSettings()
|
|
|
|
{
|
2022-10-28 12:52:08 -04:00
|
|
|
if (!m_updateTimer.isActive()) {
|
2021-04-11 16:21:36 -04:00
|
|
|
m_updateTimer.start(100);
|
2022-10-28 12:52:08 -04:00
|
|
|
}
|
2021-04-11 16:21:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::updateHardware()
|
|
|
|
{
|
2022-07-19 05:10:20 -04:00
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
qDebug() << "SDRPlayV3Gui::updateHardware";
|
2022-10-28 12:52:08 -04:00
|
|
|
SDRPlayV3Input::MsgConfigureSDRPlayV3* message = SDRPlayV3Input::MsgConfigureSDRPlayV3::create(m_settings, m_settingsKeys, m_forceSettings);
|
2022-07-19 05:10:20 -04:00
|
|
|
m_sdrPlayV3Input->getInputMessageQueue()->push(message);
|
|
|
|
m_forceSettings = false;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.clear();
|
2022-07-19 05:10:20 -04:00
|
|
|
m_updateTimer.stop();
|
|
|
|
}
|
2021-04-11 16:21:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::updateStatus()
|
|
|
|
{
|
|
|
|
int state = m_deviceUISet->m_deviceAPI->state();
|
|
|
|
|
|
|
|
if(m_lastEngineState != state)
|
|
|
|
{
|
|
|
|
switch(state)
|
|
|
|
{
|
|
|
|
case DeviceAPI::StNotStarted:
|
|
|
|
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
|
|
|
break;
|
|
|
|
case DeviceAPI::StIdle:
|
|
|
|
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
|
|
|
break;
|
|
|
|
case DeviceAPI::StRunning:
|
|
|
|
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
|
|
|
break;
|
|
|
|
case DeviceAPI::StError:
|
|
|
|
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
|
|
|
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_lastEngineState = state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_centerFrequency_changed(quint64 value)
|
|
|
|
{
|
|
|
|
m_settings.m_centerFrequency = value * 1000;
|
|
|
|
updateLNAValues();
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("centerFrequency");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_ppm_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_LOppmTenths = value;
|
|
|
|
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("LOppmTenths");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_tuner_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_tuner = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("tuner");
|
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
if (m_sdrPlayV3Input->getDeviceId() == SDRPLAY_RSPduo_ID)
|
|
|
|
{
|
|
|
|
ui->antenna->clear();
|
|
|
|
ui->antenna->addItem("50Ohm");
|
|
|
|
if (m_settings.m_tuner == 0)
|
|
|
|
ui->antenna->addItem("Hi-Z");
|
|
|
|
ui->amNotch->setVisible(index == 0);
|
|
|
|
ui->biasTee->setVisible(index == 1);
|
|
|
|
}
|
2022-10-28 12:52:08 -04:00
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_antenna_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_antenna = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("antenna");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_dcOffset_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_dcBlock = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("dcBlock");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_iqImbalance_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_iqCorrection = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("iqCorrection");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_extRef_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_extRef = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("extRef");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_biasTee_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_biasTee = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("biasTee");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_amNotch_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_amNotch = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("amNotch");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_fmNotch_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_fmNotch = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("fmNotch");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_dabNotch_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_dabNotch = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("dabNotch");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_bandwidth_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_bandwidthIndex = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("bandwidthIndex");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_samplerate_changed(quint64 value)
|
|
|
|
{
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settings.m_devSampleRate = (uint32_t) value;
|
|
|
|
m_settingsKeys.append("devSampleRate");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_ifFrequency_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_ifFrequencyIndex = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("ifFrequencyIndex");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_decim_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_log2Decim = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("log2Decim");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_fcPos_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_fcPos = (SDRPlayV3Settings::fcPos_t) index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("fcPos");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_gainLNA_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
m_settings.m_lnaIndex = index;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("lnaIndex");
|
2021-04-11 16:21:36 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_gainIFAGC_toggled(bool checked)
|
|
|
|
{
|
|
|
|
m_settings.m_ifAGC = checked;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("ifAGC");
|
2021-04-11 16:21:36 -04:00
|
|
|
ui->gainIF->setEnabled(!checked);
|
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_gainIF_valueChanged(int value)
|
|
|
|
{
|
|
|
|
m_settings.m_ifGain = value;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("ifGain");
|
2021-04-11 16:21:36 -04:00
|
|
|
|
|
|
|
QString gainText = QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0'));
|
|
|
|
ui->gainIFText->setText(gainText);
|
|
|
|
|
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRPlayV3Gui::on_startStop_toggled(bool checked)
|
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
SDRPlayV3Input::MsgStartStop *message = SDRPlayV3Input::MsgStartStop::create(checked);
|
|
|
|
m_sdrPlayV3Input->getInputMessageQueue()->push(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-06 14:30:00 -05:00
|
|
|
void SDRPlayV3Gui::on_transverter_clicked()
|
|
|
|
{
|
|
|
|
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
|
|
|
|
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
|
|
|
m_settings.m_iqOrder = ui->transverter->getIQOrder();
|
|
|
|
qDebug("SDRPlayV3Gui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
|
|
|
updateFrequencyLimits();
|
|
|
|
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("transverterMode");
|
|
|
|
m_settingsKeys.append("transverterDeltaFrequency");
|
|
|
|
m_settingsKeys.append("iqOrder");
|
|
|
|
m_settingsKeys.append("centerFrequency");
|
2022-02-06 14:30:00 -05:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
2021-04-11 16:21:36 -04:00
|
|
|
void SDRPlayV3Gui::openDeviceSettingsDialog(const QPoint& p)
|
|
|
|
{
|
2022-04-16 19:31:50 -04:00
|
|
|
if (m_contextMenuType == ContextMenuDeviceSettings)
|
|
|
|
{
|
|
|
|
BasicDeviceSettingsDialog dialog(this);
|
|
|
|
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
|
|
|
|
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
|
|
|
|
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
|
|
|
|
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
|
2021-04-11 16:21:36 -04:00
|
|
|
|
2022-04-16 19:31:50 -04:00
|
|
|
dialog.move(p);
|
2022-12-20 05:31:15 -05:00
|
|
|
new DialogPositioner(&dialog, false);
|
2022-04-16 19:31:50 -04:00
|
|
|
dialog.exec();
|
2021-04-11 16:21:36 -04:00
|
|
|
|
2022-04-16 19:31:50 -04:00
|
|
|
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
|
|
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
|
|
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
|
|
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
2022-10-28 12:52:08 -04:00
|
|
|
m_settingsKeys.append("useReverseAPI");
|
|
|
|
m_settingsKeys.append("reverseAPIAddress");
|
|
|
|
m_settingsKeys.append("reverseAPIPort");
|
|
|
|
m_settingsKeys.append("reverseAPIDeviceIndex");
|
2021-04-11 16:21:36 -04:00
|
|
|
|
2022-04-16 19:31:50 -04:00
|
|
|
sendSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
resetContextMenuType();
|
2021-04-11 16:21:36 -04:00
|
|
|
}
|
2022-04-07 10:32:03 -04:00
|
|
|
|
|
|
|
void SDRPlayV3Gui::makeUIConnections()
|
|
|
|
{
|
|
|
|
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &SDRPlayV3Gui::on_centerFrequency_changed);
|
|
|
|
QObject::connect(ui->ppm, &QSlider::valueChanged, this, &SDRPlayV3Gui::on_ppm_valueChanged);
|
|
|
|
QObject::connect(ui->tuner, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_tuner_currentIndexChanged);
|
|
|
|
QObject::connect(ui->antenna, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_antenna_currentIndexChanged);
|
|
|
|
QObject::connect(ui->dcOffset, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_dcOffset_toggled);
|
|
|
|
QObject::connect(ui->iqImbalance, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_iqImbalance_toggled);
|
|
|
|
QObject::connect(ui->extRef, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_extRef_toggled);
|
|
|
|
QObject::connect(ui->biasTee, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_biasTee_toggled);
|
|
|
|
QObject::connect(ui->amNotch, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_amNotch_toggled);
|
|
|
|
QObject::connect(ui->fmNotch, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_fmNotch_toggled);
|
|
|
|
QObject::connect(ui->dabNotch, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_dabNotch_toggled);
|
|
|
|
QObject::connect(ui->bandwidth, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_bandwidth_currentIndexChanged);
|
|
|
|
QObject::connect(ui->samplerate, &ValueDial::changed, this, &SDRPlayV3Gui::on_samplerate_changed);
|
|
|
|
QObject::connect(ui->ifFrequency, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_ifFrequency_currentIndexChanged);
|
|
|
|
QObject::connect(ui->decim, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_decim_currentIndexChanged);
|
|
|
|
QObject::connect(ui->fcPos, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_fcPos_currentIndexChanged);
|
|
|
|
QObject::connect(ui->gainLNA, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SDRPlayV3Gui::on_gainLNA_currentIndexChanged);
|
|
|
|
QObject::connect(ui->gainIFAGC, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_gainIFAGC_toggled);
|
|
|
|
QObject::connect(ui->gainIF, &QDial::valueChanged, this, &SDRPlayV3Gui::on_gainIF_valueChanged);
|
|
|
|
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &SDRPlayV3Gui::on_startStop_toggled);
|
|
|
|
QObject::connect(ui->transverter, &TransverterButton::clicked, this, &SDRPlayV3Gui::on_transverter_clicked);
|
|
|
|
}
|