mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
HackRF output: suspend thread when baseband sample rate changes
This commit is contained in:
parent
287bf8120d
commit
7b851e8326
@ -214,11 +214,31 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
{
|
||||
// QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
bool forwardChange = false;
|
||||
bool forwardChange = false;
|
||||
bool suspendThread = false;
|
||||
bool threadWasRunning = false;
|
||||
hackrf_error rc;
|
||||
|
||||
qDebug() << "HackRFOutput::applySettings";
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) ||
|
||||
(m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
{
|
||||
suspendThread = true;
|
||||
}
|
||||
|
||||
if (suspendThread)
|
||||
{
|
||||
if (m_hackRFThread)
|
||||
{
|
||||
if (m_hackRFThread->isRunning())
|
||||
{
|
||||
m_hackRFThread->stopWork();
|
||||
threadWasRunning = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
{
|
||||
forwardChange = true;
|
||||
@ -339,6 +359,11 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
if (threadWasRunning)
|
||||
{
|
||||
m_hackRFThread->startWork();
|
||||
}
|
||||
|
||||
m_settings.m_devSampleRate = settings.m_devSampleRate;
|
||||
m_settings.m_log2Interp = settings.m_log2Interp;
|
||||
m_settings.m_centerFrequency = settings.m_centerFrequency;
|
||||
|
@ -47,6 +47,7 @@ void HackRFOutputThread::startWork()
|
||||
|
||||
void HackRFOutputThread::stopWork()
|
||||
{
|
||||
if (!m_running) return;
|
||||
qDebug("HackRFOutputThread::stopWork");
|
||||
m_running = false;
|
||||
wait();
|
||||
|
Loading…
Reference in New Issue
Block a user