1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

PlutoSDR MIMO: Make settings assignments atomic. Part of #1329

This commit is contained in:
f4exb 2022-11-01 18:52:17 +01:00
parent 0263155122
commit 9576dd0f7b
6 changed files with 472 additions and 256 deletions

View File

@ -166,7 +166,7 @@ void PlutoSDRMIMO::closeDevice()
void PlutoSDRMIMO::init() void PlutoSDRMIMO::init()
{ {
applySettings(m_settings, true); applySettings(m_settings, QList<QString>(), true);
} }
bool PlutoSDRMIMO::startRx() bool PlutoSDRMIMO::startRx()
@ -315,12 +315,12 @@ bool PlutoSDRMIMO::deserialize(const QByteArray& data)
success = false; success = false;
} }
MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(m_settings, true); MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(m_settings, QList<QString>(), true);
m_inputMessageQueue.push(message); m_inputMessageQueue.push(message);
if (m_guiMessageQueue) if (m_guiMessageQueue)
{ {
MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(m_settings, true); MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(m_settings, QList<QString>(), true);
m_guiMessageQueue->push(messageToGUI); m_guiMessageQueue->push(messageToGUI);
} }
@ -358,12 +358,12 @@ void PlutoSDRMIMO::setSourceCenterFrequency(qint64 centerFrequency, int index)
PlutoSDRMIMOSettings settings = m_settings; PlutoSDRMIMOSettings settings = m_settings;
settings.m_rxCenterFrequency = centerFrequency; settings.m_rxCenterFrequency = centerFrequency;
MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(settings, false); MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(settings, QList<QString>{"rxCenterFrequency"}, false);
m_inputMessageQueue.push(message); m_inputMessageQueue.push(message);
if (m_guiMessageQueue) if (m_guiMessageQueue)
{ {
MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(settings, false); MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(settings, QList<QString>{"rxCenterFrequency"}, false);
m_guiMessageQueue->push(messageToGUI); m_guiMessageQueue->push(messageToGUI);
} }
} }
@ -380,12 +380,12 @@ void PlutoSDRMIMO::setSinkCenterFrequency(qint64 centerFrequency, int index)
PlutoSDRMIMOSettings settings = m_settings; PlutoSDRMIMOSettings settings = m_settings;
settings.m_txCenterFrequency = centerFrequency; settings.m_txCenterFrequency = centerFrequency;
MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(settings, false); MsgConfigurePlutoSDRMIMO* message = MsgConfigurePlutoSDRMIMO::create(settings, QList<QString>{"txCenterFrequency"}, false);
m_inputMessageQueue.push(message); m_inputMessageQueue.push(message);
if (m_guiMessageQueue) if (m_guiMessageQueue)
{ {
MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(settings, false); MsgConfigurePlutoSDRMIMO* messageToGUI = MsgConfigurePlutoSDRMIMO::create(settings, QList<QString>{"txCenterFrequency"}, false);
m_guiMessageQueue->push(messageToGUI); m_guiMessageQueue->push(messageToGUI);
} }
} }
@ -397,7 +397,7 @@ bool PlutoSDRMIMO::handleMessage(const Message& message)
MsgConfigurePlutoSDRMIMO& conf = (MsgConfigurePlutoSDRMIMO&) message; MsgConfigurePlutoSDRMIMO& conf = (MsgConfigurePlutoSDRMIMO&) message;
qDebug() << "PlutoSDRMIMO::handleMessage: MsgConfigurePlutoSDRMIMO"; qDebug() << "PlutoSDRMIMO::handleMessage: MsgConfigurePlutoSDRMIMO";
bool success = applySettings(conf.getSettings(), conf.getForce()); bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce());
if (!success) { if (!success) {
qDebug("PlutoSDRMIMO::handleMessage: config error"); qDebug("PlutoSDRMIMO::handleMessage: config error");
@ -437,174 +437,28 @@ bool PlutoSDRMIMO::handleMessage(const Message& message)
} }
} }
bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool force) bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QList<QString>& settingsKeys, bool force)
{ {
qDebug() << "PlutoSDRMIMO::applySettings: common: " qDebug() << "PlutoSDRMIMO::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
<< " m_devSampleRate: " << settings.m_devSampleRate
<< " m_LOppmTenths: " << settings.m_LOppmTenths
<< " m_rxCenterFrequency: " << settings.m_rxCenterFrequency
<< " m_dcBlock: " << settings.m_dcBlock
<< " m_iqCorrection: " << settings.m_iqCorrection
<< " m_hwBBDCBlock: " << settings.m_hwBBDCBlock
<< " m_hwRFDCBlock: " << settings.m_hwRFDCBlock
<< " m_hwIQCorrection: " << settings.m_hwIQCorrection
<< " m_fcPosRx: " << settings.m_fcPosRx
<< " m_rxTransverterMode: " << settings.m_rxTransverterMode
<< " m_rxTransverterDeltaFrequency: " << settings.m_rxTransverterDeltaFrequency
<< " m_iqOrder: " << settings.m_iqOrder
<< " m_lpfBWRx: " << settings.m_lpfBWRx
<< " m_lpfRxFIREnable: " << settings.m_lpfRxFIREnable
<< " m_lpfRxFIRBW: " << settings.m_lpfRxFIRBW
<< " m_lpfRxFIRlog2Decim: " << settings.m_lpfRxFIRlog2Decim
<< " m_lpfRxFIRGain: " << settings.m_lpfRxFIRGain
<< " m_log2Decim: " << settings.m_log2Decim
<< " m_rx0Gain: " << settings.m_rx0Gain
<< " m_rx0GainMode: " << settings.m_rx0GainMode
<< " m_rx0AntennaPath: " << settings.m_rx0AntennaPath
<< " m_rx0Gain: " << settings.m_rx1Gain
<< " m_rx0GainMode: " << settings.m_rx1GainMode
<< " m_rx0AntennaPath: " << settings.m_rx1AntennaPath
<< " m_txCenterFrequency: " << settings.m_txCenterFrequency
<< " m_fcPosTx: " << settings.m_fcPosTx
<< " m_txTransverterMode: " << settings.m_txTransverterMode
<< " m_txTransverterDeltaFrequency: " << settings.m_txTransverterDeltaFrequency
<< " m_lpfBWTx: " << settings.m_lpfBWTx
<< " m_lpfTxFIREnable: " << settings.m_lpfTxFIREnable
<< " m_lpfTxFIRBW: " << settings.m_lpfTxFIRBW
<< " m_lpfTxFIRlog2Interp: " << settings.m_lpfTxFIRlog2Interp
<< " m_lpfTxFIRGain: " << settings.m_lpfTxFIRGain
<< " m_log2Interp: " << settings.m_log2Interp
<< " m_tx0Att: " << settings.m_tx0Att
<< " m_tx0AntennaPath: " << settings.m_tx0AntennaPath
<< " m_tx1Att: " << settings.m_tx1Att
<< " m_tx1AntennaPath: " << settings.m_tx1AntennaPath
<< " m_useReverseAPI: " << settings.m_useReverseAPI
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
<< " force: " << force;
QList<QString> reverseAPIKeys;
bool forwardChangeRxDSP = false; bool forwardChangeRxDSP = false;
bool forwardChangeTxDSP = false; bool forwardChangeTxDSP = false;
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
// Rx // Rx
if ((m_settings.m_rxCenterFrequency != settings.m_rxCenterFrequency) || force) { if (settingsKeys.contains("dcBlock") ||
reverseAPIKeys.append("rxCenterFrequency"); settingsKeys.contains("iqCorrection") || force)
}
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) {
reverseAPIKeys.append("devSampleRate");
}
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
reverseAPIKeys.append("LOppmTenths");
}
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_hwBBDCBlock != settings.m_hwBBDCBlock) || force) {
reverseAPIKeys.append("hwBBDCBlock");
}
if ((m_settings.m_hwRFDCBlock != settings.m_hwRFDCBlock) || force) {
reverseAPIKeys.append("hwRFDCBlock");
}
if ((m_settings.m_hwIQCorrection != settings.m_hwIQCorrection) || force) {
reverseAPIKeys.append("hwIQCorrection");
}
if ((m_settings.m_lpfRxFIREnable != settings.m_lpfRxFIREnable) || force) {
reverseAPIKeys.append("lpfRxFIREnable");
}
if ((m_settings.m_lpfRxFIRBW != settings.m_lpfRxFIRBW) || force) {
reverseAPIKeys.append("lpfRxFIRBW");
}
if ((m_settings.m_lpfRxFIRlog2Decim != settings.m_lpfRxFIRlog2Decim) || force) {
reverseAPIKeys.append("lpfRxFIRlog2Decim");
}
if ((m_settings.m_lpfRxFIRGain != settings.m_lpfRxFIRGain) || force) {
reverseAPIKeys.append("lpfRxFIRGain");
}
if ((m_settings.m_lpfTxFIREnable != settings.m_lpfTxFIREnable) || force) {
reverseAPIKeys.append("lpfTxFIREnable");
}
if ((m_settings.m_lpfTxFIRBW != settings.m_lpfTxFIRBW) || force) {
reverseAPIKeys.append("lpfTxFIRBW");
}
if ((m_settings.m_lpfTxFIRlog2Interp != settings.m_lpfTxFIRlog2Interp) || force) {
reverseAPIKeys.append("lpfRxFIRlog2Decim");
}
if ((m_settings.m_lpfTxFIRGain != settings.m_lpfTxFIRGain) || force) {
reverseAPIKeys.append("lpfTxFIRGain");
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) {
reverseAPIKeys.append("log2Decim");
}
if ((m_settings.m_fcPosRx != settings.m_fcPosRx) || force) {
reverseAPIKeys.append("fcPosRx");
}
if ((m_settings.m_fcPosTx != settings.m_fcPosTx) || force) {
reverseAPIKeys.append("fcPosTx");
}
if ((m_settings.m_lpfBWRx != settings.m_lpfBWRx) || force) {
reverseAPIKeys.append("lpfBWRx");
}
if ((m_settings.m_lpfBWTx != settings.m_lpfBWTx) || force) {
reverseAPIKeys.append("lpfBWTx");
}
if ((m_settings.m_rx0Gain != settings.m_rx0Gain) || force) {
reverseAPIKeys.append("rx0Gain");
}
if ((m_settings.m_rx0AntennaPath != settings.m_rx0AntennaPath) || force) {
reverseAPIKeys.append("rx0AntennaPath");
}
if ((m_settings.m_rx0GainMode != settings.m_rx0GainMode) || force) {
reverseAPIKeys.append("rx0GainMode");
}
if ((m_settings.m_rx1Gain != settings.m_rx1Gain) || force) {
reverseAPIKeys.append("rx1Gain");
}
if ((m_settings.m_rx1AntennaPath != settings.m_rx1AntennaPath) || force) {
reverseAPIKeys.append("rx1AntennaPath");
}
if ((m_settings.m_rx1GainMode != settings.m_rx1GainMode) || force) {
reverseAPIKeys.append("rx1GainMode");
}
if ((m_settings.m_rxTransverterMode != settings.m_rxTransverterMode) || force) {
reverseAPIKeys.append("rxTransverterMode");
}
if ((m_settings.m_rxTransverterDeltaFrequency != settings.m_rxTransverterDeltaFrequency) || force) {
reverseAPIKeys.append("rxTransverterDeltaFrequency");
}
// Tx
if ((m_settings.m_txCenterFrequency != settings.m_txCenterFrequency) || force) {
reverseAPIKeys.append("txCenterFrequency");
}
if ((m_settings.m_txTransverterMode != settings.m_txTransverterMode) || force) {
reverseAPIKeys.append("txTransverterMode");
}
if ((m_settings.m_txTransverterDeltaFrequency != settings.m_txTransverterDeltaFrequency) || force) {
reverseAPIKeys.append("txTransverterDeltaFrequency");
}
// Rx
if ((m_settings.m_dcBlock != settings.m_dcBlock) ||
(m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
{ {
m_deviceAPI->configureCorrections(settings.m_dcBlock, m_settings.m_iqCorrection); m_deviceAPI->configureCorrections(settings.m_dcBlock, m_settings.m_iqCorrection);
} }
// Change affecting device sample rate chain and other buddies // Change affecting device sample rate chain and other buddies
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || if (settingsKeys.contains("devSampleRate") ||
(m_settings.m_lpfRxFIREnable != settings.m_lpfRxFIREnable) || settingsKeys.contains("lpfRxFIREnable") ||
(m_settings.m_lpfRxFIRlog2Decim != settings.m_lpfRxFIRlog2Decim) || settingsKeys.contains("lpfRxFIRlog2Decim") ||
(settings.m_lpfRxFIRBW != m_settings.m_lpfRxFIRBW) || settingsKeys.contains("lpfRxFIRBW") ||
(settings.m_lpfRxFIRGain != m_settings.m_lpfRxFIRGain) || force) settingsKeys.contains("m_lpfRxFIRGain") || force)
{ {
if (plutoBox) if (plutoBox)
{ {
@ -630,7 +484,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
forwardChangeRxDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force; forwardChangeRxDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force;
} }
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) if (settingsKeys.contains("log2Decim") || force)
{ {
if (m_sourceThread) if (m_sourceThread)
{ {
@ -641,14 +495,14 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
forwardChangeRxDSP = true; forwardChangeRxDSP = true;
} }
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force) if (settingsKeys.contains("iqOrder") || force)
{ {
if (m_sourceThread) { if (m_sourceThread) {
m_sourceThread->setIQOrder(settings.m_iqOrder); m_sourceThread->setIQOrder(settings.m_iqOrder);
} }
} }
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) if (settingsKeys.contains("LOppmTenths") || force)
{ {
if (plutoBox) { if (plutoBox) {
plutoBox->setLOPPMTenths(settings.m_LOppmTenths); plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
@ -658,12 +512,12 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
std::vector<std::string> params; std::vector<std::string> params;
bool paramsToSet = false; bool paramsToSet = false;
if ((m_settings.m_rxCenterFrequency != settings.m_rxCenterFrequency) if (settingsKeys.contains("rxCenterFrequency")
|| (m_settings.m_fcPosRx != settings.m_fcPosRx) || settingsKeys.contains("fcPosRx")
|| (m_settings.m_log2Decim != settings.m_log2Decim) || settingsKeys.contains("log2Decim")
|| (m_settings.m_devSampleRate != settings.m_devSampleRate) || settingsKeys.contains("devSampleRate")
|| (m_settings.m_rxTransverterMode != settings.m_rxTransverterMode) || settingsKeys.contains("rxTransverterMode")
|| (m_settings.m_rxTransverterDeltaFrequency != settings.m_rxTransverterDeltaFrequency) || force) || settingsKeys.contains("rxTransverterDeltaFrequency") || force)
{ {
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency( qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
settings.m_rxCenterFrequency, settings.m_rxCenterFrequency,
@ -678,7 +532,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
paramsToSet = true; paramsToSet = true;
forwardChangeRxDSP = true; forwardChangeRxDSP = true;
if ((m_settings.m_fcPosRx != settings.m_fcPosRx) || force) if (settingsKeys.contains("fcPosRx") || force)
{ {
if (m_sourceThread) if (m_sourceThread)
{ {
@ -688,13 +542,13 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
} }
} }
if ((m_settings.m_lpfBWRx != settings.m_lpfBWRx) || force) if (settingsKeys.contains("lpfBWRx") || force)
{ {
params.push_back(QString(tr("in_voltage_rf_bandwidth=%1").arg(settings.m_lpfBWRx)).toStdString()); params.push_back(QString(tr("in_voltage_rf_bandwidth=%1").arg(settings.m_lpfBWRx)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx0AntennaPath != settings.m_rx0AntennaPath) || force) if (settingsKeys.contains("rx0AntennaPath") || force)
{ {
QString rfPortStr; QString rfPortStr;
PlutoSDRMIMOSettings::translateRFPathRx(settings.m_rx0AntennaPath, rfPortStr); PlutoSDRMIMOSettings::translateRFPathRx(settings.m_rx0AntennaPath, rfPortStr);
@ -702,7 +556,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx1AntennaPath != settings.m_rx1AntennaPath) || force) if (settingsKeys.contains("rx1AntennaPath") || force)
{ {
QString rfPortStr; QString rfPortStr;
PlutoSDRMIMOSettings::translateRFPathRx(settings.m_rx1AntennaPath, rfPortStr); PlutoSDRMIMOSettings::translateRFPathRx(settings.m_rx1AntennaPath, rfPortStr);
@ -710,7 +564,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx0GainMode != settings.m_rx0GainMode) || force) if (settingsKeys.contains("rx0GainMode") || force)
{ {
QString gainModeStr; QString gainModeStr;
PlutoSDRMIMOSettings::translateGainMode(settings.m_rx0GainMode, gainModeStr); PlutoSDRMIMOSettings::translateGainMode(settings.m_rx0GainMode, gainModeStr);
@ -718,7 +572,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx1GainMode != settings.m_rx1GainMode) || force) if (settingsKeys.contains("rx1GainMode") || force)
{ {
QString gainModeStr; QString gainModeStr;
PlutoSDRMIMOSettings::translateGainMode(settings.m_rx1GainMode, gainModeStr); PlutoSDRMIMOSettings::translateGainMode(settings.m_rx1GainMode, gainModeStr);
@ -726,31 +580,31 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx0Gain != settings.m_rx0Gain) || force) if (settingsKeys.contains("rx0Gain") || force)
{ {
params.push_back(QString(tr("in_voltage0_hardwaregain=%1").arg(settings.m_rx0Gain)).toStdString()); params.push_back(QString(tr("in_voltage0_hardwaregain=%1").arg(settings.m_rx0Gain)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_rx1Gain != settings.m_rx1Gain) || force) if (settingsKeys.contains("rx1Gain") || force)
{ {
params.push_back(QString(tr("in_voltage1_hardwaregain=%1").arg(settings.m_rx1Gain)).toStdString()); params.push_back(QString(tr("in_voltage1_hardwaregain=%1").arg(settings.m_rx1Gain)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_hwBBDCBlock != settings.m_hwBBDCBlock) || force) if (settingsKeys.contains("hwBBDCBlock") || force)
{ {
params.push_back(QString(tr("in_voltage_bb_dc_offset_tracking_en=%1").arg(settings.m_hwBBDCBlock ? 1 : 0)).toStdString()); params.push_back(QString(tr("in_voltage_bb_dc_offset_tracking_en=%1").arg(settings.m_hwBBDCBlock ? 1 : 0)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_hwRFDCBlock != settings.m_hwRFDCBlock) || force) if (settingsKeys.contains("hwRFDCBlock") || force)
{ {
params.push_back(QString(tr("in_voltage_rf_dc_offset_tracking_en=%1").arg(settings.m_hwRFDCBlock ? 1 : 0)).toStdString()); params.push_back(QString(tr("in_voltage_rf_dc_offset_tracking_en=%1").arg(settings.m_hwRFDCBlock ? 1 : 0)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_hwIQCorrection != settings.m_hwIQCorrection) || force) if (settingsKeys.contains("hwIQCorrection") || force)
{ {
params.push_back(QString(tr("in_voltage_quadrature_tracking_en=%1").arg(settings.m_hwIQCorrection ? 1 : 0)).toStdString()); params.push_back(QString(tr("in_voltage_quadrature_tracking_en=%1").arg(settings.m_hwIQCorrection ? 1 : 0)).toStdString());
paramsToSet = true; paramsToSet = true;
@ -759,11 +613,11 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
// Tx // Tx
// Change affecting device sample rate chain and other buddies // Change affecting device sample rate chain and other buddies
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || if (settingsKeys.contains("devSampleRate") ||
(m_settings.m_lpfTxFIREnable != settings.m_lpfTxFIREnable) || settingsKeys.contains("lpfTxFIREnable") ||
(m_settings.m_lpfTxFIRlog2Interp != settings.m_lpfTxFIRlog2Interp) || settingsKeys.contains("lpfTxFIRlog2Interp") ||
(settings.m_lpfTxFIRBW != m_settings.m_lpfTxFIRBW) || settingsKeys.contains("lpfTxFIRBW") ||
(settings.m_lpfTxFIRGain != m_settings.m_lpfTxFIRGain) || force) settingsKeys.contains("lpfTxFIRGain") || force)
{ {
plutoBox->setFIR( plutoBox->setFIR(
settings.m_devSampleRate, settings.m_devSampleRate,
@ -786,10 +640,8 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
forwardChangeTxDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force; forwardChangeTxDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force;
} }
if ((m_settings.m_log2Interp != settings.m_log2Interp) || force) if (settingsKeys.contains("log2Interp") || force)
{ {
reverseAPIKeys.append("log2Interp");
if (m_sinkThread != 0) if (m_sinkThread != 0)
{ {
m_sinkThread->setLog2Interpolation(settings.m_log2Interp); m_sinkThread->setLog2Interpolation(settings.m_log2Interp);
@ -799,13 +651,12 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
forwardChangeTxDSP = true; forwardChangeTxDSP = true;
} }
if (force || (m_settings.m_txCenterFrequency != settings.m_txCenterFrequency) if (force || settingsKeys.contains("txCenterFrequency")
|| (m_settings.m_log2Interp != settings.m_log2Interp) || settingsKeys.contains("log2Interp")
|| (m_settings.m_fcPosTx != settings.m_fcPosTx) || settingsKeys.contains("fcPosTx")
|| (m_settings.m_devSampleRate != settings.m_devSampleRate) || settingsKeys.contains("devSampleRate")
|| (m_settings.m_txTransverterMode != settings.m_txTransverterMode) || settingsKeys.contains("txTransverterMode")
|| (m_settings.m_txTransverterDeltaFrequency != settings.m_txTransverterDeltaFrequency)) || settingsKeys.contains("txTransverterDeltaFrequency"))
{ {
qint64 deviceCenterFrequency = DeviceSampleSink::calculateDeviceCenterFrequency( qint64 deviceCenterFrequency = DeviceSampleSink::calculateDeviceCenterFrequency(
settings.m_txCenterFrequency, settings.m_txCenterFrequency,
@ -825,42 +676,37 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
} }
if ((m_settings.m_lpfBWTx != settings.m_lpfBWTx) || force) if (settingsKeys.contains("lpfBWTx") || force)
{ {
reverseAPIKeys.append("lpfBWTx");
params.push_back(QString(tr("out_voltage_rf_bandwidth=%1").arg(settings.m_lpfBWTx)).toStdString()); params.push_back(QString(tr("out_voltage_rf_bandwidth=%1").arg(settings.m_lpfBWTx)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_tx0AntennaPath != settings.m_tx0AntennaPath) || force) if (settingsKeys.contains("tx0AntennaPath") || force)
{ {
reverseAPIKeys.append("tx0AntennaPath");
QString rfPortStr; QString rfPortStr;
PlutoSDRMIMOSettings::translateRFPathTx(settings.m_tx0AntennaPath, rfPortStr); PlutoSDRMIMOSettings::translateRFPathTx(settings.m_tx0AntennaPath, rfPortStr);
params.push_back(QString(tr("out_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString()); params.push_back(QString(tr("out_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_tx1AntennaPath != settings.m_tx1AntennaPath) || force) if (settingsKeys.contains("tx1AntennaPath") || force)
{ {
reverseAPIKeys.append("tx1AntennaPath");
QString rfPortStr; QString rfPortStr;
PlutoSDRMIMOSettings::translateRFPathTx(settings.m_tx1AntennaPath, rfPortStr); PlutoSDRMIMOSettings::translateRFPathTx(settings.m_tx1AntennaPath, rfPortStr);
params.push_back(QString(tr("out_voltage1_rf_port_select=%1").arg(rfPortStr)).toStdString()); params.push_back(QString(tr("out_voltage1_rf_port_select=%1").arg(rfPortStr)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_tx0Att != settings.m_tx0Att) || force) if (settingsKeys.contains("tx0Att") || force)
{ {
reverseAPIKeys.append("tx0Att");
float attF = settings.m_tx0Att * 0.25f; float attF = settings.m_tx0Att * 0.25f;
params.push_back(QString(tr("out_voltage0_hardwaregain=%1").arg(attF)).toStdString()); params.push_back(QString(tr("out_voltage0_hardwaregain=%1").arg(attF)).toStdString());
paramsToSet = true; paramsToSet = true;
} }
if ((m_settings.m_tx1Att != settings.m_tx1Att) || force) if (settingsKeys.contains("tx1Att") || force)
{ {
reverseAPIKeys.append("tx1Att");
float attF = settings.m_tx1Att * 0.25f; float attF = settings.m_tx1Att * 0.25f;
params.push_back(QString(tr("out_voltage1_hardwaregain=%1").arg(attF)).toStdString()); params.push_back(QString(tr("out_voltage1_hardwaregain=%1").arg(attF)).toStdString());
paramsToSet = true; paramsToSet = true;
@ -870,16 +716,20 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, bool forc
plutoBox->set_params(DevicePlutoSDRBox::DEVICE_PHY, params); plutoBox->set_params(DevicePlutoSDRBox::DEVICE_PHY, params);
} }
if (settings.m_useReverseAPI) if (settingsKeys.contains("useReverseAPI"))
{ {
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) || bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) || settingsKeys.contains("reverseAPIAddress") ||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) || settingsKeys.contains("reverseAPIPort") ||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex); settingsKeys.contains("reverseAPIDeviceIndex");
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
} }
m_settings = settings; if (force) {
m_settings = settings;
} else {
m_settings.applySettings(settingsKeys, settings);
}
if (forwardChangeRxDSP) if (forwardChangeRxDSP)
{ {
@ -923,12 +773,12 @@ int PlutoSDRMIMO::webapiSettingsPutPatch(
PlutoSDRMIMOSettings settings = m_settings; PlutoSDRMIMOSettings settings = m_settings;
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response); webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
MsgConfigurePlutoSDRMIMO *msg = MsgConfigurePlutoSDRMIMO::create(settings, force); MsgConfigurePlutoSDRMIMO *msg = MsgConfigurePlutoSDRMIMO::create(settings, deviceSettingsKeys, force);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any if (m_guiMessageQueue) // forward to GUI if any
{ {
MsgConfigurePlutoSDRMIMO *msgToGUI = MsgConfigurePlutoSDRMIMO::create(settings, force); MsgConfigurePlutoSDRMIMO *msgToGUI = MsgConfigurePlutoSDRMIMO::create(settings, deviceSettingsKeys, force);
m_guiMessageQueue->push(msgToGUI); m_guiMessageQueue->push(msgToGUI);
} }
@ -1165,7 +1015,7 @@ int PlutoSDRMIMO::webapiRun(
} }
} }
void PlutoSDRMIMO::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDRMIMOSettings& settings, bool force) void PlutoSDRMIMO::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PlutoSDRMIMOSettings& settings, bool force)
{ {
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setDirection(2); // MIMO swgDeviceSettings->setDirection(2); // MIMO

View File

@ -45,20 +45,22 @@ public:
public: public:
const PlutoSDRMIMOSettings& getSettings() const { return m_settings; } const PlutoSDRMIMOSettings& getSettings() const { return m_settings; }
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
bool getForce() const { return m_force; } bool getForce() const { return m_force; }
static MsgConfigurePlutoSDRMIMO* create(const PlutoSDRMIMOSettings& settings, bool force) static MsgConfigurePlutoSDRMIMO* create(const PlutoSDRMIMOSettings& settings, const QList<QString>& settingsKeys, bool force) {
{ return new MsgConfigurePlutoSDRMIMO(settings, settingsKeys, force);
return new MsgConfigurePlutoSDRMIMO(settings, force);
} }
private: private:
PlutoSDRMIMOSettings m_settings; PlutoSDRMIMOSettings m_settings;
QList<QString> m_settingsKeys;
bool m_force; bool m_force;
MsgConfigurePlutoSDRMIMO(const PlutoSDRMIMOSettings& settings, bool force) : MsgConfigurePlutoSDRMIMO(const PlutoSDRMIMOSettings& settings, const QList<QString>& settingsKeys, bool force) :
Message(), Message(),
m_settings(settings), m_settings(settings),
m_settingsKeys(settingsKeys),
m_force(force) m_force(force)
{ } { }
}; };
@ -190,8 +192,8 @@ private:
bool openDevice(); bool openDevice();
void closeDevice(); void closeDevice();
bool applySettings(const PlutoSDRMIMOSettings& settings, bool force); bool applySettings(const PlutoSDRMIMOSettings& settings, const QList<QString>& settingsKeys, bool force);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDRMIMOSettings& settings, bool force); void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PlutoSDRMIMOSettings& settings, bool force);
void webapiReverseSendStartStop(bool start); void webapiReverseSendStartStop(bool start);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response); void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);

View File

@ -123,7 +123,7 @@ void PlutoSDRMIMOGUI::resetToDefaults()
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
displaySettings(); displaySettings();
sendSettings(); sendSettings(true);
} }
QByteArray PlutoSDRMIMOGUI::serialize() const QByteArray PlutoSDRMIMOGUI::serialize() const
@ -136,8 +136,7 @@ bool PlutoSDRMIMOGUI::deserialize(const QByteArray& data)
if (m_settings.deserialize(data)) if (m_settings.deserialize(data))
{ {
displaySettings(); displaySettings();
m_forceSettings = true; sendSettings(true);
sendSettings();
return true; return true;
} }
else else
@ -306,7 +305,10 @@ void PlutoSDRMIMOGUI::displayFcTooltip()
void PlutoSDRMIMOGUI::sendSettings(bool forceSettings) void PlutoSDRMIMOGUI::sendSettings(bool forceSettings)
{ {
m_forceSettings = forceSettings; m_forceSettings = forceSettings;
if(!m_updateTimer.isActive()) { m_updateTimer.start(100); }
if (!m_updateTimer.isActive()) {
m_updateTimer.start(100);
}
} }
void PlutoSDRMIMOGUI::updateHardware() void PlutoSDRMIMOGUI::updateHardware()
@ -314,9 +316,10 @@ void PlutoSDRMIMOGUI::updateHardware()
if (m_doApplySettings) if (m_doApplySettings)
{ {
qDebug() << "PlutoSDRMIMOGUI::updateHardware"; qDebug() << "PlutoSDRMIMOGUI::updateHardware";
PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO* message = PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO::create(m_settings, m_forceSettings); PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO* message = PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO::create(m_settings, m_settingsKeys, m_forceSettings);
m_sampleMIMO->getInputMessageQueue()->push(message); m_sampleMIMO->getInputMessageQueue()->push(message);
m_forceSettings = false; m_forceSettings = false;
m_settingsKeys.clear();
m_updateTimer.stop(); m_updateTimer.stop();
} }
} }
@ -430,7 +433,13 @@ bool PlutoSDRMIMOGUI::handleMessage(const Message& message)
else if (PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO::match(message)) else if (PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO::match(message))
{ {
const PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO& notif = (const PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO&) message; const PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO& notif = (const PlutoSDRMIMO::MsgConfigurePlutoSDRMIMO&) message;
m_settings = notif.getSettings();
if (notif.getForce()) {
m_settings = notif.getSettings();
} else {
m_settings.applySettings(notif.getSettingsKeys(), notif.getSettings());
}
displaySettings(); displaySettings();
return true; return true;
@ -618,10 +627,15 @@ void PlutoSDRMIMOGUI::on_startStopTx_toggled(bool checked)
void PlutoSDRMIMOGUI::on_centerFrequency_changed(quint64 value) void PlutoSDRMIMOGUI::on_centerFrequency_changed(quint64 value)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_rxCenterFrequency = value * 1000; m_settings.m_rxCenterFrequency = value * 1000;
} else { m_settingsKeys.append("rxCenterFrequency");
}
else
{
m_settings.m_txCenterFrequency = value * 1000; m_settings.m_txCenterFrequency = value * 1000;
m_settingsKeys.append("txCenterFrequency");
} }
sendSettings(); sendSettings();
@ -631,45 +645,56 @@ void PlutoSDRMIMOGUI::on_loPPM_valueChanged(int value)
{ {
ui->loPPMText->setText(QString("%1").arg(QString::number(value/10.0, 'f', 1))); ui->loPPMText->setText(QString("%1").arg(QString::number(value/10.0, 'f', 1)));
m_settings.m_LOppmTenths = value; m_settings.m_LOppmTenths = value;
m_settingsKeys.append("LOppmTenths");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_dcOffset_toggled(bool checked) void PlutoSDRMIMOGUI::on_dcOffset_toggled(bool checked)
{ {
m_settings.m_dcBlock = checked; m_settings.m_dcBlock = checked;
m_settingsKeys.append("dcBlock");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_iqImbalance_toggled(bool checked) void PlutoSDRMIMOGUI::on_iqImbalance_toggled(bool checked)
{ {
m_settings.m_iqCorrection = checked; m_settings.m_iqCorrection = checked;
m_settingsKeys.append("iqCorrection");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_rfDCOffset_toggled(bool checked) void PlutoSDRMIMOGUI::on_rfDCOffset_toggled(bool checked)
{ {
m_settings.m_hwRFDCBlock = checked; m_settings.m_hwRFDCBlock = checked;
m_settingsKeys.append("hwRFDCBlock");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_bbDCOffset_toggled(bool checked) void PlutoSDRMIMOGUI::on_bbDCOffset_toggled(bool checked)
{ {
m_settings.m_hwBBDCBlock = checked; m_settings.m_hwBBDCBlock = checked;
m_settingsKeys.append("hwBBDCBlock");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_hwIQImbalance_toggled(bool checked) void PlutoSDRMIMOGUI::on_hwIQImbalance_toggled(bool checked)
{ {
m_settings.m_hwIQCorrection = checked; m_settings.m_hwIQCorrection = checked;
m_settingsKeys.append("hwIQCorrection");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_swDecim_currentIndexChanged(int index) void PlutoSDRMIMOGUI::on_swDecim_currentIndexChanged(int index)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_log2Decim = index > 6 ? 6 : index; m_settings.m_log2Decim = index > 6 ? 6 : index;
} else { m_settingsKeys.append("log2Decim");
}
else
{
m_settings.m_log2Interp = index > 6 ? 6 : index; m_settings.m_log2Interp = index > 6 ? 6 : index;
m_settingsKeys.append("log2Interp");
} }
displaySampleRate(); displaySampleRate();
@ -684,6 +709,7 @@ void PlutoSDRMIMOGUI::on_swDecim_currentIndexChanged(int index)
} }
} }
m_settingsKeys.append("devSampleRate");
sendSettings(); sendSettings();
} }
@ -691,10 +717,15 @@ void PlutoSDRMIMOGUI::on_fcPos_currentIndexChanged(int index)
{ {
PlutoSDRMIMOSettings::fcPos_t fcPos = (PlutoSDRMIMOSettings::fcPos_t) (index < (int) PlutoSDRMIMOSettings::FC_POS_END ? index : PlutoSDRMIMOSettings::FC_POS_CENTER); PlutoSDRMIMOSettings::fcPos_t fcPos = (PlutoSDRMIMOSettings::fcPos_t) (index < (int) PlutoSDRMIMOSettings::FC_POS_END ? index : PlutoSDRMIMOSettings::FC_POS_CENTER);
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_fcPosRx = fcPos; m_settings.m_fcPosRx = fcPos;
} else { m_settingsKeys.append("fcPosRx");
}
else
{
m_settings.m_fcPosTx = fcPos; m_settings.m_fcPosTx = fcPos;
m_settingsKeys.append("fcPosTx");
} }
displayFcTooltip(); displayFcTooltip();
@ -715,15 +746,21 @@ void PlutoSDRMIMOGUI::on_sampleRate_changed(quint64 value)
} }
displayFcTooltip(); displayFcTooltip();
m_settingsKeys.append("devSampleRate");
sendSettings(); sendSettings();
} }
void PlutoSDRMIMOGUI::on_lpf_changed(quint64 value) void PlutoSDRMIMOGUI::on_lpf_changed(quint64 value)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_lpfBWRx = value * 1000; m_settings.m_lpfBWRx = value * 1000;
} else { m_settingsKeys.append("lpfBWRx");
}
else
{
m_settings.m_lpfBWTx = value * 1000; m_settings.m_lpfBWTx = value * 1000;
m_settingsKeys.append("lpfBWTx");
} }
sendSettings(); sendSettings();
@ -731,10 +768,15 @@ void PlutoSDRMIMOGUI::on_lpf_changed(quint64 value)
void PlutoSDRMIMOGUI::on_lpFIREnable_toggled(bool checked) void PlutoSDRMIMOGUI::on_lpFIREnable_toggled(bool checked)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_lpfRxFIREnable = checked; m_settings.m_lpfRxFIREnable = checked;
} else { m_settingsKeys.append("lpfRxFIREnable");
}
else
{
m_settings.m_lpfTxFIREnable = checked; m_settings.m_lpfTxFIREnable = checked;
m_settingsKeys.append("lpfTxFIREnable");
} }
ui->lpFIRDecimation->setEnabled(checked); ui->lpFIRDecimation->setEnabled(checked);
@ -744,10 +786,16 @@ void PlutoSDRMIMOGUI::on_lpFIREnable_toggled(bool checked)
void PlutoSDRMIMOGUI::on_lpFIR_changed(quint64 value) void PlutoSDRMIMOGUI::on_lpFIR_changed(quint64 value)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_lpfRxFIRBW = value * 1000; m_settings.m_lpfRxFIRBW = value * 1000;
} else { m_settingsKeys.append("lpfRxFIRBW");
}
else
{
m_settings.m_lpfTxFIRBW = value * 1000; m_settings.m_lpfTxFIRBW = value * 1000;
m_settingsKeys.append("lpfTxFIRBW");
} }
sendSettings(); sendSettings();
@ -755,10 +803,15 @@ void PlutoSDRMIMOGUI::on_lpFIR_changed(quint64 value)
void PlutoSDRMIMOGUI::on_lpFIRDecimation_currentIndexChanged(int index) void PlutoSDRMIMOGUI::on_lpFIRDecimation_currentIndexChanged(int index)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_lpfRxFIRlog2Decim = index > 2 ? 2 : index; m_settings.m_lpfRxFIRlog2Decim = index > 2 ? 2 : index;
} else { m_settingsKeys.append("lpfRxFIRlog2Decim");
}
else
{
m_settings.m_lpfTxFIRlog2Interp = index > 2 ? 2 : index; m_settings.m_lpfTxFIRlog2Interp = index > 2 ? 2 : index;
m_settingsKeys.append("lpfTxFIRlog2Interp");
} }
setSampleRateLimits(); setSampleRateLimits();
@ -767,10 +820,15 @@ void PlutoSDRMIMOGUI::on_lpFIRDecimation_currentIndexChanged(int index)
void PlutoSDRMIMOGUI::on_lpFIRGain_currentIndexChanged(int index) void PlutoSDRMIMOGUI::on_lpFIRGain_currentIndexChanged(int index)
{ {
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_lpfRxFIRGain = 6*(index > 3 ? 3 : index) - 12; m_settings.m_lpfRxFIRGain = 6*(index > 3 ? 3 : index) - 12;
} else { m_settingsKeys.append("lpfRxFIRGain");
}
else
{
m_settings.m_lpfTxFIRGain = 6*(index > 3 ? 3 : index) - 12; m_settings.m_lpfTxFIRGain = 6*(index > 3 ? 3 : index) - 12;
m_settingsKeys.append("lpfTxFIRGain");
} }
sendSettings(); sendSettings();
@ -783,6 +841,9 @@ void PlutoSDRMIMOGUI::on_gainLock_toggled(bool checked)
m_settings.m_rx1GainMode = m_settings.m_rx0GainMode; m_settings.m_rx1GainMode = m_settings.m_rx0GainMode;
m_settings.m_rx1Gain = m_settings.m_rx0Gain; m_settings.m_rx1Gain = m_settings.m_rx0Gain;
m_settings.m_tx1Att = m_settings.m_rx0Gain; m_settings.m_tx1Att = m_settings.m_rx0Gain;
m_settingsKeys.append("rx1GainMode");
m_settingsKeys.append("rx1Gain");
m_settingsKeys.append("tx1Att");
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);
@ -798,11 +859,13 @@ void PlutoSDRMIMOGUI::on_gainMode_currentIndexChanged(int index)
{ {
m_settings.m_rx0GainMode = (PlutoSDRMIMOSettings::GainMode) (index < PlutoSDRMIMOSettings::GAIN_END ? index : 0); m_settings.m_rx0GainMode = (PlutoSDRMIMOSettings::GainMode) (index < PlutoSDRMIMOSettings::GAIN_END ? index : 0);
ui->gain->setEnabled(m_settings.m_rx0GainMode == PlutoSDRMIMOSettings::GAIN_MANUAL); ui->gain->setEnabled(m_settings.m_rx0GainMode == PlutoSDRMIMOSettings::GAIN_MANUAL);
m_settingsKeys.append("rx0GainMode");
} }
else else
{ {
m_settings.m_rx1GainMode = (PlutoSDRMIMOSettings::GainMode) (index < PlutoSDRMIMOSettings::GAIN_END ? index : 0); m_settings.m_rx1GainMode = (PlutoSDRMIMOSettings::GainMode) (index < PlutoSDRMIMOSettings::GAIN_END ? index : 0);
ui->gain->setEnabled(m_settings.m_rx1GainMode == PlutoSDRMIMOSettings::GAIN_MANUAL); ui->gain->setEnabled(m_settings.m_rx1GainMode == PlutoSDRMIMOSettings::GAIN_MANUAL);
m_settingsKeys.append("rx1GainMode");
} }
sendSettings(); sendSettings();
@ -812,10 +875,15 @@ void PlutoSDRMIMOGUI::on_gain_valueChanged(int value)
{ {
ui->gainText->setText(tr("%1").arg(value)); ui->gainText->setText(tr("%1").arg(value));
if (m_streamIndex == 0) { if (m_streamIndex == 0)
{
m_settings.m_rx0Gain = value; m_settings.m_rx0Gain = value;
} else { m_settingsKeys.append("rx0Gain");
}
else
{
m_settings.m_rx1Gain = value; m_settings.m_rx1Gain = value;
m_settingsKeys.append("rx1Gain");
} }
sendSettings(); sendSettings();
@ -825,10 +893,15 @@ void PlutoSDRMIMOGUI::on_att_valueChanged(int value)
{ {
ui->attText->setText(QString("%1 dB").arg(QString::number(value*0.25, 'f', 2))); ui->attText->setText(QString("%1 dB").arg(QString::number(value*0.25, 'f', 2)));
if (m_streamIndex == 0) { if (m_streamIndex == 0)
{
m_settings.m_tx0Att = value; m_settings.m_tx0Att = value;
} else { m_settingsKeys.append("tx0Att");
}
else
{
m_settings.m_tx1Att = value; m_settings.m_tx1Att = value;
m_settingsKeys.append("tx1Att");
} }
sendSettings(); sendSettings();
@ -838,18 +911,28 @@ void PlutoSDRMIMOGUI::on_antenna_currentIndexChanged(int index)
{ {
if (m_rxElseTx) if (m_rxElseTx)
{ {
if (m_streamIndex == 0) { if (m_streamIndex == 0)
{
m_settings.m_rx0AntennaPath = (PlutoSDRMIMOSettings::RFPathRx) (index < PlutoSDRMIMOSettings::RFPATHRX_END ? index : 0); m_settings.m_rx0AntennaPath = (PlutoSDRMIMOSettings::RFPathRx) (index < PlutoSDRMIMOSettings::RFPATHRX_END ? index : 0);
} else { m_settingsKeys.append("rx0AntennaPath");
}
else
{
m_settings.m_rx1AntennaPath = (PlutoSDRMIMOSettings::RFPathRx) (index < PlutoSDRMIMOSettings::RFPATHRX_END ? index : 0); m_settings.m_rx1AntennaPath = (PlutoSDRMIMOSettings::RFPathRx) (index < PlutoSDRMIMOSettings::RFPATHRX_END ? index : 0);
m_settingsKeys.append("rx1AntennaPath");
} }
} }
else else
{ {
if (m_streamIndex == 0) { if (m_streamIndex == 0)
{
m_settings.m_tx0AntennaPath = (PlutoSDRMIMOSettings::RFPathTx) (index < PlutoSDRMIMOSettings::RFPATHTX_END ? index : 0); m_settings.m_tx0AntennaPath = (PlutoSDRMIMOSettings::RFPathTx) (index < PlutoSDRMIMOSettings::RFPATHTX_END ? index : 0);
} else { m_settingsKeys.append("tx0AntennaPath");
}
else
{
m_settings.m_tx1AntennaPath = (PlutoSDRMIMOSettings::RFPathTx) (index < PlutoSDRMIMOSettings::RFPATHTX_END ? index : 0); m_settings.m_tx1AntennaPath = (PlutoSDRMIMOSettings::RFPathTx) (index < PlutoSDRMIMOSettings::RFPATHTX_END ? index : 0);
m_settingsKeys.append("tx1AntennaPath");
} }
} }
@ -863,6 +946,9 @@ void PlutoSDRMIMOGUI::on_transverter_clicked()
m_settings.m_rxTransverterMode = ui->transverter->getDeltaFrequencyAcive(); m_settings.m_rxTransverterMode = ui->transverter->getDeltaFrequencyAcive();
m_settings.m_rxTransverterDeltaFrequency = ui->transverter->getDeltaFrequency(); m_settings.m_rxTransverterDeltaFrequency = ui->transverter->getDeltaFrequency();
m_settings.m_iqOrder = ui->transverter->getIQOrder(); m_settings.m_iqOrder = ui->transverter->getIQOrder();
m_settingsKeys.append("rxTransverterMode");
m_settingsKeys.append("rxTransverterDeltaFrequency");
m_settingsKeys.append("iqOrder");
qDebug("PlutoSDRInputGui::on_transverter_clicked: %lld Hz %s", qDebug("PlutoSDRInputGui::on_transverter_clicked: %lld Hz %s",
m_settings.m_rxTransverterDeltaFrequency, m_settings.m_rxTransverterMode ? "on" : "off"); m_settings.m_rxTransverterDeltaFrequency, m_settings.m_rxTransverterMode ? "on" : "off");
} }
@ -870,16 +956,23 @@ void PlutoSDRMIMOGUI::on_transverter_clicked()
{ {
m_settings.m_txTransverterMode = ui->transverter->getDeltaFrequencyAcive(); m_settings.m_txTransverterMode = ui->transverter->getDeltaFrequencyAcive();
m_settings.m_txTransverterDeltaFrequency = ui->transverter->getDeltaFrequency(); m_settings.m_txTransverterDeltaFrequency = ui->transverter->getDeltaFrequency();
m_settingsKeys.append("txTransverterMode");
m_settingsKeys.append("txTransverterDeltaFrequency");
qDebug("PlutoSDRInputGui::on_transverter_clicked: %lld Hz %s", qDebug("PlutoSDRInputGui::on_transverter_clicked: %lld Hz %s",
m_settings.m_rxTransverterDeltaFrequency, m_settings.m_txTransverterMode ? "on" : "off"); m_settings.m_rxTransverterDeltaFrequency, m_settings.m_txTransverterMode ? "on" : "off");
} }
updateFrequencyLimits(); updateFrequencyLimits();
if (m_rxElseTx) { if (m_rxElseTx)
{
m_settings.m_rxCenterFrequency = ui->centerFrequency->getValueNew()*1000; m_settings.m_rxCenterFrequency = ui->centerFrequency->getValueNew()*1000;
} else { m_settingsKeys.append("rxCenterFrequency");
}
else
{
m_settings.m_txCenterFrequency = ui->centerFrequency->getValueNew()*1000; m_settings.m_txCenterFrequency = ui->centerFrequency->getValueNew()*1000;
m_settingsKeys.append("txCenterFrequency");
} }
sendSettings(); sendSettings();
@ -908,6 +1001,10 @@ void PlutoSDRMIMOGUI::openDeviceSettingsDialog(const QPoint& p)
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
m_settingsKeys.append("useReverseAPI");
m_settingsKeys.append("reverseAPIAddress");
m_settingsKeys.append("reverseAPIPort");
m_settingsKeys.append("reverseAPIDeviceIndex");
sendSettings(); sendSettings();
} }

View File

@ -52,6 +52,7 @@ private:
Ui::PlutoSDRMIMOGUI* ui; Ui::PlutoSDRMIMOGUI* ui;
PlutoSDRMIMOSettings m_settings; PlutoSDRMIMOSettings m_settings;
QList<QString> m_settingsKeys;
bool m_rxElseTx; //!< Which side is being dealt with bool m_rxElseTx; //!< Which side is being dealt with
int m_streamIndex; //!< Current stream index being dealt with int m_streamIndex; //!< Current stream index being dealt with
bool m_spectrumRxElseTx; bool m_spectrumRxElseTx;

View File

@ -284,6 +284,270 @@ bool PlutoSDRMIMOSettings::deserialize(const QByteArray& data)
} }
} }
void PlutoSDRMIMOSettings::applySettings(const QStringList& settingsKeys, const PlutoSDRMIMOSettings& settings)
{
if (settingsKeys.contains("devSampleRate")) {
m_devSampleRate = settings.m_devSampleRate;
}
if (settingsKeys.contains("LOppmTenths")) {
m_LOppmTenths = settings.m_LOppmTenths;
}
if (settingsKeys.contains("rxCenterFrequency")) {
m_rxCenterFrequency = settings.m_rxCenterFrequency;
}
if (settingsKeys.contains("fcPosRx")) {
m_fcPosRx = settings.m_fcPosRx;
}
if (settingsKeys.contains("log2Decim")) {
m_log2Decim = settings.m_log2Decim;
}
if (settingsKeys.contains("dcBlock")) {
m_dcBlock = settings.m_dcBlock;
}
if (settingsKeys.contains("iqCorrection")) {
m_iqCorrection = settings.m_iqCorrection;
}
if (settingsKeys.contains("hwBBDCBlock")) {
m_hwBBDCBlock = settings.m_hwBBDCBlock;
}
if (settingsKeys.contains("hwRFDCBlock")) {
m_hwRFDCBlock = settings.m_hwRFDCBlock;
}
if (settingsKeys.contains("hwIQCorrection")) {
m_hwIQCorrection = settings.m_hwIQCorrection;
}
if (settingsKeys.contains("lpfBWRx")) {
m_lpfBWRx = settings.m_lpfBWRx;
}
if (settingsKeys.contains("lpfRxFIREnable")) {
m_lpfRxFIREnable = settings.m_lpfRxFIREnable;
}
if (settingsKeys.contains("lpfRxFIRBW")) {
m_lpfRxFIRBW = settings.m_lpfRxFIRBW;
}
if (settingsKeys.contains("lpfRxFIRlog2Decim")) {
m_lpfRxFIRlog2Decim = settings.m_lpfRxFIRlog2Decim;
}
if (settingsKeys.contains("lpfRxFIRGain")) {
m_lpfRxFIRGain = settings.m_lpfRxFIRGain;
}
if (settingsKeys.contains("rxTransverterMode")) {
m_rxTransverterMode = settings.m_rxTransverterMode;
}
if (settingsKeys.contains("rxTransverterDeltaFrequency")) {
m_rxTransverterDeltaFrequency = settings.m_rxTransverterDeltaFrequency;
}
if (settingsKeys.contains("iqOrder")) {
m_iqOrder = settings.m_iqOrder;
}
if (settingsKeys.contains("rx0Gain")) {
m_rx0Gain = settings.m_rx0Gain;
}
if (settingsKeys.contains("rx0AntennaPath")) {
m_rx0AntennaPath = settings.m_rx0AntennaPath;
}
if (settingsKeys.contains("rx0GainMode")) {
m_rx0GainMode = settings.m_rx0GainMode;
}
if (settingsKeys.contains("rx1Gain")) {
m_rx1Gain = settings.m_rx1Gain;
}
if (settingsKeys.contains("rx1AntennaPath")) {
m_rx1AntennaPath = settings.m_rx1AntennaPath;
}
if (settingsKeys.contains("rx1GainMode")) {
m_rx1GainMode = settings.m_rx1GainMode;
}
if (settingsKeys.contains("txCenterFrequency")) {
m_txCenterFrequency = settings.m_txCenterFrequency;
}
if (settingsKeys.contains("fcPosTx")) {
m_fcPosTx = settings.m_fcPosTx;
}
if (settingsKeys.contains("log2Interp")) {
m_log2Interp = settings.m_log2Interp;
}
if (settingsKeys.contains("lpfBWTx")) {
m_lpfBWTx = settings.m_lpfBWTx;
}
if (settingsKeys.contains("lpfTxFIREnable")) {
m_lpfTxFIREnable = settings.m_lpfTxFIREnable;
}
if (settingsKeys.contains("lpfTxFIRBW")) {
m_lpfTxFIRBW = settings.m_lpfTxFIRBW;
}
if (settingsKeys.contains("lpfTxFIRlog2Interp")) {
m_lpfTxFIRlog2Interp = settings.m_lpfTxFIRlog2Interp;
}
if (settingsKeys.contains("lpfTxFIRGain")) {
m_lpfTxFIRGain = settings.m_lpfTxFIRGain;
}
if (settingsKeys.contains("txTransverterMode")) {
m_txTransverterMode = settings.m_txTransverterMode;
}
if (settingsKeys.contains("txTransverterDeltaFrequency")) {
m_txTransverterDeltaFrequency = settings.m_txTransverterDeltaFrequency;
}
if (settingsKeys.contains("tx0Att")) {
m_tx0Att = settings.m_tx0Att;
}
if (settingsKeys.contains("tx0AntennaPath")) {
m_tx0AntennaPath = settings.m_tx0AntennaPath;
}
if (settingsKeys.contains("tx1Att")) {
m_tx1Att = settings.m_tx1Att;
}
if (settingsKeys.contains("tx1AntennaPath")) {
m_tx1AntennaPath = settings.m_tx1AntennaPath;
}
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 PlutoSDRMIMOSettings::getDebugString(const QStringList& settingsKeys, bool force) const
{
std::ostringstream ostr;
if (settingsKeys.contains("devSampleRate") || force) {
ostr << " m_devSampleRate: " << m_devSampleRate;
}
if (settingsKeys.contains("LOppmTenths") || force) {
ostr << " m_LOppmTenths: " << m_LOppmTenths;
}
if (settingsKeys.contains("rxCenterFrequency") || force) {
ostr << " m_rxCenterFrequency: " << m_rxCenterFrequency;
}
if (settingsKeys.contains("fcPosRx") || force) {
ostr << " m_fcPosRx: " << m_fcPosRx;
}
if (settingsKeys.contains("log2Decim") || force) {
ostr << " m_log2Decim: " << m_log2Decim;
}
if (settingsKeys.contains("dcBlock") || force) {
ostr << " m_dcBlock: " << m_dcBlock;
}
if (settingsKeys.contains("iqCorrection") || force) {
ostr << " m_iqCorrection: " << m_iqCorrection;
}
if (settingsKeys.contains("hwBBDCBlock") || force) {
ostr << " m_hwBBDCBlock: " << m_hwBBDCBlock;
}
if (settingsKeys.contains("hwRFDCBlock") || force) {
ostr << " m_hwRFDCBlock: " << m_hwRFDCBlock;
}
if (settingsKeys.contains("hwIQCorrection") || force) {
ostr << " m_hwIQCorrection: " << m_hwIQCorrection;
}
if (settingsKeys.contains("lpfBWRx") || force) {
ostr << " m_lpfBWRx: " << m_lpfBWRx;
}
if (settingsKeys.contains("lpfRxFIREnable") || force) {
ostr << " m_lpfRxFIREnable: " << m_lpfRxFIREnable;
}
if (settingsKeys.contains("lpfRxFIRBW") || force) {
ostr << " m_lpfRxFIRBW: " << m_lpfRxFIRBW;
}
if (settingsKeys.contains("lpfRxFIRlog2Decim") || force) {
ostr << " m_lpfRxFIRlog2Decim: " << m_lpfRxFIRlog2Decim;
}
if (settingsKeys.contains("lpfRxFIRGain") || force) {
ostr << " m_lpfRxFIRGain: " << m_lpfRxFIRGain;
}
if (settingsKeys.contains("rxTransverterMode") || force) {
ostr << " m_rxTransverterMode: " << m_rxTransverterMode;
}
if (settingsKeys.contains("rxTransverterDeltaFrequency") || force) {
ostr << " m_rxTransverterDeltaFrequency: " << m_rxTransverterDeltaFrequency;
}
if (settingsKeys.contains("iqOrder") || force) {
ostr << " m_iqOrder: " << m_iqOrder;
}
if (settingsKeys.contains("rx0Gain") || force) {
ostr << " m_rx0Gain: " << m_rx0Gain;
}
if (settingsKeys.contains("rx0AntennaPath") || force) {
ostr << " m_rx0AntennaPath: " << m_rx0AntennaPath;
}
if (settingsKeys.contains("rx0GainMode") || force) {
ostr << " m_rx0GainMode: " << m_rx0GainMode;
}
if (settingsKeys.contains("rx1Gain") || force) {
ostr << " m_rx1Gain: " << m_rx1Gain;
}
if (settingsKeys.contains("rx1AntennaPath") || force) {
ostr << " m_rx1AntennaPath: " << m_rx1AntennaPath;
}
if (settingsKeys.contains("rx1GainMode") || force) {
ostr << " m_rx1GainMode: " << m_rx1GainMode;
}
if (settingsKeys.contains("txCenterFrequency") || force) {
ostr << " m_txCenterFrequency: " << m_txCenterFrequency;
}
if (settingsKeys.contains("fcPosTx") || force) {
ostr << " m_fcPosTx: " << m_fcPosTx;
}
if (settingsKeys.contains("log2Interp") || force) {
ostr << " m_log2Interp: " << m_log2Interp;
}
if (settingsKeys.contains("lpfBWTx") || force) {
ostr << " m_lpfBWTx: " << m_lpfBWTx;
}
if (settingsKeys.contains("lpfTxFIREnable") || force) {
ostr << " m_lpfTxFIREnable: " << m_lpfTxFIREnable;
}
if (settingsKeys.contains("lpfTxFIRBW") || force) {
ostr << " m_lpfTxFIRBW: " << m_lpfTxFIRBW;
}
if (settingsKeys.contains("lpfTxFIRlog2Interp") || force) {
ostr << " m_lpfTxFIRlog2Interp: " << m_lpfTxFIRlog2Interp;
}
if (settingsKeys.contains("lpfTxFIRGain") || force) {
ostr << " m_lpfTxFIRGain: " << m_lpfTxFIRGain;
}
if (settingsKeys.contains("txTransverterMode") || force) {
ostr << " m_txTransverterMode: " << m_txTransverterMode;
}
if (settingsKeys.contains("txTransverterDeltaFrequency") || force) {
ostr << " m_txTransverterDeltaFrequency: " << m_txTransverterDeltaFrequency;
}
if (settingsKeys.contains("tx0Att") || force) {
ostr << " m_tx0Att: " << m_tx0Att;
}
if (settingsKeys.contains("tx0AntennaPath") || force) {
ostr << " m_tx0AntennaPath: " << m_tx0AntennaPath;
}
if (settingsKeys.contains("tx1Att") || force) {
ostr << " m_tx1Att: " << m_tx1Att;
}
if (settingsKeys.contains("tx1AntennaPath") || force) {
ostr << " m_tx1AntennaPath: " << m_tx1AntennaPath;
}
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());
}
void PlutoSDRMIMOSettings::translateRFPathTx(RFPathTx path, QString& s) void PlutoSDRMIMOSettings::translateRFPathTx(RFPathTx path, QString& s)
{ {
switch(path) switch(path)

View File

@ -128,6 +128,8 @@ struct PlutoSDRMIMOSettings {
void resetToDefaults(); void resetToDefaults();
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);
void applySettings(const QStringList& settingsKeys, const PlutoSDRMIMOSettings& settings);
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
static void translateRFPathRx(RFPathRx path, QString& s); static void translateRFPathRx(RFPathRx path, QString& s);
static void translateGainMode(GainMode mod, QString& s); static void translateGainMode(GainMode mod, QString& s);
static void translateRFPathTx(RFPathTx path, QString& s); static void translateRFPathTx(RFPathTx path, QString& s);