kopia lustrzana https://github.com/f4exb/sdrangel
prepare variable trace length #1
rodzic
e0860a0d40
commit
de3e3031c2
|
@ -20,9 +20,11 @@ public:
|
|||
TriggerPhase
|
||||
};
|
||||
|
||||
static const uint m_traceChunkSize;
|
||||
|
||||
ScopeVis(GLScope* glScope = NULL);
|
||||
|
||||
void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay);
|
||||
void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize);
|
||||
void setOneShot(bool oneShot);
|
||||
|
||||
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
||||
|
@ -44,10 +46,11 @@ private:
|
|||
Real getTriggerLevel() const { return m_triggerLevel; }
|
||||
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
|
||||
uint getTriggerDelay() const { return m_triggerDelay; }
|
||||
uint getTraceSize() const { return m_traceSize; }
|
||||
|
||||
static MsgConfigureScopeVis* create(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay)
|
||||
static MsgConfigureScopeVis* create(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize)
|
||||
{
|
||||
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay);
|
||||
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay, traceSize);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -55,13 +58,15 @@ private:
|
|||
Real m_triggerLevel;
|
||||
bool m_triggerPositiveEdge;
|
||||
uint m_triggerDelay;
|
||||
uint m_traceSize;
|
||||
|
||||
MsgConfigureScopeVis(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay) :
|
||||
MsgConfigureScopeVis(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize) :
|
||||
Message(),
|
||||
m_triggerChannel(triggerChannel),
|
||||
m_triggerLevel(triggerLevel),
|
||||
m_triggerPositiveEdge(triggerPositiveEdge),
|
||||
m_triggerDelay(triggerDelay)
|
||||
m_triggerDelay(triggerDelay),
|
||||
m_traceSize(traceSize)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -73,8 +78,8 @@ private:
|
|||
|
||||
GLScope* m_glScope;
|
||||
std::vector<Complex> m_trace; //!< Raw trace to be used by GLScope
|
||||
boost::circular_buffer<Complex> m_traceback; //!< FIFO for samples prior to triggering point to support trigger delay (when in triggered mode)
|
||||
uint m_tracebackCount; //!< Count of samples stored into trace memory since triggering is active up to trace memory size
|
||||
boost::circular_buffer<Complex> m_traceback; //!< FIFO for samples prior to triggering point to support pre-trigger (when in triggered mode)
|
||||
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;
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
qint32 m_triggerLevel; // percent
|
||||
bool m_triggerPositiveEdge;
|
||||
qint32 m_triggerDelay;
|
||||
qint32 m_traceSize;
|
||||
|
||||
static const qreal amps[11];
|
||||
|
||||
|
|
|
@ -9,25 +9,29 @@
|
|||
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVis, Message)
|
||||
|
||||
const uint ScopeVis::m_traceChunkSize = 4800;
|
||||
|
||||
ScopeVis::ScopeVis(GLScope* glScope) :
|
||||
m_glScope(glScope),
|
||||
m_trace(96000),
|
||||
m_traceback(96000),
|
||||
m_tracebackCount(0),
|
||||
m_fill(0),
|
||||
m_triggerState(Untriggered),
|
||||
m_triggerChannel(TriggerFreeRun),
|
||||
m_triggerLevel(0.0),
|
||||
m_triggerPositiveEdge(true),
|
||||
m_triggerDelay(0),
|
||||
m_triggerOneShot(false),
|
||||
m_armed(false),
|
||||
m_sampleRate(0)
|
||||
{
|
||||
m_trace.reserve(100*m_traceChunkSize);
|
||||
m_trace.resize(20*m_traceChunkSize);
|
||||
m_traceback.resize(20*m_traceChunkSize);
|
||||
}
|
||||
|
||||
void ScopeVis::configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay)
|
||||
void ScopeVis::configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge, uint triggerDelay, uint traceSize)
|
||||
{
|
||||
Message* cmd = MsgConfigureScopeVis::create(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay);
|
||||
Message* cmd = MsgConfigureScopeVis::create(triggerChannel, triggerLevel, triggerPositiveEdge, triggerDelay, traceSize);
|
||||
cmd->submit(msgQueue, this);
|
||||
}
|
||||
|
||||
|
@ -154,12 +158,20 @@ bool ScopeVis::handleMessageKeep(Message* message)
|
|||
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)
|
||||
}
|
||||
uint newSize = conf->getTraceSize();
|
||||
if (newSize != m_trace.size()) {
|
||||
m_trace.resize(newSize);
|
||||
}
|
||||
if (newSize > m_traceback.size()) { // fitting the exact required space is not a requirement for the back trace
|
||||
m_traceback.resize(newSize);
|
||||
}
|
||||
std::cerr << "ScopeVis::handleMessageKeep:"
|
||||
<< " m_triggerChannel: " << m_triggerChannel
|
||||
<< " m_triggerLevel: " << m_triggerLevel
|
||||
<< " m_triggerPositiveEdge: " << (m_triggerPositiveEdge ? "edge+" : "edge-")
|
||||
<< " m_triggerDelay: " << m_triggerDelay << std::endl;
|
||||
<< " m_preTrigger: " << m_triggerDelay
|
||||
<< " m_traceSize: " << m_trace.size() << std::endl;
|
||||
return true;
|
||||
/*
|
||||
} else if(DSPConfigureScopeVis::match(message)) {
|
||||
|
|
|
@ -27,7 +27,9 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
|
|||
m_displayGridIntensity(1),
|
||||
m_triggerChannel(ScopeVis::TriggerFreeRun),
|
||||
m_triggerLevel(0.0),
|
||||
m_triggerPositiveEdge(true)
|
||||
m_triggerPositiveEdge(true),
|
||||
m_triggerDelay(0),
|
||||
m_traceSize(96000)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
@ -185,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); // TODO: pass trigger delay as the last parameter
|
||||
m_scopeVis->configure(m_messageQueue, (ScopeVis::TriggerChannel) m_triggerChannel, triggerLevel, m_triggerPositiveEdge, trigDelaySamples, 96000); // TODO: pass trace size as last parameter
|
||||
}
|
||||
|
||||
void GLScopeGUI::setTrigLevelDisplay()
|
||||
|
|
Ładowanie…
Reference in New Issue