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

Rename trigger delay to pre-trigger delay and variables based on trigPre

This commit is contained in:
f4exb 2015-07-21 22:18:17 +02:00
parent de3e3031c2
commit 833b8c30c7
6 changed files with 45 additions and 44 deletions

View File

@ -115,13 +115,14 @@ Done since the fork
- Enhanced spectrum display: Histogram: define NO_AVX, wider decay range, make stroke and late holdoff adjustable. Added option to show live spectrum (had only max hold before).
- Enhanced channel analyzer: enhanced scope and spectrum displays as mentioned above, make the spectrum display synchronous to scope (hence triggerable a la E4406A).
- Sort channel plugins by delta frequency and type before saving to preset
- Implemented scope trigger delay
- Implemented scope pre-trigger delay
=====
To Do
=====
- Variable scope memory depth
- Trigger delay
- Enhance presets management (Edit, Move, Import/Export from/to human readable format like JSON)
- Level calibration
- Enhance WFM (stereo, RDS?)

View File

@ -24,7 +24,7 @@ public:
ScopeVis(GLScope* glScope = NULL);
void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize);
void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerPre, uint traceSize);
void setOneShot(bool oneShot);
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
@ -45,27 +45,27 @@ private:
int getTriggerChannel() const { return m_triggerChannel; }
Real getTriggerLevel() const { return m_triggerLevel; }
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
uint getTriggerDelay() const { return m_triggerDelay; }
uint getTriggerPre() const { return m_triggerPre; }
uint getTraceSize() const { return m_traceSize; }
static MsgConfigureScopeVis* create(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize)
static MsgConfigureScopeVis* create(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerPre, uint traceSize)
{
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay, traceSize);
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge, triggerPre, traceSize);
}
private:
int m_triggerChannel;
Real m_triggerLevel;
bool m_triggerPositiveEdge;
uint m_triggerDelay;
uint m_triggerPre;
uint m_traceSize;
MsgConfigureScopeVis(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize) :
MsgConfigureScopeVis(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerPre, uint traceSize) :
Message(),
m_triggerChannel(triggerChannel),
m_triggerLevel(triggerLevel),
m_triggerPositiveEdge(triggerPositiveEdge),
m_triggerDelay(triggerDelay),
m_triggerPre(triggerPre),
m_traceSize(traceSize)
{ }
};
@ -85,7 +85,7 @@ private:
TriggerChannel m_triggerChannel;
Real m_triggerLevel;
bool m_triggerPositiveEdge;
uint m_triggerDelay; //!< Trigger delay in number of samples
uint m_triggerPre; //!< Pre-trigger delay in number of samples
bool m_triggerOneShot;
bool m_armed;
int m_sampleRate;

View File

@ -51,7 +51,7 @@ private:
qint32 m_triggerChannel;
qint32 m_triggerLevel; // percent
bool m_triggerPositiveEdge;
qint32 m_triggerDelay;
qint32 m_triggerPre;
qint32 m_traceSize;
static const qreal amps[11];
@ -63,7 +63,7 @@ private:
void setAmpScaleDisplay();
void setAmpOfsDisplay();
void setTrigLevelDisplay();
void setTrigDelayDisplay();
void setTrigPreDisplay();
private slots:
void on_amp_valueChanged(int value);
@ -75,7 +75,7 @@ private slots:
void on_dataMode_currentIndexChanged(int index);
void on_gridIntensity_valueChanged(int index);
void on_traceIntensity_valueChanged(int index);
void on_trigDelay_valueChanged(int value);
void on_trigPre_valueChanged(int value);
void on_horizView_clicked();
void on_vertView_clicked();

View File

@ -19,7 +19,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
m_triggerChannel(TriggerFreeRun),
m_triggerLevel(0.0),
m_triggerPositiveEdge(true),
m_triggerDelay(0),
m_triggerPre(0),
m_triggerOneShot(false),
m_armed(false),
m_sampleRate(0)
@ -29,9 +29,9 @@ ScopeVis::ScopeVis(GLScope* glScope) :
m_traceback.resize(20*m_traceChunkSize);
}
void ScopeVis::configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize)
void ScopeVis::configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerPre, uint traceSize)
{
Message* cmd = MsgConfigureScopeVis::create(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay, traceSize);
Message* cmd = MsgConfigureScopeVis::create(triggerChannel, triggerLevel, triggerPositiveEdge, triggerPre, traceSize);
cmd->submit(msgQueue, this);
}
@ -82,7 +82,7 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter
while(begin < end)
{
bool trigger = triggerCondition(begin);
if ((trigger ^ !m_triggerPositiveEdge) && (m_tracebackCount > m_triggerDelay))
if ((trigger ^ !m_triggerPositiveEdge) && (m_tracebackCount > m_triggerPre))
{
if (m_armed)
{
@ -90,9 +90,9 @@ void ScopeVis::feed(SampleVector::const_iterator begin, SampleVector::const_iter
m_armed = false;
m_triggerPoint = begin;
// fill beginning of m_trace with delayed samples from the trace memory FIFO. Increment m_fill accordingly.
if (m_triggerDelay) { // do this process only if there is a delayed trigger
std::copy(m_traceback.end() - m_triggerDelay, m_traceback.end() - 1, m_trace.begin());
m_fill = m_triggerDelay; // Increment m_fill accordingly (from 0).
if (m_triggerPre) { // do this process only if there is a pre-trigger delay
std::copy(m_traceback.end() - m_triggerPre, m_traceback.end() - 1, m_trace.begin());
m_fill = m_triggerPre; // Increment m_fill accordingly (from 0).
}
break;
}
@ -155,9 +155,9 @@ bool ScopeVis::handleMessageKeep(Message* message)
m_triggerChannel = (TriggerChannel) conf->getTriggerChannel();
m_triggerLevel = conf->getTriggerLevel();
m_triggerPositiveEdge = conf->getTriggerPositiveEdge();
m_triggerDelay = conf->getTriggerDelay();
if (m_triggerDelay >= m_traceback.size()) {
m_triggerDelay = m_traceback.size() - 1; // top sample in FIFO is always the triggering one (delay = 0)
m_triggerPre = conf->getTriggerPre();
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)
}
uint newSize = conf->getTraceSize();
if (newSize != m_trace.size()) {
@ -170,7 +170,7 @@ bool ScopeVis::handleMessageKeep(Message* message)
<< " m_triggerChannel: " << m_triggerChannel
<< " m_triggerLevel: " << m_triggerLevel
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
<< " m_preTrigger: " << m_triggerDelay
<< " m_preTrigger: " << m_triggerPre
<< " m_traceSize: " << m_trace.size() << std::endl;
return true;
/*

View File

@ -28,7 +28,7 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
m_triggerChannel(ScopeVis::TriggerFreeRun),
m_triggerLevel(0.0),
m_triggerPositiveEdge(true),
m_triggerDelay(0),
m_triggerPre(0),
m_traceSize(96000)
{
ui->setupUi(this);
@ -83,7 +83,7 @@ QByteArray GLScopeGUI::serialize() const
s.writeS32(10, m_triggerLevel);
s.writeBool(11, m_triggerPositiveEdge);
s.writeS32(12, m_displayTraceIntensity);
s.writeS32(13, m_triggerDelay);
s.writeS32(13, m_triggerPre);
return s.final();
}
@ -117,9 +117,9 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
ui->slopePos->setChecked(m_triggerPositiveEdge);
ui->slopeNeg->setChecked(!m_triggerPositiveEdge);
d.readS32(12, &m_displayTraceIntensity, 50);
d.readS32(13, &m_triggerDelay, 0);
ui->trigDelay->setValue(m_triggerDelay);
setTrigDelayDisplay();
d.readS32(13, &m_triggerPre, 0);
ui->trigPre->setValue(m_triggerPre);
setTrigPreDisplay();
applySettings();
applyTriggerSettings();
return true;
@ -175,7 +175,7 @@ void GLScopeGUI::applySettings()
void GLScopeGUI::applyTriggerSettings()
{
Real triggerLevel;
quint32 trigDelaySamples = (m_glScope->getTraceSize() * m_triggerDelay) / 100;
quint32 preTriggerSamples = (m_glScope->getTraceSize() * m_triggerPre) / 100;
if (m_triggerChannel == ScopeVis::TriggerMagDb) {
triggerLevel = m_triggerLevel - 100.0;
@ -187,7 +187,7 @@ void GLScopeGUI::applyTriggerSettings()
m_glScope->setTriggerChannel((ScopeVis::TriggerChannel) m_triggerChannel);
m_glScope->setTriggerLevel(m_triggerLevel / 100.0);
m_scopeVis->configure(m_messageQueue, (ScopeVis::TriggerChannel) m_triggerChannel, triggerLevel, m_triggerPositiveEdge, trigDelaySamples, 96000); // TODO: pass trace size as last parameter
m_scopeVis->configure(m_messageQueue, (ScopeVis::TriggerChannel) m_triggerChannel, triggerLevel, m_triggerPositiveEdge, preTriggerSamples, 96000); // TODO: pass trace size as last parameter
}
void GLScopeGUI::setTrigLevelDisplay()
@ -282,17 +282,17 @@ void GLScopeGUI::setTimeOfsDisplay()
//ui->timeOfsText->setText(tr("%1").arg(value/100.0, 0, 'f', 2));
}
void GLScopeGUI::setTrigDelayDisplay()
void GLScopeGUI::setTrigPreDisplay()
{
qreal dt = m_glScope->getTraceSize() * (m_triggerDelay/100.0) / m_sampleRate;
qreal dt = m_glScope->getTraceSize() * (m_triggerPre/100.0) / m_sampleRate;
if(dt < 0.000001)
ui->trigDelayText->setText(tr("%1\nns").arg(dt * 1000000000.0));
ui->trigPreText->setText(tr("%1\nns").arg(dt * 1000000000.0));
else if(dt < 0.001)
ui->trigDelayText->setText(tr("%1\nµs").arg(dt * 1000000.0));
ui->trigPreText->setText(tr("%1\nµs").arg(dt * 1000000.0));
else if(dt < 1.0)
ui->trigDelayText->setText(tr("%1\nms").arg(dt * 1000.0));
else ui->trigDelayText->setText(tr("%1\ns").arg(dt * 1.0));
ui->trigPreText->setText(tr("%1\nms").arg(dt * 1000.0));
else ui->trigPreText->setText(tr("%1\ns").arg(dt * 1.0));
}
void GLScopeGUI::on_time_valueChanged(int value)
@ -312,13 +312,13 @@ void GLScopeGUI::on_timeOfs_valueChanged(int value)
m_glScope->setTimeOfsProMill(value*10);
}
void GLScopeGUI::on_trigDelay_valueChanged(int value)
void GLScopeGUI::on_trigPre_valueChanged(int value)
{
if ((value < 0) || (value > 100)) {
return;
}
m_triggerDelay = value;
setTrigDelayDisplay();
m_triggerPre = value;
setTrigPreDisplay();
applyTriggerSettings();
}

View File

@ -713,21 +713,21 @@
</widget>
</item>
<item>
<widget class="QLabel" name="trigDelayLabel">
<widget class="QLabel" name="trigPreLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string> Dly</string>
<string> Pre</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="trigDelay">
<widget class="QSlider" name="trigPre">
<property name="toolTip">
<string>Trigger delay</string>
<string>Pre-trigger delay</string>
</property>
<property name="maximum">
<number>100</number>
@ -741,7 +741,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="trigDelayText">
<widget class="QLabel" name="trigPreText">
<property name="font">
<font>
<pointsize>8</pointsize>