LimeSDR input: suspend thread while changing configuration

This commit is contained in:
f4exb 2017-04-18 23:26:30 +02:00
parent 54f3a51203
commit 763175ab55
2 changed files with 41 additions and 5 deletions

View File

@ -211,7 +211,6 @@ bool LimeSDRInput::start()
m_limeSDRInputThread->startWork();
applySettings(m_settings, true);
m_running = true;
return true;
@ -322,6 +321,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
bool forwardChangeRxDSP = false;
bool forwardChangeAllDSP = false;
bool doCalibration = false;
bool threadStopped = false;
// QMutexLocker mutexLocker(&m_mutex);
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
@ -342,6 +342,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (m_limeSDRInputThread && !threadStopped)
{
m_limeSDRInputThread->stopWork();
threadStopped = true;
}
if (LMS_SetGaindB(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
@ -368,6 +374,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (m_limeSDRInputThread && !threadStopped)
{
m_limeSDRInputThread->stopWork();
threadStopped = true;
}
if (LMS_SetSampleRateDir(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_settings.m_devSampleRate,
@ -395,6 +407,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (m_limeSDRInputThread && !threadStopped)
{
m_limeSDRInputThread->stopWork();
threadStopped = true;
}
if (LMS_SetLPFBW(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
@ -418,6 +436,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (m_limeSDRInputThread && !threadStopped)
{
m_limeSDRInputThread->stopWork();
threadStopped = true;
}
if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel,
@ -457,6 +481,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if (m_deviceShared.m_deviceParams->getDevice() != 0)
{
if (m_limeSDRInputThread && !threadStopped)
{
m_limeSDRInputThread->stopWork();
threadStopped = true;
}
if (LMS_SetLOFrequency(m_deviceShared.m_deviceParams->getDevice(),
LMS_CH_RX,
m_deviceShared.m_channel, // same for both channels anyway but switches antenna port automatically
@ -488,6 +518,12 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
}
}
if (threadStopped)
{
m_limeSDRInputThread->startWork();
threadStopped = false;
}
if (forwardChangeAllDSP)
{
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();

View File

@ -25,15 +25,15 @@ LimeSDRInputSettings::LimeSDRInputSettings()
void LimeSDRInputSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_devSampleRate = 6000000;
m_log2HardDecim = 2;
m_devSampleRate = 5000000;
m_log2HardDecim = 3;
m_dcBlock = false;
m_iqCorrection = false;
m_log2SoftDecim = 0;
m_fcPos = FC_POS_CENTER;
m_lpfBW = 1.5e6f;
m_lpfBW = 4.5e6f;
m_lpfFIREnable = false;
m_lpfFIRBW = 1.5e6f;
m_lpfFIRBW = 2.5e6f;
m_gain = 0;
}