1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-18 13:42:26 -04:00

Scope: rationalize trigger location computation

This commit is contained in:
f4exb 2018-11-21 11:08:43 +01:00
parent f1eeed38da
commit e2440afd87
2 changed files with 7 additions and 8 deletions

View File

@ -253,9 +253,8 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
{ {
triggerPointToEnd = -1; triggerPointToEnd = -1;
processTrace(begin, end, triggerPointToEnd); // use all buffer processTrace(begin, end, triggerPointToEnd); // use all buffer
if (triggerPointToEnd >= 0) { m_triggerLocation = triggerPointToEnd < 0 ? 0 : triggerPointToEnd; // trim negative values
m_triggerLocation = triggerPointToEnd; m_triggerLocation = m_triggerLocation > end - begin ? end - begin : m_triggerLocation; // trim past begin values
}
begin = end; // effectively breaks out the loop begin = end; // effectively breaks out the loop
} }
@ -263,10 +262,10 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
{ {
triggerPointToEnd = -1; triggerPointToEnd = -1;
processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size
if (triggerPointToEnd >= 0) {
//m_triggerPoint = begin + m_traceSize - triggerPointToEnd; //m_triggerPoint = begin + m_traceSize - triggerPointToEnd;
m_triggerLocation = triggerPointToEnd - m_traceSize; m_triggerLocation = end - begin + m_traceSize - triggerPointToEnd; // should always refer to end iterator
} m_triggerLocation = m_triggerLocation < 0 ? 0 : m_triggerLocation; // trim negative values
m_triggerLocation = m_triggerLocation > end - begin ? end - begin : m_triggerLocation; // trim past begin values
begin += m_traceSize; begin += m_traceSize;
} }

View File

@ -21,7 +21,7 @@ void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, cons
//SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint(); //SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint();
//m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly); //m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly);
int triggerPointLocation = m_scopeVis->getTriggerLocation(); int triggerPointLocation = m_scopeVis->getTriggerLocation();
if ((triggerPointLocation >= 0) && (triggerPointLocation < end - begin)) { if ((triggerPointLocation >= 0) && (triggerPointLocation <= end - begin)) {
m_spectrumVis->feedTriggered(end - triggerPointLocation, end, positiveOnly); m_spectrumVis->feedTriggered(end - triggerPointLocation, end, positiveOnly);
} else { } else {
m_spectrumVis->feedTriggered(begin, end, positiveOnly); m_spectrumVis->feedTriggered(begin, end, positiveOnly);