mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 13:21:50 -05:00
GLScope: chained multiple triggers: interim state #1: implemented array of triggers
This commit is contained in:
parent
704bb40a0b
commit
ff719059f0
@ -21,11 +21,13 @@ public:
|
||||
};
|
||||
|
||||
static const uint m_traceChunkSize;
|
||||
static const uint m_nbTriggers = 10;
|
||||
|
||||
ScopeVis(GLScope* glScope = NULL);
|
||||
virtual ~ScopeVis();
|
||||
|
||||
void configure(MessageQueue* msgQueue,
|
||||
void configure(MessageQueue* msgQueue,
|
||||
uint triggerIndex,
|
||||
TriggerChannel triggerChannel,
|
||||
Real triggerLevel,
|
||||
bool triggerPositiveEdge,
|
||||
@ -49,6 +51,7 @@ private:
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
uint getTriggerIndex() const { return m_triggerIndex; }
|
||||
int getTriggerChannel() const { return m_triggerChannel; }
|
||||
Real getTriggerLevel() const { return m_triggerLevel; }
|
||||
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
|
||||
@ -57,7 +60,8 @@ private:
|
||||
uint getTriggerDelay() const { return m_triggerDelay; }
|
||||
uint getTraceSize() const { return m_traceSize; }
|
||||
|
||||
static MsgConfigureScopeVis* create(int triggerChannel,
|
||||
static MsgConfigureScopeVis* create(uint triggerIndex,
|
||||
int triggerChannel,
|
||||
Real triggerLevel,
|
||||
bool triggerPositiveEdge,
|
||||
bool triggerBothEdges,
|
||||
@ -65,7 +69,8 @@ private:
|
||||
uint triggerDelay,
|
||||
uint traceSize)
|
||||
{
|
||||
return new MsgConfigureScopeVis(triggerChannel,
|
||||
return new MsgConfigureScopeVis(triggerIndex,
|
||||
triggerChannel,
|
||||
triggerLevel,
|
||||
triggerPositiveEdge,
|
||||
triggerBothEdges,
|
||||
@ -75,6 +80,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
uint m_triggerIndex;
|
||||
int m_triggerChannel;
|
||||
Real m_triggerLevel;
|
||||
bool m_triggerPositiveEdge;
|
||||
@ -83,7 +89,8 @@ private:
|
||||
uint m_triggerDelay;
|
||||
uint m_traceSize;
|
||||
|
||||
MsgConfigureScopeVis(int triggerChannel,
|
||||
MsgConfigureScopeVis(uint triggerIndex,
|
||||
int triggerChannel,
|
||||
Real triggerLevel,
|
||||
bool triggerPositiveEdge,
|
||||
bool triggerBothEdges,
|
||||
@ -91,6 +98,7 @@ private:
|
||||
uint triggerDelay,
|
||||
uint traceSize) :
|
||||
Message(),
|
||||
m_triggerIndex(triggerIndex),
|
||||
m_triggerChannel(triggerChannel),
|
||||
m_triggerLevel(triggerLevel),
|
||||
m_triggerPositiveEdge(triggerPositiveEdge),
|
||||
@ -128,15 +136,16 @@ private:
|
||||
uint m_tracebackCount; //!< Count of samples stored into trace memory since triggering is active up to trace memory size
|
||||
uint m_fill;
|
||||
TriggerState m_triggerState;
|
||||
TriggerChannel m_triggerChannel;
|
||||
Real m_triggerLevel;
|
||||
bool m_triggerPositiveEdge;
|
||||
bool m_triggerBothEdges;
|
||||
uint m_triggerIndex; //!< current active trigger index
|
||||
TriggerChannel m_triggerChannel[m_nbTriggers];
|
||||
Real m_triggerLevel[m_nbTriggers];
|
||||
bool m_triggerPositiveEdge[m_nbTriggers];
|
||||
bool m_triggerBothEdges[m_nbTriggers];
|
||||
bool m_prevTrigger;
|
||||
uint m_triggerPre; //!< Pre-trigger delay in number of samples
|
||||
bool m_triggerOneShot;
|
||||
bool m_armed;
|
||||
uint m_triggerDelay; //!< Trigger delay in number of trace sizes
|
||||
uint m_triggerDelay[m_nbTriggers]; //!< Trigger delay in number of trace sizes
|
||||
uint m_triggerDelayCount; //!< trace sizes delay counter
|
||||
int m_sampleRate;
|
||||
SampleVector::const_iterator m_triggerPoint;
|
||||
|
@ -15,12 +15,9 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
m_tracebackCount(0),
|
||||
m_fill(0),
|
||||
m_triggerState(Untriggered),
|
||||
m_triggerChannel(TriggerFreeRun),
|
||||
m_triggerLevel(0.0),
|
||||
m_triggerPositiveEdge(true),
|
||||
m_triggerBothEdges(false),
|
||||
m_triggerIndex(0),
|
||||
m_prevTrigger(false),
|
||||
m_triggerPre(0),
|
||||
m_triggerDelay(0),
|
||||
m_triggerDelayCount(0),
|
||||
m_triggerOneShot(false),
|
||||
m_armed(false),
|
||||
@ -30,13 +27,23 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
m_trace.reserve(100*m_traceChunkSize);
|
||||
m_trace.resize(20*m_traceChunkSize);
|
||||
m_traceback.resize(20*m_traceChunkSize);
|
||||
|
||||
for (int i = 0; i < m_nbTriggers; i++)
|
||||
{
|
||||
m_triggerChannel[i] = TriggerFreeRun;
|
||||
m_triggerLevel[i] = 0.0;
|
||||
m_triggerPositiveEdge[i] = true;
|
||||
m_triggerBothEdges[i] = false;
|
||||
m_triggerDelay[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ScopeVis::~ScopeVis()
|
||||
{
|
||||
}
|
||||
|
||||
void ScopeVis::configure(MessageQueue* msgQueue,
|
||||
void ScopeVis::configure(MessageQueue* msgQueue,
|
||||
uint triggerIndex,
|
||||
TriggerChannel triggerChannel,
|
||||
Real triggerLevel,
|
||||
bool triggerPositiveEdge,
|
||||
@ -45,7 +52,8 @@ void ScopeVis::configure(MessageQueue* msgQueue,
|
||||
uint triggerDelay,
|
||||
uint traceSize)
|
||||
{
|
||||
Message* cmd = MsgConfigureScopeVis::create(triggerChannel,
|
||||
Message* cmd = MsgConfigureScopeVis::create(triggerIndex,
|
||||
triggerChannel,
|
||||
triggerLevel,
|
||||
triggerPositiveEdge,
|
||||
triggerBothEdges,
|
||||
@ -59,7 +67,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||
{
|
||||
SampleVector::const_iterator begin(cbegin);
|
||||
|
||||
if (m_triggerChannel == TriggerFreeRun) {
|
||||
if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun) {
|
||||
m_triggerPoint = begin;
|
||||
}
|
||||
else if (m_triggerState == Triggered) {
|
||||
@ -77,7 +85,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||
|
||||
while(begin < end)
|
||||
{
|
||||
if (m_triggerChannel == TriggerFreeRun)
|
||||
if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun)
|
||||
{
|
||||
int count = end - begin;
|
||||
|
||||
@ -143,10 +151,10 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||
{
|
||||
bool trigger;
|
||||
|
||||
if (m_triggerBothEdges) {
|
||||
if (m_triggerBothEdges[m_triggerIndex]) {
|
||||
trigger = m_prevTrigger ^ triggerCdt;
|
||||
} else {
|
||||
trigger = triggerCdt ^ !m_triggerPositiveEdge;
|
||||
trigger = triggerCdt ^ !m_triggerPositiveEdge[m_triggerIndex];
|
||||
}
|
||||
|
||||
if (trigger)
|
||||
@ -154,9 +162,9 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||
if (m_armed)
|
||||
{
|
||||
m_armed = false;
|
||||
if (m_triggerDelay > 0)
|
||||
if (m_triggerDelay[m_triggerIndex] > 0)
|
||||
{
|
||||
m_triggerDelayCount = m_triggerDelay;
|
||||
m_triggerDelayCount = m_triggerDelay[m_triggerIndex];
|
||||
m_fill = 0;
|
||||
m_triggerState = Delay;
|
||||
}
|
||||
@ -245,10 +253,11 @@ bool ScopeVis::handleMessage(const Message& message)
|
||||
|
||||
m_tracebackCount = 0;
|
||||
m_triggerState = Config;
|
||||
m_triggerChannel = (TriggerChannel) conf.getTriggerChannel();
|
||||
m_triggerLevel = conf.getTriggerLevel();
|
||||
m_triggerPositiveEdge = conf.getTriggerPositiveEdge();
|
||||
m_triggerBothEdges = conf.getTriggerBothEdges();
|
||||
uint index = conf.getTriggerIndex();
|
||||
m_triggerChannel[index] = (TriggerChannel) conf.getTriggerChannel();
|
||||
m_triggerLevel[index] = conf.getTriggerLevel();
|
||||
m_triggerPositiveEdge[index] = conf.getTriggerPositiveEdge();
|
||||
m_triggerBothEdges[index] = conf.getTriggerBothEdges();
|
||||
m_triggerPre = conf.getTriggerPre();
|
||||
|
||||
if (m_triggerPre >= m_traceback.size())
|
||||
@ -256,7 +265,7 @@ bool ScopeVis::handleMessage(const Message& message)
|
||||
m_triggerPre = m_traceback.size() - 1; // top sample in FIFO is always the triggering one (pre-trigger delay = 0)
|
||||
}
|
||||
|
||||
m_triggerDelay = conf.getTriggerDelay();
|
||||
m_triggerDelay[index] = conf.getTriggerDelay();
|
||||
uint newSize = conf.getTraceSize();
|
||||
|
||||
if (newSize != m_trace.size())
|
||||
@ -270,12 +279,13 @@ bool ScopeVis::handleMessage(const Message& message)
|
||||
}
|
||||
|
||||
qDebug() << " - MsgConfigureScopeVis:"
|
||||
<< " m_triggerChannel: " << m_triggerChannel
|
||||
<< " m_triggerLevel: " << m_triggerLevel
|
||||
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
|
||||
<< " m_triggerBothEdges: " << (m_triggerBothEdges ? "yes" : "no")
|
||||
<< " triggerIndex: " << index
|
||||
<< " m_triggerChannel: " << m_triggerChannel[index]
|
||||
<< " m_triggerLevel: " << m_triggerLevel[index]
|
||||
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge[index] ? "edge+" : "edge-")
|
||||
<< " m_triggerBothEdges: " << (m_triggerBothEdges[index] ? "yes" : "no")
|
||||
<< " m_preTrigger: " << m_triggerPre
|
||||
<< " m_triggerDelay: " << m_triggerDelay
|
||||
<< " m_triggerDelay: " << m_triggerDelay[index]
|
||||
<< " m_traceSize: " << m_trace.size();
|
||||
|
||||
return true;
|
||||
@ -300,22 +310,22 @@ bool ScopeVis::triggerCondition(SampleVector::const_iterator& it)
|
||||
m_tracebackCount++;
|
||||
}
|
||||
|
||||
if (m_triggerChannel == TriggerChannelI) {
|
||||
return c.real() > m_triggerLevel;
|
||||
if (m_triggerChannel[m_triggerIndex] == TriggerChannelI) {
|
||||
return c.real() > m_triggerLevel[m_triggerIndex];
|
||||
}
|
||||
else if (m_triggerChannel == TriggerChannelQ) {
|
||||
return c.imag() > m_triggerLevel;
|
||||
else if (m_triggerChannel[m_triggerIndex] == TriggerChannelQ) {
|
||||
return c.imag() > m_triggerLevel[m_triggerIndex];
|
||||
}
|
||||
else if (m_triggerChannel == TriggerMagLin) {
|
||||
return abs(c) > m_triggerLevel;
|
||||
else if (m_triggerChannel[m_triggerIndex] == TriggerMagLin) {
|
||||
return abs(c) > m_triggerLevel[m_triggerIndex];
|
||||
}
|
||||
else if (m_triggerChannel == TriggerMagDb) {
|
||||
else if (m_triggerChannel[m_triggerIndex] == TriggerMagDb) {
|
||||
Real mult = (10.0f / log2f(10.0f));
|
||||
Real v = c.real() * c.real() + c.imag() * c.imag();
|
||||
return mult * log2f(v) > m_triggerLevel;
|
||||
return mult * log2f(v) > m_triggerLevel[m_triggerIndex];
|
||||
}
|
||||
else if (m_triggerChannel == TriggerPhase) {
|
||||
return arg(c) / M_PI > m_triggerLevel;
|
||||
else if (m_triggerChannel[m_triggerIndex] == TriggerPhase) {
|
||||
return arg(c) / M_PI > m_triggerLevel[m_triggerIndex];
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
@ -246,6 +246,7 @@ void GLScopeGUI::applyTriggerSettings()
|
||||
m_glScope->setTriggerPre(m_triggerPre/100.0); // [0.0, 1.0]
|
||||
|
||||
m_scopeVis->configure(m_messageQueue,
|
||||
0, // FIXME
|
||||
(ScopeVis::TriggerChannel) m_triggerChannel,
|
||||
triggerLevel,
|
||||
m_triggerPositiveEdge,
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>616</width>
|
||||
<height>112</height>
|
||||
<width>583</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -400,32 +400,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="ampLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="gridIntensity">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Grid intensity</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -437,6 +411,15 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="row3Layout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="memText">
|
||||
<property name="text">
|
||||
@ -719,6 +702,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="gridIntensity">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Grid intensity</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user