1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Scope: comments and fixes mostly doubling trace size so that enough memory is present before trigger

This commit is contained in:
f4exb 2018-11-21 00:47:17 +01:00
parent 02a6cee99f
commit c1511d255e
2 changed files with 18 additions and 14 deletions

View File

@ -219,6 +219,15 @@ void ScopeVis::setMemoryIndex(uint32_t memoryIndex)
void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly)
{
(void) positiveOnly;
if (m_currentTraceMemoryIndex > 0) { // in memory mode live trace is suspended
return;
}
if (!m_mutex.tryLock(0)) { // prevent conflicts with configuration process
return;
}
if (m_freeRun) {
m_triggerPoint = cbegin;
}
@ -228,41 +237,36 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
else if (m_triggerState == TriggerUntriggered) {
m_triggerPoint = end;
}
else if ((m_triggerWaitForReset) || (m_currentTraceMemoryIndex > 0)) {
else if (m_triggerWaitForReset) {
m_triggerPoint = end;
}
else {
m_triggerPoint = cbegin;
}
if ((m_triggerWaitForReset) || (m_currentTraceMemoryIndex > 0)) {
return;
}
if(!m_mutex.tryLock(2)) // prevent conflicts with configuration process
return;
SampleVector::const_iterator begin(cbegin);
int triggerPointToEnd;
while (begin < end)
{
if (begin + m_traceSize > end)
if (begin + m_traceSize > end) // buffer smaller than trace size (end - bagin) < m_traceSize
{
triggerPointToEnd = -1;
processTrace(begin, end, triggerPointToEnd);
processTrace(begin, end, triggerPointToEnd); // use all buffer
if (triggerPointToEnd >= 0) {
m_triggerPoint = end - triggerPointToEnd;
}
begin = end;
begin = end; // effectively breaks out the loop
}
else
else // trace size fits in buffer
{
triggerPointToEnd = -1;
processTrace(begin, begin + m_traceSize, triggerPointToEnd);
processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size
if (triggerPointToEnd >= 0) {
m_triggerPoint = begin + m_traceSize -triggerPointToEnd;
}
begin += m_traceSize;
}
}

View File

@ -723,7 +723,7 @@ private:
for (std::vector<TraceBackBuffer>::iterator it = m_traceBackBuffers.begin(); it != m_traceBackBuffers.end(); ++it)
{
it->resize(m_traceSize); // was multiplied by 4
it->resize(2*m_traceSize); // was multiplied by 4
}
}