mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
LimeSDR input: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
30d08b2911
commit
793bf690a2
@ -402,7 +402,7 @@ void LimeSDRInput::releaseChannel()
|
||||
|
||||
void LimeSDRInput::init()
|
||||
{
|
||||
applySettings(m_settings, true, false);
|
||||
applySettings(m_settings, QList<QString>(), true, false);
|
||||
}
|
||||
|
||||
bool LimeSDRInput::start()
|
||||
@ -423,7 +423,7 @@ bool LimeSDRInput::start()
|
||||
m_limeSDRInputThread = new LimeSDRInputThread(&m_streamId, &m_sampleFifo);
|
||||
qDebug("LimeSDRInput::start: thread created");
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
|
||||
m_limeSDRInputThread->setLog2Decimation(m_settings.m_log2SoftDecim);
|
||||
m_limeSDRInputThread->setIQOrder(m_settings.m_iqOrder);
|
||||
@ -467,12 +467,12 @@ bool LimeSDRInput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(m_settings, true);
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(m_settings, true);
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -500,12 +500,12 @@ void LimeSDRInput::setCenterFrequency(qint64 centerFrequency)
|
||||
LimeSDRInputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency - (m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0);
|
||||
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(settings, false);
|
||||
MsgConfigureLimeSDR* message = MsgConfigureLimeSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(settings, false);
|
||||
MsgConfigureLimeSDR* messageToGUI = MsgConfigureLimeSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -560,8 +560,7 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
MsgConfigureLimeSDR& conf = (MsgConfigureLimeSDR&) message;
|
||||
qDebug() << "LimeSDRInput::handleMessage: MsgConfigureLimeSDR";
|
||||
|
||||
if (!applySettings(conf.getSettings(), conf.getForce()))
|
||||
{
|
||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
||||
qDebug("LimeSDRInput::handleMessage config error");
|
||||
}
|
||||
|
||||
@ -609,7 +608,12 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
|
||||
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change
|
||||
{
|
||||
applySettings(m_settings, false, true);
|
||||
applySettings(
|
||||
m_settings,
|
||||
QList<QString>{"devSampleRate", "log2HardDecim", "m_centerFrequency"},
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
int ncoShift = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0;
|
||||
@ -778,8 +782,9 @@ bool LimeSDRInput::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool force, bool forceNCOFrequency)
|
||||
bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, const QList<QString>& settingsKeys, bool force, bool forceNCOFrequency)
|
||||
{
|
||||
qDebug() << "LimeSDRInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force);
|
||||
bool forwardChangeOwnDSP = false;
|
||||
bool forwardChangeRxDSP = false;
|
||||
bool forwardChangeAllDSP = false;
|
||||
@ -789,7 +794,6 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
bool doCalibration = false;
|
||||
bool doLPCalibration = false;
|
||||
double clockGenFreq = 0.0;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
@ -797,33 +801,20 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
|
||||
if (LMS_GetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_CGEN, &clockGenFreq) != 0)
|
||||
{
|
||||
if (LMS_GetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_CGEN, &clockGenFreq) != 0) {
|
||||
qCritical("LimeSDRInput::applySettings: could not get clock gen frequency");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
qDebug() << "LimeSDRInput::applySettings: clock gen frequency: " << clockGenFreq;
|
||||
}
|
||||
|
||||
// apply settings
|
||||
|
||||
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
|
||||
{
|
||||
reverseAPIKeys.append("dcBlock");
|
||||
if (settingsKeys.contains("dcBlock") || settingsKeys.contains("iqCorrection") || force) {
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
if (settingsKeys.contains("gainMode") || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqCorrection");
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
|
||||
}
|
||||
|
||||
if ((m_settings.m_gainMode != settings.m_gainMode) || force)
|
||||
{
|
||||
reverseAPIKeys.append("gainMode");
|
||||
|
||||
if (settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO)
|
||||
{
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
@ -885,10 +876,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO) && (m_settings.m_gain != settings.m_gain))
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO) && settingsKeys.contains("gain"))
|
||||
{
|
||||
reverseAPIKeys.append("gain");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (LMS_SetGaindB(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -906,10 +895,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_lnaGain != settings.m_lnaGain))
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && settingsKeys.contains("lnaGain"))
|
||||
{
|
||||
reverseAPIKeys.append("lnaGain");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (DeviceLimeSDR::SetRFELNA_dB(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -926,10 +913,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_tiaGain != settings.m_tiaGain))
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && settingsKeys.contains("tiaGain"))
|
||||
{
|
||||
reverseAPIKeys.append("tiaGain");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (DeviceLimeSDR::SetRFETIA_dB(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -946,10 +931,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_pgaGain != settings.m_pgaGain))
|
||||
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && settingsKeys.contains("pgaGain"))
|
||||
{
|
||||
reverseAPIKeys.append("pgaGain");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (DeviceLimeSDR::SetRBBPGA_dB(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -966,11 +949,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate)
|
||||
|| (m_settings.m_log2HardDecim != settings.m_log2HardDecim) || force)
|
||||
if (settingsKeys.contains("devSampleRate")
|
||||
|| settingsKeys.contains("log2HardDecim") || force)
|
||||
{
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
reverseAPIKeys.append("log2HardDecim");
|
||||
forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
@ -997,22 +978,16 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
|
||||
if (settingsKeys.contains("lpfBW") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lpfBW");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired) {
|
||||
doLPCalibration = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) ||
|
||||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force)
|
||||
if (settingsKeys.contains("lpfFIRBW") ||
|
||||
settingsKeys.contains("lpfFIREnable") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lpfFIRBW");
|
||||
reverseAPIKeys.append("lpfFIREnable");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -1035,11 +1010,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_ncoFrequency != settings.m_ncoFrequency) ||
|
||||
(m_settings.m_ncoEnable != settings.m_ncoEnable) || force || forceNCOFrequency)
|
||||
if (settingsKeys.contains("ncoFrequency") ||
|
||||
settingsKeys.contains("ncoEnable") || force || forceNCOFrequency)
|
||||
{
|
||||
reverseAPIKeys.append("ncoFrequency");
|
||||
reverseAPIKeys.append("ncoEnable");
|
||||
forwardChangeOwnDSP = true;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
@ -1065,9 +1038,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2SoftDecim != settings.m_log2SoftDecim) || force)
|
||||
if (settingsKeys.contains("log2SoftDecim") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2SoftDecim");
|
||||
forwardChangeOwnDSP = true;
|
||||
m_deviceShared.m_log2Soft = settings.m_log2SoftDecim; // for buddies
|
||||
|
||||
@ -1078,19 +1050,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqOrder != settings.m_iqOrder) || force)
|
||||
if (settingsKeys.contains("iqOrder") || force)
|
||||
{
|
||||
reverseAPIKeys.append("iqOrder");
|
||||
|
||||
if (m_limeSDRInputThread) {
|
||||
m_limeSDRInputThread->setIQOrder(settings.m_iqOrder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
if (settingsKeys.contains("antennaPath") || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
{
|
||||
if (DeviceLimeSDR::setRxAntennaPath(m_deviceShared.m_deviceParams->getDevice(),
|
||||
@ -1110,14 +1078,11 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||
if (settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency")
|
||||
|| force)
|
||||
{
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
forwardChangeRxDSP = true;
|
||||
|
||||
if (m_deviceShared.m_deviceParams->getDevice() && m_channelAcquired)
|
||||
@ -1135,12 +1100,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_extClock != settings.m_extClock) ||
|
||||
(settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force)
|
||||
if (settingsKeys.contains("extClock") ||
|
||||
(settings.m_extClock && settingsKeys.contains("extClockFreq")) || force)
|
||||
{
|
||||
reverseAPIKeys.append("extClock");
|
||||
reverseAPIKeys.append("extClockFreq");
|
||||
|
||||
if (DeviceLimeSDR::setClockSource(m_deviceShared.m_deviceParams->getDevice(),
|
||||
settings.m_extClock,
|
||||
settings.m_extClockFreq))
|
||||
@ -1162,10 +1124,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
if ((m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeMini)
|
||||
&& (m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeUndefined))
|
||||
{
|
||||
if ((m_settings.m_gpioDir != settings.m_gpioDir) || force)
|
||||
if (settingsKeys.contains("gpioDir") || force)
|
||||
{
|
||||
reverseAPIKeys.append("gpioDir");
|
||||
|
||||
if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0)
|
||||
{
|
||||
qCritical("LimeSDRInput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir);
|
||||
@ -1177,10 +1137,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_gpioPins != settings.m_gpioPins) || force)
|
||||
if (settingsKeys.contains("gpioPins") || force)
|
||||
{
|
||||
reverseAPIKeys.append("gpioPins");
|
||||
|
||||
if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0)
|
||||
{
|
||||
qCritical("LimeSDRInput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins);
|
||||
@ -1193,16 +1151,21 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
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;
|
||||
double clockGenFreqAfter;
|
||||
|
||||
if (LMS_GetClockFreq(m_deviceShared.m_deviceParams->getDevice(), LMS_CLOCK_CGEN, &clockGenFreqAfter) != 0)
|
||||
@ -1387,31 +1350,11 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
||||
|
||||
QLocale loc;
|
||||
|
||||
qDebug().noquote() << "LimeSDRInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
|
||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||
<< " deviceCenterFrequency: " << deviceCenterFrequency
|
||||
<< " device stream sample rate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
|
||||
<< " sample rate with soft decimation: " << loc.toString( m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim)) << "S/s"
|
||||
<< " ADC sample rate with hard decimation: " << loc.toString(m_settings.m_devSampleRate*(1<<m_settings.m_log2HardDecim)) << "S/s"
|
||||
<< " m_log2HardDecim: " << m_settings.m_log2HardDecim
|
||||
<< " m_log2SoftDecim: " << m_settings.m_log2SoftDecim
|
||||
<< " m_iqOrder: " << m_settings.m_iqOrder
|
||||
<< " m_gain: " << m_settings.m_gain
|
||||
<< " m_lpfBW: " << loc.toString(static_cast<int>(m_settings.m_lpfBW))
|
||||
<< " m_lpfFIRBW: " << loc.toString(static_cast<int>(m_settings.m_lpfFIRBW))
|
||||
<< " m_lpfFIREnable: " << m_settings.m_lpfFIREnable
|
||||
<< " m_ncoEnable: " << m_settings.m_ncoEnable
|
||||
<< " m_ncoFrequency: " << loc.toString(m_settings.m_ncoFrequency)
|
||||
<< " m_antennaPath: " << m_settings.m_antennaPath
|
||||
<< " m_extClock: " << m_settings.m_extClock
|
||||
<< " m_extClockFreq: " << loc.toString(m_settings.m_extClockFreq)
|
||||
<< " m_gpioDir: " << m_settings.m_gpioDir
|
||||
<< " m_gpioPins: " << m_settings.m_gpioPins
|
||||
<< " force: " << force
|
||||
<< " forceNCOFrequency: " << forceNCOFrequency
|
||||
<< " doCalibration: " << doCalibration
|
||||
<< " doLPCalibration: " << doLPCalibration;
|
||||
qDebug().noquote() << "LimeSDRInput::applySettings: center freq: "
|
||||
<< " force: " << force
|
||||
<< " forceNCOFrequency: " << forceNCOFrequency
|
||||
<< " doCalibration: " << doCalibration
|
||||
<< " doLPCalibration: " << doLPCalibration;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1437,12 +1380,12 @@ int LimeSDRInput::webapiSettingsPutPatch(
|
||||
LimeSDRInputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, force);
|
||||
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureLimeSDR *msgToGUI = MsgConfigureLimeSDR::create(settings, force);
|
||||
MsgConfigureLimeSDR *msgToGUI = MsgConfigureLimeSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -1658,7 +1601,7 @@ void LimeSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respon
|
||||
response.getLimeSdrInputReport()->setGpioPins(gpioPins);
|
||||
}
|
||||
|
||||
void LimeSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force)
|
||||
void LimeSDRInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(0); // single Rx
|
||||
|
@ -42,20 +42,22 @@ public:
|
||||
|
||||
public:
|
||||
const LimeSDRInputSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureLimeSDR* create(const LimeSDRInputSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureLimeSDR(settings, force);
|
||||
static MsgConfigureLimeSDR* create(const LimeSDRInputSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureLimeSDR(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
LimeSDRInputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureLimeSDR(const LimeSDRInputSettings& settings, bool force) :
|
||||
MsgConfigureLimeSDR(const LimeSDRInputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -283,9 +285,9 @@ private:
|
||||
void resumeRxBuddies();
|
||||
void suspendTxBuddies();
|
||||
void resumeTxBuddies();
|
||||
bool applySettings(const LimeSDRInputSettings& settings, bool force = false, bool forceNCOFrequency = false);
|
||||
bool applySettings(const LimeSDRInputSettings& settings, const QList<QString>& settingsKeys, bool force = false, bool forceNCOFrequency = false);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -121,6 +121,7 @@ void LimeSDRInputGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
m_forceSettings = true;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -156,7 +157,13 @@ bool LimeSDRInputGUI::handleMessage(const Message& message)
|
||||
if (LimeSDRInput::MsgConfigureLimeSDR::match(message))
|
||||
{
|
||||
const LimeSDRInput::MsgConfigureLimeSDR& cfg = (LimeSDRInput::MsgConfigureLimeSDR&) message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
@ -313,7 +320,13 @@ void LimeSDRInputGUI::handleInputMessages()
|
||||
else if (LimeSDRInput::MsgConfigureLimeSDR::match(*message))
|
||||
{
|
||||
const LimeSDRInput::MsgConfigureLimeSDR& cfg = (LimeSDRInput::MsgConfigureLimeSDR&) *message;
|
||||
m_settings = cfg.getSettings();
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
displaySettings();
|
||||
|
||||
delete message;
|
||||
@ -512,9 +525,10 @@ void LimeSDRInputGUI::updateHardware()
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "LimeSDRInputGUI::updateHardware";
|
||||
LimeSDRInput::MsgConfigureLimeSDR* message = LimeSDRInput::MsgConfigureLimeSDR::create(m_settings, m_forceSettings);
|
||||
LimeSDRInput::MsgConfigureLimeSDR* message = LimeSDRInput::MsgConfigureLimeSDR::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_limeSDRInput->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -591,6 +605,7 @@ void LimeSDRInputGUI::on_startStop_toggled(bool checked)
|
||||
void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
setCenterFrequencySetting(value);
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -599,6 +614,7 @@ void LimeSDRInputGUI::on_ncoFrequency_changed(qint64 value)
|
||||
m_settings.m_ncoFrequency = value;
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencyDisplay();
|
||||
m_settingsKeys.append("ncoFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -607,18 +623,21 @@ void LimeSDRInputGUI::on_ncoEnable_toggled(bool checked)
|
||||
m_settings.m_ncoEnable = checked;
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencyDisplay();
|
||||
m_settingsKeys.append("ncoEnable");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
m_settingsKeys.append("iqCorrection");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -632,16 +651,20 @@ void LimeSDRInputGUI::on_sampleRate_changed(quint64 value)
|
||||
|
||||
updateADCRate();
|
||||
setNCODisplay();
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_hwDecim_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index <0) || (index > 5))
|
||||
if ((index <0) || (index > 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.m_log2HardDecim = index;
|
||||
updateADCRate();
|
||||
setNCODisplay();
|
||||
m_settingsKeys.append("log2HardDecim");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -660,6 +683,8 @@ void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index)
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftDecim);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("log2SoftDecim");
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -667,18 +692,21 @@ void LimeSDRInputGUI::on_lpf_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfBW = value * 1000;
|
||||
checkLPF();
|
||||
m_settingsKeys.append("lpfBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_lpFIREnable_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_lpfFIREnable = checked;
|
||||
m_settingsKeys.append("lpfFIREnable");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_lpFIR_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfFIRBW = value * 1000;
|
||||
m_settingsKeys.append("lpfFIRBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -701,6 +729,7 @@ void LimeSDRInputGUI::on_gainMode_currentIndexChanged(int index)
|
||||
ui->pgaGain->setEnabled(true);
|
||||
}
|
||||
|
||||
m_settingsKeys.append("gainMode");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -708,6 +737,7 @@ void LimeSDRInputGUI::on_gain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_gain = value;
|
||||
ui->gainText->setText(tr("%1").arg(m_settings.m_gain));
|
||||
m_settingsKeys.append("gain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -715,12 +745,14 @@ void LimeSDRInputGUI::on_lnaGain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_lnaGain = value;
|
||||
ui->lnaGainText->setText(tr("%1").arg(m_settings.m_lnaGain));
|
||||
m_settingsKeys.append("lnaGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_tiaGain_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_tiaGain = index + 1;
|
||||
m_settingsKeys.append("tiaGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -728,12 +760,14 @@ void LimeSDRInputGUI::on_pgaGain_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_pgaGain = value;
|
||||
ui->pgaGainText->setText(tr("%1").arg(m_settings.m_pgaGain));
|
||||
m_settingsKeys.append("pgaGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void LimeSDRInputGUI::on_antenna_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_antennaPath = (LimeSDRInputSettings::PathRFE) index;
|
||||
m_settingsKeys.append("antennaPath");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -742,6 +776,8 @@ void LimeSDRInputGUI::on_extClock_clicked()
|
||||
m_settings.m_extClock = ui->extClock->getExternalClockActive();
|
||||
m_settings.m_extClockFreq = ui->extClock->getExternalClockFrequency();
|
||||
qDebug("LimeSDRInputGUI::on_extClock_clicked: %u Hz %s", m_settings.m_extClockFreq, m_settings.m_extClock ? "on" : "off");
|
||||
m_settingsKeys.append("extClock");
|
||||
m_settingsKeys.append("extClockFreq");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -753,6 +789,10 @@ void LimeSDRInputGUI::on_transverter_clicked()
|
||||
qDebug("LimeSDRInputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
setCenterFrequencySetting(ui->centerFrequency->getValueNew());
|
||||
m_settingsKeys.append("transverterMode");
|
||||
m_settingsKeys.append("transverterDeltaFrequency");
|
||||
m_settingsKeys.append("iqOrder");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -779,6 +819,10 @@ void LimeSDRInputGUI::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:
|
||||
|
||||
LimeSDRInput* m_limeSDRInput; //!< Same object as above but gives easy access to LimeSDRInput methods and attributes that are used intensively
|
||||
LimeSDRInputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
|
@ -155,4 +155,182 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data)
|
||||
|
||||
}
|
||||
|
||||
void LimeSDRInputSettings::applySettings(const QStringList& settingsKeys, const LimeSDRInputSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("log2HardDecim")) {
|
||||
m_log2HardDecim = settings.m_log2HardDecim;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection")) {
|
||||
m_iqCorrection = settings.m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("log2SoftDecim")) {
|
||||
m_log2SoftDecim = settings.m_log2SoftDecim;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW")) {
|
||||
m_lpfBW = settings.m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIREnable")) {
|
||||
m_lpfFIREnable = settings.m_lpfFIREnable;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRBW")) {
|
||||
m_lpfFIRBW = settings.m_lpfFIRBW;
|
||||
}
|
||||
if (settingsKeys.contains("gain")) {
|
||||
m_gain = settings.m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("ncoEnable")) {
|
||||
m_ncoEnable = settings.m_ncoEnable;
|
||||
}
|
||||
if (settingsKeys.contains("ncoFrequency")) {
|
||||
m_ncoFrequency = settings.m_ncoFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath")) {
|
||||
m_antennaPath = settings.m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("gainMode")) {
|
||||
m_gainMode = settings.m_gainMode;
|
||||
}
|
||||
if (settingsKeys.contains("lnaGain")) {
|
||||
m_lnaGain = settings.m_lnaGain;
|
||||
}
|
||||
if (settingsKeys.contains("tiaGain")) {
|
||||
m_tiaGain = settings.m_tiaGain;
|
||||
}
|
||||
if (settingsKeys.contains("pgaGain")) {
|
||||
m_pgaGain = settings.m_pgaGain;
|
||||
}
|
||||
if (settingsKeys.contains("extClock")) {
|
||||
m_extClock = settings.m_extClock;
|
||||
}
|
||||
if (settingsKeys.contains("extClockFreq")) {
|
||||
m_extClockFreq = settings.m_extClockFreq;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder")) {
|
||||
m_iqOrder = settings.m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("gpioDir")) {
|
||||
m_gpioDir = settings.m_gpioDir;
|
||||
}
|
||||
if (settingsKeys.contains("gpioPins")) {
|
||||
m_gpioPins = settings.m_gpioPins;
|
||||
}
|
||||
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 LimeSDRInputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("log2HardDecim") || force) {
|
||||
ostr << " m_log2HardDecim: " << m_log2HardDecim;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqCorrection") || force) {
|
||||
ostr << " m_iqCorrection: " << m_iqCorrection;
|
||||
}
|
||||
if (settingsKeys.contains("log2SoftDecim") || force) {
|
||||
ostr << " m_log2SoftDecim: " << m_log2SoftDecim;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW") || force) {
|
||||
ostr << " m_lpfBW: " << m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIREnable") || force) {
|
||||
ostr << " m_lpfFIREnable: " << m_lpfFIREnable;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRBW") || force) {
|
||||
ostr << " m_lpfFIRBW: " << m_lpfFIRBW;
|
||||
}
|
||||
if (settingsKeys.contains("gain") || force) {
|
||||
ostr << " m_gain: " << m_gain;
|
||||
}
|
||||
if (settingsKeys.contains("ncoEnable") || force) {
|
||||
ostr << " m_ncoEnable: " << m_ncoEnable;
|
||||
}
|
||||
if (settingsKeys.contains("ncoFrequency") || force) {
|
||||
ostr << " m_ncoFrequency: " << m_ncoFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath") || force) {
|
||||
ostr << " m_antennaPath: " << m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("gainMode") || force) {
|
||||
ostr << " m_gainMode: " << m_gainMode;
|
||||
}
|
||||
if (settingsKeys.contains("lnaGain") || force) {
|
||||
ostr << " m_lnaGain: " << m_lnaGain;
|
||||
}
|
||||
if (settingsKeys.contains("tiaGain") || force) {
|
||||
ostr << " m_tiaGain: " << m_tiaGain;
|
||||
}
|
||||
if (settingsKeys.contains("pgaGain") || force) {
|
||||
ostr << " m_pgaGain: " << m_pgaGain;
|
||||
}
|
||||
if (settingsKeys.contains("extClock") || force) {
|
||||
ostr << " m_extClock: " << m_extClock;
|
||||
}
|
||||
if (settingsKeys.contains("extClockFreq") || force) {
|
||||
ostr << " m_extClockFreq: " << m_extClockFreq;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode") || force) {
|
||||
ostr << " m_transverterMode: " << m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("iqOrder") || force) {
|
||||
ostr << " m_iqOrder: " << m_iqOrder;
|
||||
}
|
||||
if (settingsKeys.contains("gpioDir") || force) {
|
||||
ostr << " m_gpioDir: " << m_gpioDir;
|
||||
}
|
||||
if (settingsKeys.contains("gpioPins") || force) {
|
||||
ostr << " m_gpioPins: " << m_gpioPins;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ struct LimeSDRInputSettings
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const LimeSDRInputSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user