1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-27 02:09:14 -05:00

LimeSDR input: perform automatic calibration after configuration change

This commit is contained in:
f4exb 2017-04-18 13:50:28 +02:00
parent 3d12ff1de0
commit 65cccbdd75

View File

@ -311,6 +311,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
bool forwardChangeOwnDSP = false; bool forwardChangeOwnDSP = false;
bool forwardChangeRxDSP = false; bool forwardChangeRxDSP = false;
bool forwardChangeAllDSP = false; bool forwardChangeAllDSP = false;
bool doCalibration = false;
// QMutexLocker mutexLocker(&m_mutex); // QMutexLocker mutexLocker(&m_mutex);
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force) if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
@ -340,6 +341,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
} }
else else
{ {
doCalibration = true;
qDebug() << "LimeSDRInput::applySettings: Gain set to " << m_settings.m_gain; qDebug() << "LimeSDRInput::applySettings: Gain set to " << m_settings.m_gain;
} }
} }
@ -369,6 +371,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
{ {
m_deviceShared.m_deviceParams->m_log2OvSRRx = m_settings.m_log2HardDecim; m_deviceShared.m_deviceParams->m_log2OvSRRx = m_settings.m_log2HardDecim;
m_deviceShared.m_deviceParams->m_sampleRate = m_settings.m_devSampleRate; m_deviceShared.m_deviceParams->m_sampleRate = m_settings.m_devSampleRate;
doCalibration = true;
qDebug("LimeSDRInput::applySettings: set sample rate set to %d with oversampling of %d", qDebug("LimeSDRInput::applySettings: set sample rate set to %d with oversampling of %d",
m_settings.m_devSampleRate, m_settings.m_devSampleRate,
1<<m_settings.m_log2HardDecim); 1<<m_settings.m_log2HardDecim);
@ -391,6 +394,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
} }
else else
{ {
doCalibration = true;
qDebug("LimeSDRInput::applySettings: LPF set to %f Hz", m_settings.m_lpfBW); qDebug("LimeSDRInput::applySettings: LPF set to %f Hz", m_settings.m_lpfBW);
} }
} }
@ -416,6 +420,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
} }
else else
{ {
doCalibration = true;
qDebug("LimeSDRInput::applySettings: %sd and set LPF FIR to %f Hz", qDebug("LimeSDRInput::applySettings: %sd and set LPF FIR to %f Hz",
m_settings.m_lpfFIREnable ? "enable" : "disable", m_settings.m_lpfFIREnable ? "enable" : "disable",
m_settings.m_lpfFIRBW); m_settings.m_lpfFIRBW);
@ -451,11 +456,28 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
} }
else else
{ {
doCalibration = true;
qDebug("LimeSDRInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency); qDebug("LimeSDRInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency);
} }
} }
} }
if (doCalibration)
{
if (LMS_Calibrate(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
m_settings.m_lpfBW,
0) < 0)
{
qCritical("LimeSDRInput::applySettings: calibration failed on Rx channel %lu", m_deviceShared.m_channel);
}
else
{
qDebug("LimeSDRInput::applySettings: calibration successful on Rx channel %lu", m_deviceShared.m_channel);
}
}
if (forwardChangeAllDSP) if (forwardChangeAllDSP)
{ {
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies(); const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();