1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

GLScope: implemented trigger counts

This commit is contained in:
f4exb 2015-11-05 00:07:51 +01:00
parent 1c7bab1762
commit 2917f015ea
4 changed files with 58 additions and 17 deletions

View File

@ -34,7 +34,8 @@ public:
bool triggerPositiveEdge,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
uint triggerDelay,
uint triggerCounts,
uint traceSize);
void setOneShot(bool oneShot);
@ -59,6 +60,7 @@ private:
Real getTriggerBothEdges() const { return m_triggerBothEdges; }
uint getTriggerPre() const { return m_triggerPre; }
uint getTriggerDelay() const { return m_triggerDelay; }
uint getTriggerCounts() const { return m_triggerCounts; }
uint getTraceSize() const { return m_traceSize; }
static MsgConfigureScopeVis* create(uint triggerIndex,
@ -67,7 +69,8 @@ private:
bool triggerPositiveEdge,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
uint triggerDelay,
uint triggerCounts,
uint traceSize)
{
return new MsgConfigureScopeVis(triggerIndex,
@ -77,6 +80,7 @@ private:
triggerBothEdges,
triggerPre,
triggerDelay,
triggerCounts,
traceSize);
}
@ -88,6 +92,7 @@ private:
bool m_triggerBothEdges;
uint m_triggerPre;
uint m_triggerDelay;
uint m_triggerCounts;
uint m_traceSize;
MsgConfigureScopeVis(uint triggerIndex,
@ -97,6 +102,7 @@ private:
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
uint triggerCounts,
uint traceSize) :
Message(),
m_triggerIndex(triggerIndex),
@ -106,6 +112,7 @@ private:
m_triggerBothEdges(triggerBothEdges),
m_triggerPre(triggerPre),
m_triggerDelay(triggerDelay),
m_triggerCounts(triggerCounts),
m_traceSize(traceSize)
{ }
};
@ -148,6 +155,8 @@ private:
bool m_armed;
uint m_triggerDelay[m_nbTriggers]; //!< Trigger delay in number of trace sizes
uint m_triggerDelayCount; //!< trace sizes delay counter
uint m_triggerCounts[m_nbTriggers]; //!< Number of trigger events before the actual trigger is kicked off
uint m_triggerCount;
int m_sampleRate;
SampleVector::const_iterator m_triggerPoint;
Real m_prevArg;

View File

@ -52,6 +52,7 @@ private:
qint32 m_amp2OffsetFine;
int m_displayGridIntensity;
int m_displayTraceIntensity;
quint32 m_triggerIndex;
qint32 m_triggerChannel;
qint32 m_triggerLevelCoarse; // percent of full range
qint32 m_triggerLevelFine; // percent of coarse
@ -59,6 +60,7 @@ private:
bool m_triggerBothEdges;
qint32 m_triggerPre;
qint32 m_triggerDelay;
qint32 m_triggerCounts;
qint32 m_traceLenMult;
static const qreal amps[11];
@ -94,6 +96,7 @@ private slots:
void on_trigPre_valueChanged(int value);
void on_trigDelay_valueChanged(int value);
void on_memHistory_valueChanged(int value);
void on_trigCount_valueChanged(int value);
void on_horizView_clicked();
void on_vertView_clicked();

View File

@ -21,6 +21,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
m_triggerDelayCount(0),
m_triggerOneShot(false),
m_armed(false),
m_triggerCount(0),
m_sampleRate(0),
m_prevArg(0.0),
m_firstArg(true)
@ -37,6 +38,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
m_triggerPositiveEdge[i] = true;
m_triggerBothEdges[i] = false;
m_triggerDelay[i] = 0;
m_triggerCounts[i] = 0;
}
}
@ -52,6 +54,7 @@ void ScopeVis::configure(MessageQueue* msgQueue,
bool triggerBothEdges,
uint triggerPre,
uint triggerDelay,
uint triggerCounts,
uint traceSize)
{
Message* cmd = MsgConfigureScopeVis::create(triggerIndex,
@ -61,6 +64,7 @@ void ScopeVis::configure(MessageQueue* msgQueue,
triggerBothEdges,
triggerPre,
triggerDelay,
triggerCounts,
traceSize);
msgQueue->push(cmd);
}
@ -289,6 +293,7 @@ bool ScopeVis::handleMessage(const Message& message)
}
m_triggerDelay[index] = conf.getTriggerDelay();
m_triggerCounts[index] = conf.getTriggerCounts();
uint newSize = conf.getTraceSize();
if (newSize != m_trace.size())
@ -309,6 +314,7 @@ bool ScopeVis::handleMessage(const Message& message)
<< " m_triggerBothEdges: " << (m_triggerBothEdges[index] ? "yes" : "no")
<< " m_preTrigger: " << m_triggerPre
<< " m_triggerDelay: " << m_triggerDelay[index]
<< " m_triggerCounts: " << m_triggerCounts[index]
<< " m_traceSize: " << m_trace.size();
return true;
@ -396,23 +402,32 @@ void ScopeVis::setOneShot(bool oneShot)
bool ScopeVis::nextTrigger()
{
m_triggerIndex++;
m_prevTrigger = false;
m_triggerDelayCount = 0;
m_armed = false;
if (m_triggerIndex == m_nbTriggers)
if (m_triggerCount < m_triggerCounts[m_triggerIndex])
{
m_triggerIndex = 0;
return false;
}
else if (m_triggerChannel[m_triggerIndex] == TriggerFreeRun)
{
m_triggerIndex = 0;
return false;
m_triggerCount++;
return true;
}
else
{
return true;
m_triggerIndex++;
m_prevTrigger = false;
m_triggerDelayCount = 0;
m_triggerCount = 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;
}
}
}

View File

@ -29,6 +29,7 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
m_amp2OffsetFine(0),
m_displayGridIntensity(1),
m_displayTraceIntensity(50),
m_triggerIndex(0),
m_triggerChannel(ScopeVis::TriggerFreeRun),
m_triggerLevelCoarse(0),
m_triggerLevelFine(0),
@ -36,6 +37,7 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
m_triggerBothEdges(false),
m_triggerPre(0),
m_triggerDelay(0),
m_triggerCounts(0),
m_traceLenMult(20)
{
ui->setupUi(this);
@ -246,13 +248,14 @@ void GLScopeGUI::applyTriggerSettings()
m_glScope->setTriggerPre(m_triggerPre/100.0); // [0.0, 1.0]
m_scopeVis->configure(m_messageQueue,
0, // FIXME
0, // FIXME: trigger index
(ScopeVis::TriggerChannel) m_triggerChannel,
triggerLevel,
m_triggerPositiveEdge,
m_triggerBothEdges,
preTriggerSamples,
m_triggerDelay,
m_triggerCounts,
m_traceLenMult * ScopeVis::m_traceChunkSize);
}
@ -748,6 +751,17 @@ void GLScopeGUI::on_memHistory_valueChanged(int value)
}
}
void GLScopeGUI::on_trigCount_valueChanged(int value)
{
m_triggerCounts = value;
QString text;
text.sprintf("%02d", value);
ui->trigCountText->setText(text);
applyTriggerSettings();
}
void GLScopeGUI::on_slopePos_clicked()
{
m_triggerPositiveEdge = true;