1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

GLScope: chained multiple triggers: interim state #2: implemented next trigger logic

This commit is contained in:
f4exb 2015-11-04 03:25:41 +01:00
parent ff719059f0
commit 2305357324
2 changed files with 50 additions and 9 deletions

View File

@ -110,7 +110,7 @@ private:
};
/**
* TriggerState:
* TriggerState: (repeat at each successive non freerun trigger)
*
* send a Trigger condition +--------------------+
* dummy trace - Immediate m_triggerOneShot | |
@ -151,6 +151,7 @@ private:
SampleVector::const_iterator m_triggerPoint;
bool triggerCondition(SampleVector::const_iterator& it);
bool nextTrigger(); //!< move to next trigger. Returns true if next trigger is active.
};
#endif // INCLUDE_SCOPEVIS_H

View File

@ -120,6 +120,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
{
m_glScope->newTrace(m_trace, m_sampleRate); // send a dummy trace
m_triggerState = Untriggered;
m_triggerIndex = 0;
}
if(m_triggerState == Delay)
{
@ -136,7 +137,14 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
m_triggerDelayCount--;
if (m_triggerDelayCount == 0)
{
m_triggerState = Triggered;
if (nextTrigger())
{
m_triggerState = Untriggered;
}
else
{
m_triggerState = Triggered;
}
}
}
}
@ -170,13 +178,20 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
}
else
{
m_triggerState = Triggered;
m_triggerPoint = begin;
// fill beginning of m_trace with delayed samples from the trace memory FIFO. Increment m_fill accordingly.
if (m_triggerPre) { // do this process only if there is a pre-trigger delay
std::copy(m_traceback.end() - m_triggerPre - 1, m_traceback.end() - 1, m_trace.begin());
m_fill = m_triggerPre; // Increment m_fill accordingly (from 0).
}
if (nextTrigger())
{
m_triggerState = Untriggered;
}
else
{
m_triggerState = Triggered;
m_triggerPoint = begin;
// fill beginning of m_trace with delayed samples from the trace memory FIFO. Increment m_fill accordingly.
if (m_triggerPre) { // do this process only if there is a pre-trigger delay
std::copy(m_traceback.end() - m_triggerPre - 1, m_traceback.end() - 1, m_trace.begin());
m_fill = m_triggerPre; // Increment m_fill accordingly (from 0).
}
}
}
break;
}
@ -220,6 +235,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
} else {
m_tracebackCount = 0;
m_triggerState = Untriggered;
m_triggerIndex = 0;
}
}
}
@ -339,5 +355,29 @@ void ScopeVis::setOneShot(bool oneShot)
if ((m_triggerState == WaitForReset) && !oneShot) {
m_tracebackCount = 0;
m_triggerState = Untriggered;
m_triggerIndex = 0;
}
}
bool ScopeVis::nextTrigger()
{
m_triggerIndex++;
m_prevTrigger = false;
m_triggerDelayCount = 0;
m_armed = false;
if (m_triggerIndex == m_nbTriggers)
{
m_triggerIndex = 0;
return false;
}
else if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun)
{
m_triggerIndex = 0;
return false;
}
else
{
return true;
}
}