1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 06:24:48 -04:00

All device plugins: make sure start and stop are effective once only. PArt of #2159

This commit is contained in:
f4exb
2024-08-21 05:27:01 +02:00
committed by Edouard Griffiths
parent 1b37a4f504
commit 585d806ef8
40 changed files with 454 additions and 243 deletions
@@ -409,14 +409,17 @@ void LimeSDRInput::init()
bool LimeSDRInput::start()
{
QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return true;
}
if (!m_deviceShared.m_deviceParams->getDevice()) {
return false;
}
if (m_running) { stop(); }
if (!acquireChannel())
{
if (!acquireChannel()) {
return false;
}
@@ -425,21 +428,28 @@ bool LimeSDRInput::start()
m_limeSDRInputThread = new LimeSDRInputThread(&m_streamId, &m_sampleFifo, &m_replayBuffer);
qDebug("LimeSDRInput::start: thread created");
applySettings(m_settings, QList<QString>(), true);
m_limeSDRInputThread->setLog2Decimation(m_settings.m_log2SoftDecim);
m_limeSDRInputThread->setIQOrder(m_settings.m_iqOrder);
m_limeSDRInputThread->startWork();
m_deviceShared.m_thread = m_limeSDRInputThread;
m_running = true;
mutexLocker.unlock();
applySettings(m_settings, QList<QString>(), true);
return true;
}
void LimeSDRInput::stop()
{
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
qDebug("LimeSDRInput::stop");
m_running = false;
if (m_limeSDRInputThread)
{
@@ -449,7 +459,6 @@ void LimeSDRInput::stop()
}
m_deviceShared.m_thread = 0;
m_running = false;
releaseChannel();
}
@@ -803,7 +812,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, const QLi
bool doLPCalibration = false;
double clockGenFreq = 0.0;
// QMutexLocker mutexLocker(&m_mutex);
QMutexLocker mutexLocker(&m_mutex);
qint64 deviceCenterFrequency = settings.m_centerFrequency;
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;