mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Metis MISO: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
a2813cf9a8
commit
0263155122
@ -89,7 +89,7 @@ void MetisMISO::destroy()
|
||||
|
||||
void MetisMISO::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
bool MetisMISO::startRx()
|
||||
@ -103,7 +103,7 @@ bool MetisMISO::startRx()
|
||||
|
||||
mutexLocker.unlock();
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return true;
|
||||
@ -120,7 +120,7 @@ bool MetisMISO::startTx()
|
||||
|
||||
mutexLocker.unlock();
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return true;
|
||||
@ -177,12 +177,12 @@ bool MetisMISO::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureMetisMISO* message = MsgConfigureMetisMISO::create(m_settings, true);
|
||||
MsgConfigureMetisMISO* message = MsgConfigureMetisMISO::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureMetisMISO* messageToGUI = MsgConfigureMetisMISO::create(m_settings, true);
|
||||
MsgConfigureMetisMISO* messageToGUI = MsgConfigureMetisMISO::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -219,13 +219,15 @@ void MetisMISO::setSourceCenterFrequency(qint64 centerFrequency, int index)
|
||||
if (index < MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
settings.m_rxCenterFrequencies[index] = centerFrequency;
|
||||
QList<QString> settingsKeys;
|
||||
settingsKeys.append(tr("rx%1CenterFrequency").arg(index+1));
|
||||
|
||||
MsgConfigureMetisMISO* message = MsgConfigureMetisMISO::create(settings, false);
|
||||
MsgConfigureMetisMISO* message = MsgConfigureMetisMISO::create(settings, settingsKeys, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureMetisMISO* messageToGUI = MsgConfigureMetisMISO::create(settings, false);
|
||||
MsgConfigureMetisMISO* messageToGUI = MsgConfigureMetisMISO::create(settings, settingsKeys, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -238,10 +240,9 @@ bool MetisMISO::handleMessage(const Message& message)
|
||||
MsgConfigureMetisMISO& conf = (MsgConfigureMetisMISO&) message;
|
||||
qDebug() << "MetisMISO::handleMessage: MsgConfigureMetisMISO";
|
||||
|
||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
||||
bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
|
||||
|
||||
if (!success)
|
||||
{
|
||||
if (!success) {
|
||||
qDebug("MetisMISO::handleMessage: config error");
|
||||
}
|
||||
|
||||
@ -282,152 +283,73 @@ bool MetisMISO::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force)
|
||||
bool MetisMISO::applySettings(const MetisMISOSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
qDebug() << "MetisMISO::applySettings: "
|
||||
<< " m_nbReceivers:" << settings.m_nbReceivers
|
||||
<< " m_txEnable:" << settings.m_txEnable
|
||||
<< " m_rx1CenterFrequencies: ["
|
||||
<< " 1:" << settings.m_rxCenterFrequencies[0]
|
||||
<< " 2:" << settings.m_rxCenterFrequencies[1]
|
||||
<< " 3:" << settings.m_rxCenterFrequencies[2]
|
||||
<< " 4:" << settings.m_rxCenterFrequencies[3]
|
||||
<< " 5:" << settings.m_rxCenterFrequencies[4]
|
||||
<< " 6:" << settings.m_rxCenterFrequencies[5]
|
||||
<< " 7:" << settings.m_rxCenterFrequencies[6]
|
||||
<< " 8:" << settings.m_rxCenterFrequencies[7]
|
||||
<< " ] m_txCenterFrequency:" << settings.m_txCenterFrequency
|
||||
<< " m_rxSubsamplingIndexes: ["
|
||||
<< " 1:" << settings.m_rxSubsamplingIndexes[0]
|
||||
<< " 2:" << settings.m_rxSubsamplingIndexes[1]
|
||||
<< " 3:" << settings.m_rxSubsamplingIndexes[2]
|
||||
<< " 4:" << settings.m_rxSubsamplingIndexes[3]
|
||||
<< " 5:" << settings.m_rxSubsamplingIndexes[4]
|
||||
<< " 6:" << settings.m_rxSubsamplingIndexes[5]
|
||||
<< " 7:" << settings.m_rxSubsamplingIndexes[6]
|
||||
<< " 8:" << settings.m_rxSubsamplingIndexes[7]
|
||||
<< " ] m_rxTransverterMode:" << settings.m_rxTransverterMode
|
||||
<< " m_rxTransverterDeltaFrequency:" << settings.m_rxTransverterDeltaFrequency
|
||||
<< " m_txTransverterMode:" << settings.m_txTransverterMode
|
||||
<< " m_txTransverterDeltaFrequency:" << settings.m_txTransverterDeltaFrequency
|
||||
<< " m_iqOrder:" << settings.m_iqOrder
|
||||
<< " m_sampleRateIndex:" << settings.m_sampleRateIndex
|
||||
<< " m_log2Decim:" << settings.m_log2Decim
|
||||
<< " m_preamp:" << settings.m_preamp
|
||||
<< " m_random:" << settings.m_random
|
||||
<< " m_dither:" << settings.m_dither
|
||||
<< " m_duplex:" << settings.m_duplex
|
||||
<< " m_dcBlock:" << settings.m_dcBlock
|
||||
<< " m_iqCorrection:" << settings.m_iqCorrection
|
||||
<< " m_txDrive:" << settings.m_txDrive
|
||||
<< " m_streamIndex:" << settings.m_streamIndex
|
||||
<< " m_spectrumStreamIndex:" << settings.m_spectrumStreamIndex
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
||||
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex;
|
||||
qDebug() << "MetisMISO::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||
|
||||
bool propagateSettings = false;
|
||||
|
||||
if ((m_settings.m_nbReceivers != settings.m_nbReceivers) || force)
|
||||
{
|
||||
reverseAPIKeys.append("nbReceivers");
|
||||
if (settingsKeys.contains("nbReceivers") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_txEnable != settings.m_txEnable) || force)
|
||||
{
|
||||
reverseAPIKeys.append("txEnable");
|
||||
if (settingsKeys.contains("txEnable") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MetisMISOSettings::m_maxReceivers; i++)
|
||||
{
|
||||
if ((m_settings.m_rxCenterFrequencies[i] != settings.m_rxCenterFrequencies[i]) || force)
|
||||
{
|
||||
reverseAPIKeys.append(QString("rx%1CenterFrequency").arg(i+1));
|
||||
if (settingsKeys.contains(QString("rx%1CenterFrequency").arg(i+1)) || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_rxSubsamplingIndexes[i] != settings.m_rxSubsamplingIndexes[i]) || force)
|
||||
{
|
||||
reverseAPIKeys.append(QString("rx%1SubsamplingIndex").arg(i+1));
|
||||
if (settingsKeys.contains(QString("rx%1SubsamplingIndex").arg(i+1)) || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_txCenterFrequency != settings.m_txCenterFrequency) || force)
|
||||
{
|
||||
reverseAPIKeys.append("txCenterFrequency");
|
||||
if (settingsKeys.contains("txCenterFrequency") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_rxTransverterMode != settings.m_rxTransverterMode) || force)
|
||||
{
|
||||
reverseAPIKeys.append("rxTransverterMode");
|
||||
if (settingsKeys.contains("rxTransverterMode") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_rxTransverterDeltaFrequency != settings.m_rxTransverterDeltaFrequency) || force)
|
||||
{
|
||||
reverseAPIKeys.append("rxTransverterDeltaFrequency");
|
||||
if (settingsKeys.contains("rxTransverterDeltaFrequency") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_txTransverterMode != settings.m_txTransverterMode) || force)
|
||||
{
|
||||
reverseAPIKeys.append("txTransverterMode");
|
||||
if (settingsKeys.contains("txTransverterMode") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_txTransverterDeltaFrequency != settings.m_txTransverterDeltaFrequency) || force)
|
||||
{
|
||||
reverseAPIKeys.append("txTransverterDeltaFrequency");
|
||||
if (settingsKeys.contains("txTransverterDeltaFrequency") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
if (settingsKeys.contains("iqOrder") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_sampleRateIndex != settings.m_sampleRateIndex) || force)
|
||||
{
|
||||
reverseAPIKeys.append("sampleRateIndex");
|
||||
if (settingsKeys.contains("sampleRateIndex") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Decim");
|
||||
if (settingsKeys.contains("log2Decim") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
{
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force) {
|
||||
reverseAPIKeys.append("dcBlock");
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force) {
|
||||
reverseAPIKeys.append("iqCorrection");
|
||||
}
|
||||
|
||||
if ((m_settings.m_txDrive != settings.m_txDrive) || force)
|
||||
{
|
||||
reverseAPIKeys.append("txDrive");
|
||||
if (settingsKeys.contains("txDrive") || force) {
|
||||
propagateSettings = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) ||
|
||||
(m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
if (settingsKeys.contains("dcBlock") ||
|
||||
settingsKeys.contains("iqCorrection") || force)
|
||||
{
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection, 0);
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection, 1);
|
||||
@ -435,9 +357,9 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force)
|
||||
|
||||
for (int i = 0; i < MetisMISOSettings::m_maxReceivers; i++)
|
||||
{
|
||||
if ((m_settings.m_rxCenterFrequencies[i] != settings.m_rxCenterFrequencies[i]) ||
|
||||
(m_settings.m_sampleRateIndex != settings.m_sampleRateIndex) ||
|
||||
(m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
if (settingsKeys.contains(QString("rx%1CenterFrequency").arg(i+1)) ||
|
||||
settingsKeys.contains("sampleRateIndex") ||
|
||||
settingsKeys.contains("log2Decim") || force)
|
||||
{
|
||||
int devSampleRate = (1<<settings.m_sampleRateIndex) * 48000;
|
||||
int sampleRate = devSampleRate / (1<<settings.m_log2Decim);
|
||||
@ -447,36 +369,33 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_txCenterFrequency != settings.m_txCenterFrequency) || force)
|
||||
if (settingsKeys.contains("txCenterFrequency") || force)
|
||||
{
|
||||
DSPMIMOSignalNotification *engineTxNotif = new DSPMIMOSignalNotification(
|
||||
48000, settings.m_txCenterFrequency, false, 0);
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineTxNotif);
|
||||
}
|
||||
|
||||
if ((m_settings.m_streamIndex != settings.m_streamIndex) || force) {
|
||||
reverseAPIKeys.append("streamIndex");
|
||||
}
|
||||
|
||||
if ((m_settings.m_spectrumStreamIndex != settings.m_spectrumStreamIndex) || force) {
|
||||
reverseAPIKeys.append("spectrumStreamIndex");
|
||||
}
|
||||
|
||||
if (propagateSettings) {
|
||||
m_udpHandler.applySettings(settings);
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
qDebug("MetisMISO::applySettings: call webapiReverseSendSettings");
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIDeviceIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -547,12 +466,12 @@ int MetisMISO::webapiSettingsPutPatch(
|
||||
MetisMISOSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureMetisMISO *msg = MsgConfigureMetisMISO::create(settings, force);
|
||||
MsgConfigureMetisMISO *msg = MsgConfigureMetisMISO::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureMetisMISO *msgToGUI = MsgConfigureMetisMISO::create(settings, force);
|
||||
MsgConfigureMetisMISO *msgToGUI = MsgConfigureMetisMISO::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
|
@ -41,20 +41,22 @@ public:
|
||||
|
||||
public:
|
||||
const MetisMISOSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureMetisMISO* create(const MetisMISOSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureMetisMISO(settings, force);
|
||||
static MsgConfigureMetisMISO* create(const MetisMISOSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureMetisMISO(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
MetisMISOSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureMetisMISO(const MetisMISOSettings& settings, bool force) :
|
||||
MsgConfigureMetisMISO(const MetisMISOSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -158,7 +160,7 @@ private:
|
||||
|
||||
void startMetis();
|
||||
void stopMetis();
|
||||
bool applySettings(const MetisMISOSettings& settings, bool force);
|
||||
bool applySettings(const MetisMISOSettings& settings, const QList<QString>& settingsKeys, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const MetisMISOSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
|
@ -92,15 +92,21 @@ void MetisMISOGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
if (m_settings.m_streamIndex < MetisMISOSettings::m_maxReceivers) {
|
||||
if (m_settings.m_streamIndex < MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
m_settings.m_rxCenterFrequencies[m_settings.m_streamIndex] = centerFrequency;
|
||||
} else if (m_settings.m_streamIndex == MetisMISOSettings::m_maxReceivers) {
|
||||
m_settingsKeys.append(QString("rx%1CenterFrequency").arg(m_settings.m_streamIndex+1));
|
||||
}
|
||||
else if (m_settings.m_streamIndex == MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
m_settings.m_txCenterFrequency = centerFrequency;
|
||||
m_settingsKeys.append("txCenterFrequency");
|
||||
}
|
||||
|
||||
displaySettings();
|
||||
@ -145,6 +151,7 @@ void MetisMISOGui::on_streamIndex_currentIndexChanged(int index)
|
||||
if (ui->streamLock->isChecked())
|
||||
{
|
||||
m_settings.m_spectrumStreamIndex = index;
|
||||
m_settingsKeys.append("spectrumStreamIndex");
|
||||
|
||||
if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
@ -167,6 +174,7 @@ void MetisMISOGui::on_streamIndex_currentIndexChanged(int index)
|
||||
}
|
||||
|
||||
m_settings.m_streamIndex = index;
|
||||
m_settingsKeys.append("streamIndex");
|
||||
sendSettings();
|
||||
|
||||
updateSubsamplingIndex();
|
||||
@ -177,6 +185,7 @@ void MetisMISOGui::on_streamIndex_currentIndexChanged(int index)
|
||||
void MetisMISOGui::on_spectrumSource_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_spectrumStreamIndex = index;
|
||||
m_settingsKeys.append("spectrumStreamIndex");
|
||||
|
||||
if (m_settings.m_spectrumStreamIndex < MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
@ -199,6 +208,7 @@ void MetisMISOGui::on_spectrumSource_currentIndexChanged(int index)
|
||||
ui->streamIndex->setCurrentIndex(index);
|
||||
ui->streamIndex->blockSignals(false);
|
||||
m_settings.m_streamIndex = index;
|
||||
m_settingsKeys.append("streamIndex");
|
||||
updateSubsamplingIndex();
|
||||
displayFrequency();
|
||||
displaySampleRate();
|
||||
@ -218,15 +228,21 @@ void MetisMISOGui::on_LOppm_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_LOppmTenths = value;
|
||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
m_settingsKeys.append("LOppmTenths");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
if (m_settings.m_streamIndex < MetisMISOSettings::m_maxReceivers) {
|
||||
if (m_settings.m_streamIndex < MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
m_settings.m_rxCenterFrequencies[m_settings.m_streamIndex] = value * 1000;
|
||||
} else if (m_settings.m_streamIndex == MetisMISOSettings::m_maxReceivers) {
|
||||
m_settingsKeys.append(QString("rx%1CenterFrequency").arg(m_settings.m_streamIndex+1));
|
||||
}
|
||||
else if (m_settings.m_streamIndex == MetisMISOSettings::m_maxReceivers)
|
||||
{
|
||||
m_settings.m_txCenterFrequency = value * 1000;
|
||||
m_settingsKeys.append("txCenterFrequency");
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
@ -235,6 +251,7 @@ void MetisMISOGui::on_centerFrequency_changed(quint64 value)
|
||||
void MetisMISOGui::on_samplerateIndex_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_sampleRateIndex = index < 0 ? 0 : index > 3 ? 3 : index;
|
||||
m_settingsKeys.append("sampleRateIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -242,6 +259,7 @@ void MetisMISOGui::on_log2Decim_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_log2Decim = index < 0 ? 0 : index > 3 ? 3 : index;
|
||||
// displaySampleRate();
|
||||
m_settingsKeys.append("log2Decim");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -250,6 +268,7 @@ void MetisMISOGui::on_subsamplingIndex_currentIndexChanged(int index)
|
||||
if (m_settings.m_streamIndex < MetisMISOSettings::m_maxReceivers) // valid for Rx only
|
||||
{
|
||||
m_settings.m_rxSubsamplingIndexes[m_settings.m_streamIndex] = index;
|
||||
m_settingsKeys.append(QString("rx%1SubsamplingIndex").arg(m_settings.m_streamIndex+1));
|
||||
ui->subsamplingIndex->setToolTip(tr("Subsampling band index [%1 - %2 MHz]")
|
||||
.arg(index*61.44).arg((index+1)*61.44));
|
||||
displayFrequency();
|
||||
@ -261,12 +280,14 @@ void MetisMISOGui::on_subsamplingIndex_currentIndexChanged(int index)
|
||||
void MetisMISOGui::on_dcBlock_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_iqCorrection_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
m_settingsKeys.append("iqCorrection");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -277,12 +298,17 @@ void MetisMISOGui::on_transverter_clicked()
|
||||
m_settings.m_rxTransverterMode = ui->transverter->getDeltaFrequencyAcive();
|
||||
m_settings.m_rxTransverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
||||
m_settings.m_iqOrder = ui->transverter->getIQOrder();
|
||||
m_settingsKeys.append("rxTransverterMode");
|
||||
m_settingsKeys.append("rxTransverterDeltaFrequency");
|
||||
m_settingsKeys.append("iqOrder");
|
||||
qDebug("MetisMISOGui::on_transverter_clicked: Rx: %lld Hz %s", m_settings.m_rxTransverterDeltaFrequency, m_settings.m_rxTransverterMode ? "on" : "off");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.m_txTransverterMode = ui->transverter->getDeltaFrequencyAcive();
|
||||
m_settings.m_txTransverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
||||
m_settingsKeys.append("txTransverterMode");
|
||||
m_settingsKeys.append("txTransverterDeltaFrequency");
|
||||
qDebug("MetisMISOGui::on_transverter_clicked: Tx: %lld Hz %s", m_settings.m_txTransverterDeltaFrequency, m_settings.m_txTransverterMode ? "on" : "off");
|
||||
}
|
||||
|
||||
@ -294,36 +320,42 @@ void MetisMISOGui::on_transverter_clicked()
|
||||
void MetisMISOGui::on_preamp_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_preamp = checked;
|
||||
m_settingsKeys.append("preamp");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_random_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_random = checked;
|
||||
m_settingsKeys.append("random");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_dither_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dither = checked;
|
||||
m_settingsKeys.append("dither");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_duplex_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_duplex = checked;
|
||||
m_settingsKeys.append("duplex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_nbRxIndex_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_nbReceivers = index + 1;
|
||||
m_settingsKeys.append("nbReceivers");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void MetisMISOGui::on_txEnable_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_txEnable = checked;
|
||||
m_settingsKeys.append("txEnable");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -331,6 +363,7 @@ void MetisMISOGui::on_txDrive_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_txDrive = value;
|
||||
ui->txDriveText->setText(tr("%1").arg(m_settings.m_txDrive));
|
||||
m_settingsKeys.append("txDrive");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -365,7 +398,7 @@ void MetisMISOGui::displaySettings()
|
||||
|
||||
void MetisMISOGui::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive()) {
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
@ -374,9 +407,10 @@ void MetisMISOGui::updateHardware()
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
MetisMISO::MsgConfigureMetisMISO* message = MetisMISO::MsgConfigureMetisMISO::create(m_settings, m_forceSettings);
|
||||
MetisMISO::MsgConfigureMetisMISO* message = MetisMISO::MsgConfigureMetisMISO::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleMIMO->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -385,7 +419,7 @@ void MetisMISOGui::updateStatus()
|
||||
{
|
||||
int state = m_deviceUISet->m_deviceAPI->state();
|
||||
|
||||
if(m_lastEngineState != state)
|
||||
if (m_lastEngineState != state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
@ -416,11 +450,17 @@ bool MetisMISOGui::handleMessage(const Message& message)
|
||||
{
|
||||
qDebug("MetisMISOGui::handleMessage: MsgConfigureMetisMISO");
|
||||
const MetisMISO::MsgConfigureMetisMISO& cfg = (MetisMISO::MsgConfigureMetisMISO&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
if ((m_settings.m_spectrumStreamIndex != m_settings.m_streamIndex) && (ui->streamLock->isChecked()))
|
||||
{
|
||||
m_settings.m_spectrumStreamIndex = m_settings.m_streamIndex;
|
||||
m_settingsKeys.append("spectrumStreamIndex");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -584,6 +624,10 @@ void MetisMISOGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ private:
|
||||
Ui::MetisMISOGui* ui;
|
||||
|
||||
MetisMISOSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
int m_rxSampleRate;
|
||||
int m_txSampleRate;
|
||||
QTimer m_updateTimer;
|
||||
|
@ -185,6 +185,259 @@ bool MetisMISOSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void MetisMISOSettings::applySettings(const QStringList& settingsKeys, const MetisMISOSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("nbReceivers")) {
|
||||
m_nbReceivers = settings.m_nbReceivers;
|
||||
}
|
||||
if (settingsKeys.contains("txEnable")) {
|
||||
m_txEnable = settings.m_txEnable;
|
||||
}
|
||||
if (settingsKeys.contains("rx1CenterFrequency")) {
|
||||
m_rxCenterFrequencies[0] = settings.m_rxCenterFrequencies[0];
|
||||
}
|
||||
if (settingsKeys.contains("rx2CenterFrequency")) {
|
||||
m_rxCenterFrequencies[1] = settings.m_rxCenterFrequencies[1];
|
||||
}
|
||||
if (settingsKeys.contains("rx3CenterFrequency")) {
|
||||
m_rxCenterFrequencies[2] = settings.m_rxCenterFrequencies[2];
|
||||
}
|
||||
if (settingsKeys.contains("rx4CenterFrequency")) {
|
||||
m_rxCenterFrequencies[3] = settings.m_rxCenterFrequencies[3];
|
||||
}
|
||||
if (settingsKeys.contains("rx5CenterFrequency")) {
|
||||
m_rxCenterFrequencies[4] = settings.m_rxCenterFrequencies[4];
|
||||
}
|
||||
if (settingsKeys.contains("rx6CenterFrequency")) {
|
||||
m_rxCenterFrequencies[5] = settings.m_rxCenterFrequencies[5];
|
||||
}
|
||||
if (settingsKeys.contains("rx7CenterFrequency")) {
|
||||
m_rxCenterFrequencies[6] = settings.m_rxCenterFrequencies[6];
|
||||
}
|
||||
if (settingsKeys.contains("rx8CenterFrequency")) {
|
||||
m_rxCenterFrequencies[7] = settings.m_rxCenterFrequencies[7];
|
||||
}
|
||||
if (settingsKeys.contains("rx1SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[0] = settings.m_rxSubsamplingIndexes[0];
|
||||
}
|
||||
if (settingsKeys.contains("rx2SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[1] = settings.m_rxSubsamplingIndexes[1];
|
||||
}
|
||||
if (settingsKeys.contains("rx3SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[2] = settings.m_rxSubsamplingIndexes[2];
|
||||
}
|
||||
if (settingsKeys.contains("rx4SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[3] = settings.m_rxSubsamplingIndexes[3];
|
||||
}
|
||||
if (settingsKeys.contains("rx5SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[4] = settings.m_rxSubsamplingIndexes[4];
|
||||
}
|
||||
if (settingsKeys.contains("rx6SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[5] = settings.m_rxSubsamplingIndexes[5];
|
||||
}
|
||||
if (settingsKeys.contains("rx7SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[6] = settings.m_rxSubsamplingIndexes[6];
|
||||
}
|
||||
if (settingsKeys.contains("rx8SubsamplingIndex")) {
|
||||
m_rxSubsamplingIndexes[7] = settings.m_rxSubsamplingIndexes[7];
|
||||
}
|
||||
if (settingsKeys.contains("txCenterFrequency")) {
|
||||
m_txCenterFrequency = settings.m_txCenterFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("rxTransverterMode")) {
|
||||
m_rxTransverterMode = settings.m_rxTransverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("rxTransverterDeltaFrequency")) {
|
||||
m_rxTransverterDeltaFrequency = settings.m_rxTransverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("txTransverterMode")) {
|
||||
m_txTransverterMode = settings.m_txTransverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("txTransverterDeltaFrequency")) {
|
||||
m_txTransverterDeltaFrequency = settings.m_txTransverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder")) {
|
||||
m_iqOrder = settings.m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("sampleRateIndex")) {
|
||||
m_sampleRateIndex = settings.m_sampleRateIndex;
|
||||
}
|
||||
if (settingsKeys.contains("log2Decim")) {
|
||||
m_log2Decim = settings.m_log2Decim;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths")) {
|
||||
m_LOppmTenths = settings.m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("preamp")) {
|
||||
m_preamp = settings.m_preamp;
|
||||
}
|
||||
if (settingsKeys.contains("random")) {
|
||||
m_random = settings.m_random;
|
||||
}
|
||||
if (settingsKeys.contains("dither")) {
|
||||
m_dither = settings.m_dither;
|
||||
}
|
||||
if (settingsKeys.contains("duplex")) {
|
||||
m_duplex = settings.m_duplex;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection")) {
|
||||
m_iqCorrection = settings.m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("txDrive")) {
|
||||
m_txDrive = settings.m_txDrive;
|
||||
}
|
||||
if (settingsKeys.contains("streamIndex")) {
|
||||
m_streamIndex = settings.m_streamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("spectrumStreamIndex")) {
|
||||
m_spectrumStreamIndex = settings.m_spectrumStreamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
QString MetisMISOSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("nbReceivers") || force) {
|
||||
ostr << " m_nbReceivers: " << m_nbReceivers;
|
||||
}
|
||||
if (settingsKeys.contains("txEnable") || force) {
|
||||
ostr << " m_txEnable: " << m_txEnable;
|
||||
}
|
||||
if (settingsKeys.contains("rx1CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[0]: " << m_rxCenterFrequencies[0];
|
||||
}
|
||||
if (settingsKeys.contains("rx2CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[1]: " << m_rxCenterFrequencies[1];
|
||||
}
|
||||
if (settingsKeys.contains("rx3CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[2]: " << m_rxCenterFrequencies[2];
|
||||
}
|
||||
if (settingsKeys.contains("rx4CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[3]: " << m_rxCenterFrequencies[3];
|
||||
}
|
||||
if (settingsKeys.contains("rx5CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[4]: " << m_rxCenterFrequencies[4];
|
||||
}
|
||||
if (settingsKeys.contains("rx6CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[5]: " << m_rxCenterFrequencies[5];
|
||||
}
|
||||
if (settingsKeys.contains("rx7CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[6]: " << m_rxCenterFrequencies[6];
|
||||
}
|
||||
if (settingsKeys.contains("rx8CenterFrequency") || force) {
|
||||
ostr << " m_rxCenterFrequencies[7]: " << m_rxCenterFrequencies[7];
|
||||
}
|
||||
if (settingsKeys.contains("rx1SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[0]: " << m_rxSubsamplingIndexes[0];
|
||||
}
|
||||
if (settingsKeys.contains("rx2SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[1]: " << m_rxSubsamplingIndexes[1];
|
||||
}
|
||||
if (settingsKeys.contains("rx3SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[2]: " << m_rxSubsamplingIndexes[2];
|
||||
}
|
||||
if (settingsKeys.contains("rx4SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[3]: " << m_rxSubsamplingIndexes[3];
|
||||
}
|
||||
if (settingsKeys.contains("rx5SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[4]: " << m_rxSubsamplingIndexes[4];
|
||||
}
|
||||
if (settingsKeys.contains("rx6SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[5]: " << m_rxSubsamplingIndexes[5];
|
||||
}
|
||||
if (settingsKeys.contains("rx7SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[6]: " << m_rxSubsamplingIndexes[6];
|
||||
}
|
||||
if (settingsKeys.contains("rx8SubsamplingIndex") || force) {
|
||||
ostr << " m_rxSubsamplingIndexes[7]: " << m_rxSubsamplingIndexes[7];
|
||||
}
|
||||
if (settingsKeys.contains("txCenterFrequency") || force) {
|
||||
ostr << " m_txCenterFrequency: " << m_txCenterFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("rxTransverterMode") || force) {
|
||||
ostr << " m_rxTransverterMode: " << m_rxTransverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("rxTransverterDeltaFrequency") || force) {
|
||||
ostr << " m_rxTransverterDeltaFrequency: " << m_rxTransverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("txTransverterMode") || force) {
|
||||
ostr << " m_txTransverterMode: " << m_txTransverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("txTransverterDeltaFrequency") || force) {
|
||||
ostr << " m_txTransverterDeltaFrequency: " << m_txTransverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder") || force) {
|
||||
ostr << " m_iqOrder: " << m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("sampleRateIndex") || force) {
|
||||
ostr << " m_sampleRateIndex: " << m_sampleRateIndex;
|
||||
}
|
||||
if (settingsKeys.contains("log2Decim") || force) {
|
||||
ostr << " m_log2Decim: " << m_log2Decim;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||
ostr << " m_LOppmTenths: " << m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("preamp") || force) {
|
||||
ostr << " m_preamp: " << m_preamp;
|
||||
}
|
||||
if (settingsKeys.contains("random") || force) {
|
||||
ostr << " m_random: " << m_random;
|
||||
}
|
||||
if (settingsKeys.contains("dither") || force) {
|
||||
ostr << " m_dither: " << m_dither;
|
||||
}
|
||||
if (settingsKeys.contains("duplex") || force) {
|
||||
ostr << " m_duplex: " << m_duplex;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection") || force) {
|
||||
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("txDrive") || force) {
|
||||
ostr << " m_txDrive: " << m_txDrive;
|
||||
}
|
||||
if (settingsKeys.contains("streamIndex") || force) {
|
||||
ostr << " m_streamIndex: " << m_streamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("spectrumStreamIndex") || force) {
|
||||
ostr << " m_spectrumStreamIndex: " << m_spectrumStreamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
||||
|
||||
int MetisMISOSettings::getSampleRateFromIndex(unsigned int index)
|
||||
{
|
||||
if (index < 3) {
|
||||
|
@ -55,6 +55,8 @@ struct MetisMISOSettings {
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
MetisMISOSettings& operator=(const MetisMISOSettings&) = default;
|
||||
void applySettings(const QStringList& settingsKeys, const MetisMISOSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
|
||||
static int getSampleRateFromIndex(unsigned int index);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user