New scope: ensure only a trace length of samples is processed at a time

This commit is contained in:
f4exb 2017-02-08 22:22:27 +01:00
parent 66b584d264
commit f2b04539cf
2 changed files with 25 additions and 1 deletions

View File

@ -144,6 +144,25 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
SampleVector::const_iterator begin(cbegin);
while (begin < end)
{
if (begin + m_traceSize > end)
{
processTrace(begin, end);
begin = end;
}
else
{
processTrace(begin, begin + m_traceSize);
begin += m_traceSize;
}
}
}
void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end)
{
SampleVector::const_iterator begin(cbegin);
// memory storage
m_traceDiscreteMemory.current().write(cbegin, end);
@ -215,7 +234,7 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
if (remainder > 0)
{
feed(nbegin, nend, positiveOnly);
processTrace(nbegin, nend);
}
}

View File

@ -777,6 +777,11 @@ private:
*/
bool nextTrigger(); //!< Returns true if not final
/**
* Process a sample trace which length is at most the trace length (m_traceSize)
*/
void processTrace(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
/**
* Process traces from complex trace memory buffer.
* - if finished it returns the number of unprocessed samples left in the buffer