From 9161e867c996fe357efe90819a98be0badf74235 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 14 Jul 2015 02:18:55 +0200 Subject: [PATCH] Added one shot trigger option --- include-gpl/dsp/scopevis.h | 2 ++ include-gpl/gui/glscopegui.h | 1 + sdrbase/dsp/scopevis.cpp | 18 +++++++++++++++++- sdrbase/gui/glscopegui.cpp | 5 +++++ sdrbase/gui/glscopegui.ui | 28 +++++++++++++++++++++++++++- 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include-gpl/dsp/scopevis.h b/include-gpl/dsp/scopevis.h index ec59f0f27..4346d6295 100644 --- a/include-gpl/dsp/scopevis.h +++ b/include-gpl/dsp/scopevis.h @@ -22,6 +22,7 @@ public: ScopeVis(GLScope* glScope = NULL); void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge); + void setOneShot(bool oneShot); void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly); void start(); @@ -72,6 +73,7 @@ private: TriggerChannel m_triggerChannel; Real m_triggerLevel; bool m_triggerPositiveEdge; + bool m_triggerOneShot; bool m_armed; int m_sampleRate; diff --git a/include-gpl/gui/glscopegui.h b/include-gpl/gui/glscopegui.h index a41620759..499636b6e 100644 --- a/include-gpl/gui/glscopegui.h +++ b/include-gpl/gui/glscopegui.h @@ -79,6 +79,7 @@ private slots: void on_trigMode_currentIndexChanged(int index); void on_slopePos_clicked(); void on_slopeNeg_clicked(); + void on_oneShot_clicked(); void on_trigLevel_valueChanged(int value); }; diff --git a/sdrbase/dsp/scopevis.cpp b/sdrbase/dsp/scopevis.cpp index fe2eaccc6..34d5637cb 100644 --- a/sdrbase/dsp/scopevis.cpp +++ b/sdrbase/dsp/scopevis.cpp @@ -16,6 +16,7 @@ ScopeVis::ScopeVis(GLScope* glScope) : m_triggerChannel(TriggerFreeRun), m_triggerLevel(0.0), m_triggerPositiveEdge(true), + m_triggerOneShot(false), m_armed(false), m_sampleRate(0) { @@ -49,6 +50,12 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter } else { + if(m_triggerState == WaitForReset) + { + if (!m_triggerOneShot) { + m_triggerState = Untriggered; + } + } if(m_triggerState == Untriggered) { while(begin < end) @@ -80,7 +87,11 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter if(m_fill >= m_trace.size()) { m_glScope->newTrace(m_trace, m_sampleRate); m_fill = 0; - m_triggerState = Untriggered; + if (m_triggerOneShot) { + m_triggerState = WaitForReset; + } else { + m_triggerState = Untriggered; + } } } } @@ -168,3 +179,8 @@ bool ScopeVis::triggerCondition(SampleVector::const_iterator& it) return false; } } + +void ScopeVis::setOneShot(bool oneShot) +{ + m_triggerOneShot = oneShot; +} diff --git a/sdrbase/gui/glscopegui.cpp b/sdrbase/gui/glscopegui.cpp index 8c29eaa96..f10354e2d 100644 --- a/sdrbase/gui/glscopegui.cpp +++ b/sdrbase/gui/glscopegui.cpp @@ -426,6 +426,11 @@ void GLScopeGUI::on_slopeNeg_clicked() applyTriggerSettings(); } +void GLScopeGUI::on_oneShot_clicked() +{ + m_scopeVis->setOneShot(ui->oneShot->isChecked()); +} + bool GLScopeGUI::handleMessage(Message* cmd) { return false; diff --git a/sdrbase/gui/glscopegui.ui b/sdrbase/gui/glscopegui.ui index 73bd1735b..3b256d5db 100644 --- a/sdrbase/gui/glscopegui.ui +++ b/sdrbase/gui/glscopegui.ui @@ -7,7 +7,7 @@ 0 0 807 - 67 + 69 @@ -625,6 +625,32 @@ + + + + One shot + + + + + + + :/display1_w.png:/display1_w.png + + + + 16 + 16 + + + + true + + + true + + +