mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-14 23:05:20 -04:00
New scope: interim state (2)
This commit is contained in:
parent
998ac33d59
commit
ce41ded86e
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "scopevisng.h"
|
#include "scopevisng.h"
|
||||||
|
#include "dsp/dspcommands.h"
|
||||||
#include "gui/glscopeng.h"
|
#include "gui/glscopeng.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgConfigureScopeVisNG, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgConfigureScopeVisNG, Message)
|
||||||
@ -246,13 +247,14 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
|
|||||||
|
|
||||||
if (m_traceStart)
|
if (m_traceStart)
|
||||||
{
|
{
|
||||||
int count = begin - cbegin; // number of samples consumed since begin
|
int count = end - begin; // number of samples in traceback buffer past the current point
|
||||||
std::vector<Trace>::iterator itTrace = m_traces.begin();
|
std::vector<Trace>::iterator itTrace = m_traces.begin();
|
||||||
|
|
||||||
for (;itTrace != m_traces.end(); ++itTrace)
|
for (;itTrace != m_traces.end(); ++itTrace)
|
||||||
{
|
{
|
||||||
if (itTrace->m_traceData.m_inputIndex == feedIndex)
|
if (itTrace->m_traceData.m_inputIndex == feedIndex)
|
||||||
{
|
{
|
||||||
|
// TODO: store current point in traceback (current - count)
|
||||||
SampleVector::const_iterator startPoint = m_tracebackBuffers[feedIndex].getCurrent() - count;
|
SampleVector::const_iterator startPoint = m_tracebackBuffers[feedIndex].getCurrent() - count;
|
||||||
SampleVector::const_iterator prevPoint = m_tracebackBuffers[feedIndex].getCurrent() - count - m_preTriggerDelay - itTrace->m_traceData.m_traceDelay;
|
SampleVector::const_iterator prevPoint = m_tracebackBuffers[feedIndex].getCurrent() - count - m_preTriggerDelay - itTrace->m_traceData.m_traceDelay;
|
||||||
processPrevTrace(prevPoint, startPoint, itTrace);
|
processPrevTrace(prevPoint, startPoint, itTrace);
|
||||||
@ -300,7 +302,9 @@ void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVe
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//m_glScope->newTraces((DisplayTraces&) m_traces); // TODO: glScopeNG new traces
|
// TODO: glScopeNG new traces
|
||||||
|
// TODO: mark end point in traceback buffer: current - (end - begin)
|
||||||
|
//m_glScope->newTraces((DisplayTraces&) m_traces);
|
||||||
m_traceCompleteCount = 0;
|
m_traceCompleteCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,5 +351,19 @@ void ScopeVisNG::stop()
|
|||||||
bool ScopeVisNG::handleMessage(const Message& message)
|
bool ScopeVisNG::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
qDebug() << "ScopeVisNG::handleMessage" << message.getIdentifier();
|
qDebug() << "ScopeVisNG::handleMessage" << message.getIdentifier();
|
||||||
|
|
||||||
|
if (DSPSignalNotification::match(message))
|
||||||
|
{
|
||||||
|
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
||||||
|
setSampleRate(notif.getSampleRate());
|
||||||
|
qDebug() << "ScopeVisNG::handleMessage: DSPSignalNotification: m_sampleRate: " << m_sampleRate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (MsgConfigureScopeVisNG::match(message))
|
||||||
|
{
|
||||||
|
MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,18 +32,18 @@ class GLScopeNG;
|
|||||||
class SDRANGEL_API ScopeVisNG : public BasebandSampleSink {
|
class SDRANGEL_API ScopeVisNG : public BasebandSampleSink {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ProjectionType
|
enum ProjectionType
|
||||||
{
|
{
|
||||||
ProjectionReal, //!< Extract real part
|
ProjectionReal, //!< Extract real part
|
||||||
ProjectionImag, //!< Extract imaginary part
|
ProjectionImag, //!< Extract imaginary part
|
||||||
ProjectionMagLin, //!< Calculate linear magnitude or modulus
|
ProjectionMagLin, //!< Calculate linear magnitude or modulus
|
||||||
ProjectionMagDB, //!< Calculate logarithmic (dB) of squared magnitude
|
ProjectionMagDB, //!< Calculate logarithmic (dB) of squared magnitude
|
||||||
ProjectionPhase, //!< Calculate phase
|
ProjectionPhase, //!< Calculate phase
|
||||||
ProjectionDPhase //!< Calculate phase derivative i.e. instantaneous frequency scaled to sample rate
|
ProjectionDPhase //!< Calculate phase derivative i.e. instantaneous frequency scaled to sample rate
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TraceData
|
struct TraceData
|
||||||
{
|
{
|
||||||
ProjectionType m_projectionType; //!< Complex to real projection type
|
ProjectionType m_projectionType; //!< Complex to real projection type
|
||||||
uint32_t m_inputIndex; //!< Input or feed index this trace is associated with
|
uint32_t m_inputIndex; //!< Input or feed index this trace is associated with
|
||||||
float m_amp; //!< Amplification factor
|
float m_amp; //!< Amplification factor
|
||||||
@ -57,16 +57,21 @@ public:
|
|||||||
m_ofs(0.0f),
|
m_ofs(0.0f),
|
||||||
m_traceDelay(0)
|
m_traceDelay(0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DisplayTrace
|
struct DisplayTrace
|
||||||
{
|
{
|
||||||
TraceData m_traceData; //!< Trace data
|
TraceData m_traceData; //!< Trace data
|
||||||
float *m_trace; //!< Displayable trace (interleaved x,y of GLfloat)
|
float *m_trace; //!< Displayable trace (interleaved x,y of GLfloat)
|
||||||
};
|
|
||||||
|
|
||||||
struct TriggerData
|
DisplayTrace(const TraceData& traceData) :
|
||||||
{
|
m_traceData(traceData),
|
||||||
|
m_trace(0)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TriggerData
|
||||||
|
{
|
||||||
ProjectionType m_projectionType; //!< Complex to real projection type
|
ProjectionType m_projectionType; //!< Complex to real projection type
|
||||||
uint32_t m_inputIndex; //!< Input or feed index this trigger is associated with
|
uint32_t m_inputIndex; //!< Input or feed index this trigger is associated with
|
||||||
Real m_triggerLevel; //!< Level in real units
|
Real m_triggerLevel; //!< Level in real units
|
||||||
@ -84,7 +89,7 @@ public:
|
|||||||
m_triggerDelay(0),
|
m_triggerDelay(0),
|
||||||
m_triggerCounts(0)
|
m_triggerCounts(0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<DisplayTrace> DisplayTraces;
|
typedef std::vector<DisplayTrace> DisplayTraces;
|
||||||
|
|
||||||
@ -124,6 +129,8 @@ private:
|
|||||||
return new MsgConfigureScopeVisNG(traceSize);
|
return new MsgConfigureScopeVisNG(traceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTraceSize() const { return m_traceSize; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_traceSize;
|
uint32_t m_traceSize;
|
||||||
|
|
||||||
@ -187,7 +194,7 @@ private:
|
|||||||
uint32_t m_triggerIndex;
|
uint32_t m_triggerIndex;
|
||||||
|
|
||||||
MsgScopeVisNGRemoveTrigger(uint32_t triggerIndex) :
|
MsgScopeVisNGRemoveTrigger(uint32_t triggerIndex) :
|
||||||
m_triggerIndex(triggerIndex)
|
m_triggerIndex(triggerIndex)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -258,7 +265,7 @@ private:
|
|||||||
Projector(ProjectionType projectionType) : m_projectionType(projectionType) {}
|
Projector(ProjectionType projectionType) : m_projectionType(projectionType) {}
|
||||||
|
|
||||||
ProjectionType getProjectionType() const { return m_projectionType; }
|
ProjectionType getProjectionType() const { return m_projectionType; }
|
||||||
virtual Real run(const Sample& s) = 0;
|
virtual Real run(const Sample& s) {}
|
||||||
private:
|
private:
|
||||||
ProjectionType m_projectionType;
|
ProjectionType m_projectionType;
|
||||||
};
|
};
|
||||||
@ -339,44 +346,97 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
enum TriggerState
|
enum TriggerState
|
||||||
{
|
{
|
||||||
TriggerFreeRun, //!< Trigger is disabled
|
TriggerFreeRun, //!< Trigger is disabled
|
||||||
TriggerUntriggered, //!< Trigger is not kicked off yet (or trigger list is empty)
|
TriggerUntriggered, //!< Trigger is not kicked off yet (or trigger list is empty)
|
||||||
TriggerTriggered, //!< Trigger has been kicked off
|
TriggerTriggered, //!< Trigger has been kicked off
|
||||||
TriggerWait, //!< In one shot mode trigger waits for manual re-enabling
|
TriggerWait, //!< In one shot mode trigger waits for manual re-enabling
|
||||||
TriggerDelay, //!< Trigger conditions have been kicked off but it is waiting for delay before final kick off
|
TriggerDelay, //!< Trigger conditions have been kicked off but it is waiting for delay before final kick off
|
||||||
TriggerNewConfig, //!< Special condition when a new configuration has been received
|
TriggerNewConfig, //!< Special condition when a new configuration has been received
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TriggerCondition
|
struct TriggerCondition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Projector *m_projector; //!< Projector transform from complex trace to reaL trace usable for triggering
|
Projector *m_projector; //!< Projector transform from complex trace to reaL trace usable for triggering
|
||||||
TriggerData m_triggerData; //!< Trigger data
|
TriggerData m_triggerData; //!< Trigger data
|
||||||
bool m_prevCondition; //!< Condition (above threshold) at previous sample
|
bool m_prevCondition; //!< Condition (above threshold) at previous sample
|
||||||
uint32_t m_triggerDelayCount; //!< Counter of samples for delay
|
uint32_t m_triggerDelayCount; //!< Counter of samples for delay
|
||||||
uint32_t m_triggerCounter; //!< Counter of trigger occurences
|
uint32_t m_triggerCounter; //!< Counter of trigger occurences
|
||||||
|
|
||||||
TriggerCondition(Projector *projector) :
|
TriggerCondition(const TriggerData& triggerData) :
|
||||||
m_projector(projector),
|
m_triggerData(triggerData),
|
||||||
m_prevCondition(false),
|
m_prevCondition(false),
|
||||||
m_triggerDelayCount(0),
|
m_triggerDelayCount(0),
|
||||||
m_triggerCounter(0)
|
m_triggerCounter(0)
|
||||||
{}
|
{
|
||||||
|
m_projector = new Projector(m_triggerData.m_projectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
~TriggerCondition() { delete m_projector; }
|
||||||
|
|
||||||
|
void setData(const TriggerData& triggerData)
|
||||||
|
{
|
||||||
|
m_triggerData = triggerData;
|
||||||
|
|
||||||
|
if (m_projector->getProjectionType() != m_triggerData.m_projectionType)
|
||||||
|
{
|
||||||
|
delete m_projector;
|
||||||
|
m_projector = new Projector(m_triggerData.m_projectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_prevCondition = false;
|
||||||
|
m_triggerDelayCount = 0;
|
||||||
|
m_triggerCounter = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Trace : public DisplayTrace
|
struct Trace : public DisplayTrace
|
||||||
{
|
{
|
||||||
Projector *m_projector; //!< Projector transform from complex trace to real (displayable) trace
|
Projector *m_projector; //!< Projector transform from complex trace to real (displayable) trace
|
||||||
int m_traceCount; //!< Count of samples processed
|
int m_traceSize; //!< Size of the trace in buffer
|
||||||
|
int m_maxTraceSize;
|
||||||
|
int m_traceCount; //!< Count of samples processed
|
||||||
|
|
||||||
Trace(Projector *projector, Real *displayTraceBuffer) :
|
Trace(const TraceData& traceData, int traceSize) :
|
||||||
m_projector(projector),
|
DisplayTrace(traceData),
|
||||||
m_traceCount(0)
|
m_traceSize(traceSize),
|
||||||
{
|
m_maxTraceSize(traceSize),
|
||||||
m_traceData.m_projectionType = m_projector->getProjectionType();
|
m_traceCount(0)
|
||||||
m_trace = displayTraceBuffer;
|
{
|
||||||
}
|
m_projector = new Projector(m_traceData.m_projectionType);
|
||||||
|
m_trace = new float[2*traceSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
~Trace()
|
||||||
|
{
|
||||||
|
delete m_projector;
|
||||||
|
delete[] m_trace;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setData(const TraceData& traceData)
|
||||||
|
{
|
||||||
|
m_traceData = traceData;
|
||||||
|
|
||||||
|
if (m_projector->getProjectionType() != m_traceData.m_projectionType)
|
||||||
|
{
|
||||||
|
delete m_projector;
|
||||||
|
m_projector = new Projector(m_traceData.m_projectionType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resize(int traceSize)
|
||||||
|
{
|
||||||
|
m_traceSize = traceSize;
|
||||||
|
m_traceCount = 0;
|
||||||
|
|
||||||
|
if (m_traceSize > m_maxTraceSize)
|
||||||
|
{
|
||||||
|
delete[] m_trace;
|
||||||
|
m_trace = new float[2*m_traceSize];
|
||||||
|
m_maxTraceSize = m_traceSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GLScopeNG* m_glScope;
|
GLScopeNG* m_glScope;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user