diff --git a/sdrgui/dsp/scopevis.cpp b/sdrgui/dsp/scopevis.cpp index c64165386..0ef38c492 100644 --- a/sdrgui/dsp/scopevis.cpp +++ b/sdrgui/dsp/scopevis.cpp @@ -253,9 +253,8 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect { triggerPointToEnd = -1; processTrace(begin, end, triggerPointToEnd); // use all buffer - if (triggerPointToEnd >= 0) { - m_triggerLocation = triggerPointToEnd; - } + m_triggerLocation = triggerPointToEnd < 0 ? 0 : triggerPointToEnd; // trim negative values + m_triggerLocation = m_triggerLocation > end - begin ? end - begin : m_triggerLocation; // trim past begin values begin = end; // effectively breaks out the loop } @@ -263,10 +262,10 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect { triggerPointToEnd = -1; processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size - if (triggerPointToEnd >= 0) { - //m_triggerPoint = begin + m_traceSize - triggerPointToEnd; - m_triggerLocation = triggerPointToEnd - m_traceSize; - } + //m_triggerPoint = begin + m_traceSize - triggerPointToEnd; + 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; } diff --git a/sdrgui/dsp/spectrumscopecombovis.cpp b/sdrgui/dsp/spectrumscopecombovis.cpp index e7b6e2feb..62de78b74 100644 --- a/sdrgui/dsp/spectrumscopecombovis.cpp +++ b/sdrgui/dsp/spectrumscopecombovis.cpp @@ -21,7 +21,7 @@ void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, cons //SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint(); //m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly); int triggerPointLocation = m_scopeVis->getTriggerLocation(); - if ((triggerPointLocation >= 0) && (triggerPointLocation < end - begin)) { + if ((triggerPointLocation >= 0) && (triggerPointLocation <= end - begin)) { m_spectrumVis->feedTriggered(end - triggerPointLocation, end, positiveOnly); } else { m_spectrumVis->feedTriggered(begin, end, positiveOnly);