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_traceChunkSize;
|
||||||
|
static const uint m_nbTriggers = 10;
|
||||||
|
|
||||||
ScopeVis(GLScope* glScope = NULL);
|
ScopeVis(GLScope* glScope = NULL);
|
||||||
virtual ~ScopeVis();
|
virtual ~ScopeVis();
|
||||||
|
|
||||||
void configure(MessageQueue* msgQueue,
|
void configure(MessageQueue* msgQueue,
|
||||||
|
uint triggerIndex,
|
||||||
TriggerChannel triggerChannel,
|
TriggerChannel triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
@ -49,6 +51,7 @@ private:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
uint getTriggerIndex() const { return m_triggerIndex; }
|
||||||
int getTriggerChannel() const { return m_triggerChannel; }
|
int getTriggerChannel() const { return m_triggerChannel; }
|
||||||
Real getTriggerLevel() const { return m_triggerLevel; }
|
Real getTriggerLevel() const { return m_triggerLevel; }
|
||||||
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
|
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
|
||||||
@ -57,7 +60,8 @@ private:
|
|||||||
uint getTriggerDelay() const { return m_triggerDelay; }
|
uint getTriggerDelay() const { return m_triggerDelay; }
|
||||||
uint getTraceSize() const { return m_traceSize; }
|
uint getTraceSize() const { return m_traceSize; }
|
||||||
|
|
||||||
static MsgConfigureScopeVis* create(int triggerChannel,
|
static MsgConfigureScopeVis* create(uint triggerIndex,
|
||||||
|
int triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
bool triggerBothEdges,
|
bool triggerBothEdges,
|
||||||
@ -65,7 +69,8 @@ private:
|
|||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize)
|
uint traceSize)
|
||||||
{
|
{
|
||||||
return new MsgConfigureScopeVis(triggerChannel,
|
return new MsgConfigureScopeVis(triggerIndex,
|
||||||
|
triggerChannel,
|
||||||
triggerLevel,
|
triggerLevel,
|
||||||
triggerPositiveEdge,
|
triggerPositiveEdge,
|
||||||
triggerBothEdges,
|
triggerBothEdges,
|
||||||
@ -75,6 +80,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint m_triggerIndex;
|
||||||
int m_triggerChannel;
|
int m_triggerChannel;
|
||||||
Real m_triggerLevel;
|
Real m_triggerLevel;
|
||||||
bool m_triggerPositiveEdge;
|
bool m_triggerPositiveEdge;
|
||||||
@ -83,7 +89,8 @@ private:
|
|||||||
uint m_triggerDelay;
|
uint m_triggerDelay;
|
||||||
uint m_traceSize;
|
uint m_traceSize;
|
||||||
|
|
||||||
MsgConfigureScopeVis(int triggerChannel,
|
MsgConfigureScopeVis(uint triggerIndex,
|
||||||
|
int triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
bool triggerBothEdges,
|
bool triggerBothEdges,
|
||||||
@ -91,6 +98,7 @@ private:
|
|||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize) :
|
uint traceSize) :
|
||||||
Message(),
|
Message(),
|
||||||
|
m_triggerIndex(triggerIndex),
|
||||||
m_triggerChannel(triggerChannel),
|
m_triggerChannel(triggerChannel),
|
||||||
m_triggerLevel(triggerLevel),
|
m_triggerLevel(triggerLevel),
|
||||||
m_triggerPositiveEdge(triggerPositiveEdge),
|
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_tracebackCount; //!< Count of samples stored into trace memory since triggering is active up to trace memory size
|
||||||
uint m_fill;
|
uint m_fill;
|
||||||
TriggerState m_triggerState;
|
TriggerState m_triggerState;
|
||||||
TriggerChannel m_triggerChannel;
|
uint m_triggerIndex; //!< current active trigger index
|
||||||
Real m_triggerLevel;
|
TriggerChannel m_triggerChannel[m_nbTriggers];
|
||||||
bool m_triggerPositiveEdge;
|
Real m_triggerLevel[m_nbTriggers];
|
||||||
bool m_triggerBothEdges;
|
bool m_triggerPositiveEdge[m_nbTriggers];
|
||||||
|
bool m_triggerBothEdges[m_nbTriggers];
|
||||||
bool m_prevTrigger;
|
bool m_prevTrigger;
|
||||||
uint m_triggerPre; //!< Pre-trigger delay in number of samples
|
uint m_triggerPre; //!< Pre-trigger delay in number of samples
|
||||||
bool m_triggerOneShot;
|
bool m_triggerOneShot;
|
||||||
bool m_armed;
|
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
|
uint m_triggerDelayCount; //!< trace sizes delay counter
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
SampleVector::const_iterator m_triggerPoint;
|
SampleVector::const_iterator m_triggerPoint;
|
||||||
|
@ -15,12 +15,9 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
|||||||
m_tracebackCount(0),
|
m_tracebackCount(0),
|
||||||
m_fill(0),
|
m_fill(0),
|
||||||
m_triggerState(Untriggered),
|
m_triggerState(Untriggered),
|
||||||
m_triggerChannel(TriggerFreeRun),
|
m_triggerIndex(0),
|
||||||
m_triggerLevel(0.0),
|
m_prevTrigger(false),
|
||||||
m_triggerPositiveEdge(true),
|
|
||||||
m_triggerBothEdges(false),
|
|
||||||
m_triggerPre(0),
|
m_triggerPre(0),
|
||||||
m_triggerDelay(0),
|
|
||||||
m_triggerDelayCount(0),
|
m_triggerDelayCount(0),
|
||||||
m_triggerOneShot(false),
|
m_triggerOneShot(false),
|
||||||
m_armed(false),
|
m_armed(false),
|
||||||
@ -30,6 +27,15 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
|||||||
m_trace.reserve(100*m_traceChunkSize);
|
m_trace.reserve(100*m_traceChunkSize);
|
||||||
m_trace.resize(20*m_traceChunkSize);
|
m_trace.resize(20*m_traceChunkSize);
|
||||||
m_traceback.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()
|
ScopeVis::~ScopeVis()
|
||||||
@ -37,6 +43,7 @@ ScopeVis::~ScopeVis()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScopeVis::configure(MessageQueue* msgQueue,
|
void ScopeVis::configure(MessageQueue* msgQueue,
|
||||||
|
uint triggerIndex,
|
||||||
TriggerChannel triggerChannel,
|
TriggerChannel triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
@ -45,7 +52,8 @@ void ScopeVis::configure(MessageQueue* msgQueue,
|
|||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize)
|
uint traceSize)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureScopeVis::create(triggerChannel,
|
Message* cmd = MsgConfigureScopeVis::create(triggerIndex,
|
||||||
|
triggerChannel,
|
||||||
triggerLevel,
|
triggerLevel,
|
||||||
triggerPositiveEdge,
|
triggerPositiveEdge,
|
||||||
triggerBothEdges,
|
triggerBothEdges,
|
||||||
@ -59,7 +67,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
|||||||
{
|
{
|
||||||
SampleVector::const_iterator begin(cbegin);
|
SampleVector::const_iterator begin(cbegin);
|
||||||
|
|
||||||
if (m_triggerChannel == TriggerFreeRun) {
|
if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun) {
|
||||||
m_triggerPoint = begin;
|
m_triggerPoint = begin;
|
||||||
}
|
}
|
||||||
else if (m_triggerState == Triggered) {
|
else if (m_triggerState == Triggered) {
|
||||||
@ -77,7 +85,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
|||||||
|
|
||||||
while(begin < end)
|
while(begin < end)
|
||||||
{
|
{
|
||||||
if (m_triggerChannel == TriggerFreeRun)
|
if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun)
|
||||||
{
|
{
|
||||||
int count = end - begin;
|
int count = end - begin;
|
||||||
|
|
||||||
@ -143,10 +151,10 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
|||||||
{
|
{
|
||||||
bool trigger;
|
bool trigger;
|
||||||
|
|
||||||
if (m_triggerBothEdges) {
|
if (m_triggerBothEdges[m_triggerIndex]) {
|
||||||
trigger = m_prevTrigger ^ triggerCdt;
|
trigger = m_prevTrigger ^ triggerCdt;
|
||||||
} else {
|
} else {
|
||||||
trigger = triggerCdt ^ !m_triggerPositiveEdge;
|
trigger = triggerCdt ^ !m_triggerPositiveEdge[m_triggerIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trigger)
|
if (trigger)
|
||||||
@ -154,9 +162,9 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
|||||||
if (m_armed)
|
if (m_armed)
|
||||||
{
|
{
|
||||||
m_armed = false;
|
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_fill = 0;
|
||||||
m_triggerState = Delay;
|
m_triggerState = Delay;
|
||||||
}
|
}
|
||||||
@ -245,10 +253,11 @@ bool ScopeVis::handleMessage(const Message& message)
|
|||||||
|
|
||||||
m_tracebackCount = 0;
|
m_tracebackCount = 0;
|
||||||
m_triggerState = Config;
|
m_triggerState = Config;
|
||||||
m_triggerChannel = (TriggerChannel) conf.getTriggerChannel();
|
uint index = conf.getTriggerIndex();
|
||||||
m_triggerLevel = conf.getTriggerLevel();
|
m_triggerChannel[index] = (TriggerChannel) conf.getTriggerChannel();
|
||||||
m_triggerPositiveEdge = conf.getTriggerPositiveEdge();
|
m_triggerLevel[index] = conf.getTriggerLevel();
|
||||||
m_triggerBothEdges = conf.getTriggerBothEdges();
|
m_triggerPositiveEdge[index] = conf.getTriggerPositiveEdge();
|
||||||
|
m_triggerBothEdges[index] = conf.getTriggerBothEdges();
|
||||||
m_triggerPre = conf.getTriggerPre();
|
m_triggerPre = conf.getTriggerPre();
|
||||||
|
|
||||||
if (m_triggerPre >= m_traceback.size())
|
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_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();
|
uint newSize = conf.getTraceSize();
|
||||||
|
|
||||||
if (newSize != m_trace.size())
|
if (newSize != m_trace.size())
|
||||||
@ -270,12 +279,13 @@ bool ScopeVis::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << " - MsgConfigureScopeVis:"
|
qDebug() << " - MsgConfigureScopeVis:"
|
||||||
<< " m_triggerChannel: " << m_triggerChannel
|
<< " triggerIndex: " << index
|
||||||
<< " m_triggerLevel: " << m_triggerLevel
|
<< " m_triggerChannel: " << m_triggerChannel[index]
|
||||||
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
|
<< " m_triggerLevel: " << m_triggerLevel[index]
|
||||||
<< " m_triggerBothEdges: " << (m_triggerBothEdges ? "yes" : "no")
|
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge[index] ? "edge+" : "edge-")
|
||||||
|
<< " m_triggerBothEdges: " << (m_triggerBothEdges[index] ? "yes" : "no")
|
||||||
<< " m_preTrigger: " << m_triggerPre
|
<< " m_preTrigger: " << m_triggerPre
|
||||||
<< " m_triggerDelay: " << m_triggerDelay
|
<< " m_triggerDelay: " << m_triggerDelay[index]
|
||||||
<< " m_traceSize: " << m_trace.size();
|
<< " m_traceSize: " << m_trace.size();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -300,22 +310,22 @@ bool ScopeVis::triggerCondition(SampleVector::const_iterator& it)
|
|||||||
m_tracebackCount++;
|
m_tracebackCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_triggerChannel == TriggerChannelI) {
|
if (m_triggerChannel[m_triggerIndex] == TriggerChannelI) {
|
||||||
return c.real() > m_triggerLevel;
|
return c.real() > m_triggerLevel[m_triggerIndex];
|
||||||
}
|
}
|
||||||
else if (m_triggerChannel == TriggerChannelQ) {
|
else if (m_triggerChannel[m_triggerIndex] == TriggerChannelQ) {
|
||||||
return c.imag() > m_triggerLevel;
|
return c.imag() > m_triggerLevel[m_triggerIndex];
|
||||||
}
|
}
|
||||||
else if (m_triggerChannel == TriggerMagLin) {
|
else if (m_triggerChannel[m_triggerIndex] == TriggerMagLin) {
|
||||||
return abs(c) > m_triggerLevel;
|
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 mult = (10.0f / log2f(10.0f));
|
||||||
Real v = c.real() * c.real() + c.imag() * c.imag();
|
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) {
|
else if (m_triggerChannel[m_triggerIndex] == TriggerPhase) {
|
||||||
return arg(c) / M_PI > m_triggerLevel;
|
return arg(c) / M_PI > m_triggerLevel[m_triggerIndex];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -246,6 +246,7 @@ void GLScopeGUI::applyTriggerSettings()
|
|||||||
m_glScope->setTriggerPre(m_triggerPre/100.0); // [0.0, 1.0]
|
m_glScope->setTriggerPre(m_triggerPre/100.0); // [0.0, 1.0]
|
||||||
|
|
||||||
m_scopeVis->configure(m_messageQueue,
|
m_scopeVis->configure(m_messageQueue,
|
||||||
|
0, // FIXME
|
||||||
(ScopeVis::TriggerChannel) m_triggerChannel,
|
(ScopeVis::TriggerChannel) m_triggerChannel,
|
||||||
triggerLevel,
|
triggerLevel,
|
||||||
m_triggerPositiveEdge,
|
m_triggerPositiveEdge,
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>616</width>
|
<width>583</width>
|
||||||
<height>112</height>
|
<height>111</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -400,32 +400,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -437,6 +411,15 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="row3Layout">
|
<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>
|
<item>
|
||||||
<widget class="QLabel" name="memText">
|
<widget class="QLabel" name="memText">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -719,6 +702,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user