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

View File

@ -682,7 +682,6 @@ private:
~TraceControl()
{
if (m_projector) delete m_projector;
}
void initProjector(ProjectionType projectionType)
@ -895,6 +894,7 @@ private:
bool m_freeRun; //!< True if free running (trigger globally disabled)
int m_maxTraceDelay; //!< Maximum trace delay
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