diff --git a/include/dsp/scopevis.h b/include/dsp/scopevis.h
index ee82da430..ab0d4c229 100644
--- a/include/dsp/scopevis.h
+++ b/include/dsp/scopevis.h
@@ -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;
diff --git a/sdrbase/dsp/scopevis.cpp b/sdrbase/dsp/scopevis.cpp
index 0fd24bad6..4000c4a3c 100644
--- a/sdrbase/dsp/scopevis.cpp
+++ b/sdrbase/dsp/scopevis.cpp
@@ -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;
diff --git a/sdrbase/gui/glscopegui.cpp b/sdrbase/gui/glscopegui.cpp
index 415e74d5d..a8bc2cc35 100644
--- a/sdrbase/gui/glscopegui.cpp
+++ b/sdrbase/gui/glscopegui.cpp
@@ -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,
diff --git a/sdrbase/gui/glscopegui.ui b/sdrbase/gui/glscopegui.ui
index ae22f1c43..1e550dd05 100644
--- a/sdrbase/gui/glscopegui.ui
+++ b/sdrbase/gui/glscopegui.ui
@@ -6,8 +6,8 @@
0
0
- 616
- 112
+ 583
+ 111
@@ -400,32 +400,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- -
-
-
-
- 24
- 24
-
-
-
- Grid intensity
-
-
- 100
-
-
- 1
-
-
-
-
@@ -437,6 +411,15 @@
-
+
+ 3
+
+
+ 2
+
+
+ 2
+
-
@@ -719,6 +702,25 @@
+ -
+
+
+
+ 24
+ 24
+
+
+
+ Grid intensity
+
+
+ 100
+
+
+ 1
+
+
+
-