1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-28 21:12:26 -04:00

New scope: add/delete traces interim state (2) improved stability

This commit is contained in:
f4exb 2017-02-13 03:23:29 +01:00
parent 77072ec967
commit acba573ce7
2 changed files with 17 additions and 6 deletions

View File

@ -16,6 +16,8 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <QDebug>
#include <QMutexLocker>
#include "scopevisng.h" #include "scopevisng.h"
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "gui/glscopeng.h" #include "gui/glscopeng.h"
@ -147,16 +149,19 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
m_triggerPoint = cbegin; m_triggerPoint = cbegin;
} }
if (m_triggerState == TriggerNewConfig) // if (m_triggerState == TriggerNewConfig)
{ // {
m_triggerState = TriggerUntriggered; // m_triggerState = TriggerUntriggered;
return; // return;
} // }
if ((m_triggerConditions.size() > 0) && (m_triggerState == TriggerWait)) { if ((m_triggerConditions.size() > 0) && (m_triggerState == TriggerWait)) {
return; return;
} }
if(!m_mutex.tryLock(2))
return;
SampleVector::const_iterator begin(cbegin); SampleVector::const_iterator begin(cbegin);
int triggerPointToEnd; int triggerPointToEnd;
@ -181,6 +186,8 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
begin += m_traceSize; begin += m_traceSize;
} }
} }
m_mutex.unlock();
} }
void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, int& triggerPointToEnd) void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, int& triggerPointToEnd)
@ -453,6 +460,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
} }
else if (MsgConfigureScopeVisNG::match(message)) else if (MsgConfigureScopeVisNG::match(message))
{ {
QMutexLocker configLocker(&m_mutex);
MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message; MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
uint32_t traceSize = conf.getTraceSize(); uint32_t traceSize = conf.getTraceSize();
@ -554,6 +562,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
} }
else if (MsgScopeVisNGAddTrace::match(message)) else if (MsgScopeVisNGAddTrace::match(message))
{ {
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGAddTrace& conf = (MsgScopeVisNGAddTrace&) message; MsgScopeVisNGAddTrace& conf = (MsgScopeVisNGAddTrace&) message;
m_traces.addTrace(conf.getTraceData(), m_traceSize); m_traces.addTrace(conf.getTraceData(), m_traceSize);
initTraceBuffers(); initTraceBuffers();
@ -564,6 +573,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
} }
else if (MsgScopeVisNGChangeTrace::match(message)) else if (MsgScopeVisNGChangeTrace::match(message))
{ {
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGChangeTrace& conf = (MsgScopeVisNGChangeTrace&) message; MsgScopeVisNGChangeTrace& conf = (MsgScopeVisNGChangeTrace&) message;
bool doComputeTriggerLevelsOnDisplay = m_traces.isVerticalDisplayChange(conf.getTraceData(), conf.getTraceIndex()); bool doComputeTriggerLevelsOnDisplay = m_traces.isVerticalDisplayChange(conf.getTraceData(), conf.getTraceIndex());
m_traces.changeTrace(conf.getTraceData(), conf.getTraceIndex()); m_traces.changeTrace(conf.getTraceData(), conf.getTraceIndex());
@ -574,6 +584,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
} }
else if (MsgScopeVisNGRemoveTrace::match(message)) else if (MsgScopeVisNGRemoveTrace::match(message))
{ {
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGRemoveTrace& conf = (MsgScopeVisNGRemoveTrace&) message; MsgScopeVisNGRemoveTrace& conf = (MsgScopeVisNGRemoveTrace&) message;
m_traces.removeTrace(conf.getTraceIndex()); m_traces.removeTrace(conf.getTraceIndex());
updateMaxTraceDelay(); updateMaxTraceDelay();

View File

@ -682,7 +682,6 @@ private:
~TraceControl() ~TraceControl()
{ {
if (m_projector) delete m_projector;
} }
void initProjector(ProjectionType projectionType) void initProjector(ProjectionType projectionType)
@ -895,6 +894,7 @@ private:
bool m_freeRun; //!< True if free running (trigger globally disabled) bool m_freeRun; //!< True if free running (trigger globally disabled)
int m_maxTraceDelay; //!< Maximum trace delay int m_maxTraceDelay; //!< Maximum trace delay
TriggerComparator m_triggerComparator; //!< Compares sample level to trigger level TriggerComparator m_triggerComparator; //!< Compares sample level to trigger level
QMutex m_mutex;
/** /**
* Moves on to the next trigger if any or increments trigger count if in repeat mode * Moves on to the next trigger if any or increments trigger count if in repeat mode