mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-02 13:17:48 -04:00
Scope trigger on both edges
This commit is contained in:
parent
837ef9f0db
commit
bec9d90bd3
@ -118,6 +118,7 @@ Done since the fork
|
|||||||
- Implemented scope pre-trigger delay
|
- Implemented scope pre-trigger delay
|
||||||
- Implemented variable scope memory depth
|
- Implemented variable scope memory depth
|
||||||
- Implemented trigger delay
|
- Implemented trigger delay
|
||||||
|
- Trigger on both edges
|
||||||
|
|
||||||
=====
|
=====
|
||||||
To Do
|
To Do
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
TriggerChannel triggerChannel,
|
TriggerChannel triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
|
bool triggerBothEdges,
|
||||||
uint triggerPre,
|
uint triggerPre,
|
||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize);
|
uint traceSize);
|
||||||
@ -51,6 +52,7 @@ private:
|
|||||||
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; }
|
||||||
|
Real getTriggerBothEdges() const { return m_triggerBothEdges; }
|
||||||
uint getTriggerPre() const { return m_triggerPre; }
|
uint getTriggerPre() const { return m_triggerPre; }
|
||||||
uint getTriggerDelay() const { return m_triggerDelay; }
|
uint getTriggerDelay() const { return m_triggerDelay; }
|
||||||
uint getTraceSize() const { return m_traceSize; }
|
uint getTraceSize() const { return m_traceSize; }
|
||||||
@ -58,17 +60,25 @@ private:
|
|||||||
static MsgConfigureScopeVis* create(int triggerChannel,
|
static MsgConfigureScopeVis* create(int triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
|
bool triggerBothEdges,
|
||||||
uint triggerPre,
|
uint triggerPre,
|
||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize)
|
uint traceSize)
|
||||||
{
|
{
|
||||||
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge, triggerPre, triggerDelay, traceSize);
|
return new MsgConfigureScopeVis(triggerChannel,
|
||||||
|
triggerLevel,
|
||||||
|
triggerPositiveEdge,
|
||||||
|
triggerBothEdges,
|
||||||
|
triggerPre,
|
||||||
|
triggerDelay,
|
||||||
|
traceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_triggerChannel;
|
int m_triggerChannel;
|
||||||
Real m_triggerLevel;
|
Real m_triggerLevel;
|
||||||
bool m_triggerPositiveEdge;
|
bool m_triggerPositiveEdge;
|
||||||
|
bool m_triggerBothEdges;
|
||||||
uint m_triggerPre;
|
uint m_triggerPre;
|
||||||
uint m_triggerDelay;
|
uint m_triggerDelay;
|
||||||
uint m_traceSize;
|
uint m_traceSize;
|
||||||
@ -76,6 +86,7 @@ private:
|
|||||||
MsgConfigureScopeVis(int triggerChannel,
|
MsgConfigureScopeVis(int triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
|
bool triggerBothEdges,
|
||||||
uint triggerPre,
|
uint triggerPre,
|
||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize) :
|
uint traceSize) :
|
||||||
@ -83,6 +94,7 @@ private:
|
|||||||
m_triggerChannel(triggerChannel),
|
m_triggerChannel(triggerChannel),
|
||||||
m_triggerLevel(triggerLevel),
|
m_triggerLevel(triggerLevel),
|
||||||
m_triggerPositiveEdge(triggerPositiveEdge),
|
m_triggerPositiveEdge(triggerPositiveEdge),
|
||||||
|
m_triggerBothEdges(triggerBothEdges),
|
||||||
m_triggerPre(triggerPre),
|
m_triggerPre(triggerPre),
|
||||||
m_triggerDelay(triggerDelay),
|
m_triggerDelay(triggerDelay),
|
||||||
m_traceSize(traceSize)
|
m_traceSize(traceSize)
|
||||||
@ -119,6 +131,8 @@ private:
|
|||||||
TriggerChannel m_triggerChannel;
|
TriggerChannel m_triggerChannel;
|
||||||
Real m_triggerLevel;
|
Real m_triggerLevel;
|
||||||
bool m_triggerPositiveEdge;
|
bool m_triggerPositiveEdge;
|
||||||
|
bool m_triggerBothEdges;
|
||||||
|
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;
|
||||||
|
@ -51,6 +51,7 @@ private:
|
|||||||
qint32 m_triggerChannel;
|
qint32 m_triggerChannel;
|
||||||
qint32 m_triggerLevel; // percent
|
qint32 m_triggerLevel; // percent
|
||||||
bool m_triggerPositiveEdge;
|
bool m_triggerPositiveEdge;
|
||||||
|
bool m_triggerBothEdges;
|
||||||
qint32 m_triggerPre;
|
qint32 m_triggerPre;
|
||||||
qint32 m_triggerDelay;
|
qint32 m_triggerDelay;
|
||||||
qint32 m_traceLenMult;
|
qint32 m_traceLenMult;
|
||||||
@ -90,6 +91,7 @@ private slots:
|
|||||||
void on_trigMode_currentIndexChanged(int index);
|
void on_trigMode_currentIndexChanged(int index);
|
||||||
void on_slopePos_clicked();
|
void on_slopePos_clicked();
|
||||||
void on_slopeNeg_clicked();
|
void on_slopeNeg_clicked();
|
||||||
|
void on_slopeBoth_clicked();
|
||||||
void on_oneShot_clicked();
|
void on_oneShot_clicked();
|
||||||
void on_trigLevel_valueChanged(int value);
|
void on_trigLevel_valueChanged(int value);
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
|
|||||||
m_triggerChannel(TriggerFreeRun),
|
m_triggerChannel(TriggerFreeRun),
|
||||||
m_triggerLevel(0.0),
|
m_triggerLevel(0.0),
|
||||||
m_triggerPositiveEdge(true),
|
m_triggerPositiveEdge(true),
|
||||||
|
m_triggerBothEdges(false),
|
||||||
m_triggerPre(0),
|
m_triggerPre(0),
|
||||||
m_triggerDelay(0),
|
m_triggerDelay(0),
|
||||||
m_triggerDelayCount(0),
|
m_triggerDelayCount(0),
|
||||||
@ -35,11 +36,18 @@ void ScopeVis::configure(MessageQueue* msgQueue,
|
|||||||
TriggerChannel triggerChannel,
|
TriggerChannel triggerChannel,
|
||||||
Real triggerLevel,
|
Real triggerLevel,
|
||||||
bool triggerPositiveEdge,
|
bool triggerPositiveEdge,
|
||||||
|
bool triggerBothEdges,
|
||||||
uint triggerPre,
|
uint triggerPre,
|
||||||
uint triggerDelay,
|
uint triggerDelay,
|
||||||
uint traceSize)
|
uint traceSize)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureScopeVis::create(triggerChannel, triggerLevel, triggerPositiveEdge, triggerPre, triggerDelay, traceSize);
|
Message* cmd = MsgConfigureScopeVis::create(triggerChannel,
|
||||||
|
triggerLevel,
|
||||||
|
triggerPositiveEdge,
|
||||||
|
triggerBothEdges,
|
||||||
|
triggerPre,
|
||||||
|
triggerDelay,
|
||||||
|
traceSize);
|
||||||
cmd->submit(msgQueue, this);
|
cmd->submit(msgQueue, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,10 +121,19 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
|||||||
{
|
{
|
||||||
while(begin < end)
|
while(begin < end)
|
||||||
{
|
{
|
||||||
bool trigger = triggerCondition(begin);
|
bool triggerCdt = triggerCondition(begin);
|
||||||
|
|
||||||
if (m_tracebackCount > m_triggerPre)
|
if (m_tracebackCount > m_triggerPre)
|
||||||
{
|
{
|
||||||
if (trigger ^ !m_triggerPositiveEdge)
|
bool trigger;
|
||||||
|
|
||||||
|
if (m_triggerBothEdges) {
|
||||||
|
trigger = m_prevTrigger ^ triggerCdt;
|
||||||
|
} else {
|
||||||
|
trigger = triggerCdt ^ !m_triggerPositiveEdge;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trigger)
|
||||||
{
|
{
|
||||||
if (m_armed)
|
if (m_armed)
|
||||||
{
|
{
|
||||||
@ -145,6 +162,7 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
|||||||
m_armed = true;
|
m_armed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_prevTrigger = triggerCdt;
|
||||||
++begin;
|
++begin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,6 +217,7 @@ bool ScopeVis::handleMessageKeep(Message* message)
|
|||||||
m_triggerChannel = (TriggerChannel) conf->getTriggerChannel();
|
m_triggerChannel = (TriggerChannel) conf->getTriggerChannel();
|
||||||
m_triggerLevel = conf->getTriggerLevel();
|
m_triggerLevel = conf->getTriggerLevel();
|
||||||
m_triggerPositiveEdge = conf->getTriggerPositiveEdge();
|
m_triggerPositiveEdge = conf->getTriggerPositiveEdge();
|
||||||
|
m_triggerBothEdges = conf->getTriggerBothEdges();
|
||||||
m_triggerPre = conf->getTriggerPre();
|
m_triggerPre = conf->getTriggerPre();
|
||||||
if (m_triggerPre >= m_traceback.size()) {
|
if (m_triggerPre >= m_traceback.size()) {
|
||||||
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)
|
||||||
@ -215,6 +234,7 @@ bool ScopeVis::handleMessageKeep(Message* message)
|
|||||||
<< " m_triggerChannel: " << m_triggerChannel
|
<< " m_triggerChannel: " << m_triggerChannel
|
||||||
<< " m_triggerLevel: " << m_triggerLevel
|
<< " m_triggerLevel: " << m_triggerLevel
|
||||||
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
|
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
|
||||||
|
<< " m_triggerBothEdges: " << (m_triggerBothEdges ? "yes" : "no")
|
||||||
<< " m_preTrigger: " << m_triggerPre
|
<< " m_preTrigger: " << m_triggerPre
|
||||||
<< " m_triggerDelay: " << m_triggerDelay
|
<< " m_triggerDelay: " << m_triggerDelay
|
||||||
<< " m_traceSize: " << m_trace.size() << std::endl;
|
<< " m_traceSize: " << m_trace.size() << std::endl;
|
||||||
|
@ -28,6 +28,7 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
|
|||||||
m_triggerChannel(ScopeVis::TriggerFreeRun),
|
m_triggerChannel(ScopeVis::TriggerFreeRun),
|
||||||
m_triggerLevel(0.0),
|
m_triggerLevel(0.0),
|
||||||
m_triggerPositiveEdge(true),
|
m_triggerPositiveEdge(true),
|
||||||
|
m_triggerBothEdges(false),
|
||||||
m_triggerPre(0),
|
m_triggerPre(0),
|
||||||
m_triggerDelay(0),
|
m_triggerDelay(0),
|
||||||
m_traceLenMult(20)
|
m_traceLenMult(20)
|
||||||
@ -91,6 +92,7 @@ QByteArray GLScopeGUI::serialize() const
|
|||||||
s.writeS32(13, m_triggerPre);
|
s.writeS32(13, m_triggerPre);
|
||||||
s.writeS32(14, m_traceLenMult);
|
s.writeS32(14, m_traceLenMult);
|
||||||
s.writeS32(15, m_triggerDelay);
|
s.writeS32(15, m_triggerDelay);
|
||||||
|
s.writeBool(16, m_triggerBothEdges);
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
@ -121,8 +123,6 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
|
|||||||
ui->trigLevel->setValue(m_triggerLevel);
|
ui->trigLevel->setValue(m_triggerLevel);
|
||||||
setTrigLevelDisplay();
|
setTrigLevelDisplay();
|
||||||
d.readBool(11, &m_triggerPositiveEdge, true);
|
d.readBool(11, &m_triggerPositiveEdge, true);
|
||||||
ui->slopePos->setChecked(m_triggerPositiveEdge);
|
|
||||||
ui->slopeNeg->setChecked(!m_triggerPositiveEdge);
|
|
||||||
d.readS32(12, &m_displayTraceIntensity, 50);
|
d.readS32(12, &m_displayTraceIntensity, 50);
|
||||||
d.readS32(13, &m_triggerPre, 0);
|
d.readS32(13, &m_triggerPre, 0);
|
||||||
ui->trigPre->setValue(m_triggerPre);
|
ui->trigPre->setValue(m_triggerPre);
|
||||||
@ -133,6 +133,16 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
|
|||||||
d.readS32(15, &m_triggerDelay, 0);
|
d.readS32(15, &m_triggerDelay, 0);
|
||||||
ui->trigDelay->setValue(m_triggerDelay);
|
ui->trigDelay->setValue(m_triggerDelay);
|
||||||
setTrigDelayDisplay();
|
setTrigDelayDisplay();
|
||||||
|
d.readBool(16, &m_triggerBothEdges, false);
|
||||||
|
if (m_triggerBothEdges) {
|
||||||
|
ui->slopePos->setChecked(false);
|
||||||
|
ui->slopeNeg->setChecked(false);
|
||||||
|
ui->slopeBoth->setChecked(true);
|
||||||
|
} else {
|
||||||
|
ui->slopeBoth->setChecked(false);
|
||||||
|
ui->slopePos->setChecked(m_triggerPositiveEdge);
|
||||||
|
ui->slopeNeg->setChecked(!m_triggerPositiveEdge);
|
||||||
|
}
|
||||||
applySettings();
|
applySettings();
|
||||||
applyTriggerSettings();
|
applyTriggerSettings();
|
||||||
return true;
|
return true;
|
||||||
@ -204,6 +214,7 @@ void GLScopeGUI::applyTriggerSettings()
|
|||||||
(ScopeVis::TriggerChannel) m_triggerChannel,
|
(ScopeVis::TriggerChannel) m_triggerChannel,
|
||||||
triggerLevel,
|
triggerLevel,
|
||||||
m_triggerPositiveEdge,
|
m_triggerPositiveEdge,
|
||||||
|
m_triggerBothEdges,
|
||||||
preTriggerSamples,
|
preTriggerSamples,
|
||||||
m_triggerDelay,
|
m_triggerDelay,
|
||||||
m_traceLenMult * ScopeVis::m_traceChunkSize);
|
m_traceLenMult * ScopeVis::m_traceChunkSize);
|
||||||
@ -546,6 +557,9 @@ void GLScopeGUI::on_trigLevel_valueChanged(int value)
|
|||||||
void GLScopeGUI::on_slopePos_clicked()
|
void GLScopeGUI::on_slopePos_clicked()
|
||||||
{
|
{
|
||||||
m_triggerPositiveEdge = true;
|
m_triggerPositiveEdge = true;
|
||||||
|
m_triggerBothEdges = false;
|
||||||
|
|
||||||
|
ui->slopeBoth->setChecked(false);
|
||||||
|
|
||||||
if(ui->slopePos->isChecked()) {
|
if(ui->slopePos->isChecked()) {
|
||||||
ui->slopeNeg->setChecked(false);
|
ui->slopeNeg->setChecked(false);
|
||||||
@ -559,6 +573,9 @@ void GLScopeGUI::on_slopePos_clicked()
|
|||||||
void GLScopeGUI::on_slopeNeg_clicked()
|
void GLScopeGUI::on_slopeNeg_clicked()
|
||||||
{
|
{
|
||||||
m_triggerPositiveEdge = false;
|
m_triggerPositiveEdge = false;
|
||||||
|
m_triggerBothEdges = false;
|
||||||
|
|
||||||
|
ui->slopeBoth->setChecked(false);
|
||||||
|
|
||||||
if(ui->slopeNeg->isChecked()) {
|
if(ui->slopeNeg->isChecked()) {
|
||||||
ui->slopePos->setChecked(false);
|
ui->slopePos->setChecked(false);
|
||||||
@ -569,6 +586,17 @@ void GLScopeGUI::on_slopeNeg_clicked()
|
|||||||
applyTriggerSettings();
|
applyTriggerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeGUI::on_slopeBoth_clicked()
|
||||||
|
{
|
||||||
|
std::cerr << "GLScopeGUI::on_slopeBoth_clicked" << std::endl;
|
||||||
|
ui->slopePos->setChecked(false);
|
||||||
|
ui->slopeNeg->setChecked(false);
|
||||||
|
ui->slopeBoth->setChecked(true);
|
||||||
|
m_triggerBothEdges = true;
|
||||||
|
|
||||||
|
applyTriggerSettings();
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeGUI::on_oneShot_clicked()
|
void GLScopeGUI::on_oneShot_clicked()
|
||||||
{
|
{
|
||||||
m_scopeVis->setOneShot(ui->oneShot->isChecked());
|
m_scopeVis->setOneShot(ui->oneShot->isChecked());
|
||||||
|
@ -571,7 +571,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Trigger slope positive</string>
|
<string>Trigger positive edge</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
@ -608,7 +608,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Trigger slope negative</string>
|
<string>Trigger negative edge</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
@ -631,6 +631,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ButtonSwitch" name="slopeBoth">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Trigger on both edges</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/slopeb_icon.png</normaloff>:/slopeb_icon.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ButtonSwitch" name="oneShot">
|
<widget class="ButtonSwitch" name="oneShot">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -23,5 +23,6 @@
|
|||||||
<file>horizontal_w.png</file>
|
<file>horizontal_w.png</file>
|
||||||
<file>vertical_w.png</file>
|
<file>vertical_w.png</file>
|
||||||
<file>current.png</file>
|
<file>current.png</file>
|
||||||
|
<file>slopeb_icon.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
sdrbase/resources/slopeb_icon.png
Normal file
BIN
sdrbase/resources/slopeb_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 470 B |
Loading…
x
Reference in New Issue
Block a user