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

GLScope redesign: moved static constants to GLScopeSettings

This commit is contained in:
f4exb 2021-05-30 10:49:52 +02:00
parent e9d51c99a7
commit 5ab495a3fb
5 changed files with 19 additions and 75 deletions

View File

@ -359,7 +359,7 @@ void ChannelAnalyzerGUI::on_signalSelect_currentIndexChanged(int index)
if (m_settings.m_inputType == ChannelAnalyzerSettings::InputAutoCorr) {
m_scopeVis->setTraceChunkSize(ChannelAnalyzerSink::m_corrFFTLen);
} else {
m_scopeVis->setTraceChunkSize(ScopeVis::m_traceChunkDefaultSize);
m_scopeVis->setTraceChunkSize(GLScopeSettings::m_traceChunkDefaultSize);
}
ui->scopeGUI->traceLengthChange();

View File

@ -165,6 +165,11 @@ public:
std::vector<TraceData> m_tracesData;
std::vector<TriggerData> m_triggersData;
static const double AMPS[27];
static const uint32_t m_traceChunkDefaultSize = 4800;
static const uint32_t m_maxNbTriggers = 10;
static const uint32_t m_maxNbTraces = 10;
static const uint32_t m_nbTraceMemories = 50;
static const uint32_t m_nbTraceBuffers = 2;
GLScopeSettings();
virtual ~GLScopeSettings();

View File

@ -38,8 +38,6 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGOneShot, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
const uint ScopeVis::m_traceChunkDefaultSize = 4800;
ScopeVis::ScopeVis(GLScopeInterface* glScope) :
m_glScope(glScope),
@ -50,9 +48,9 @@ ScopeVis::ScopeVis(GLScopeInterface* glScope) :
m_focusedTriggerIndex(0),
m_triggerState(TriggerUntriggered),
m_focusedTraceIndex(0),
m_traceChunkSize(m_traceChunkDefaultSize),
m_traceSize(m_traceChunkDefaultSize),
m_liveTraceSize(m_traceChunkDefaultSize),
m_traceChunkSize(GLScopeSettings::m_traceChunkDefaultSize),
m_traceSize(GLScopeSettings::m_traceChunkDefaultSize),
m_liveTraceSize(GLScopeSettings::m_traceChunkDefaultSize),
m_nbSamples(0),
m_timeBase(1),
m_timeOfsProMill(0),
@ -60,7 +58,7 @@ ScopeVis::ScopeVis(GLScopeInterface* glScope) :
m_triggerLocation(0),
m_sampleRate(0),
m_liveSampleRate(0),
m_traceDiscreteMemory(m_nbTraceMemories),
m_traceDiscreteMemory(GLScopeSettings::m_nbTraceMemories),
m_freeRun(true),
m_maxTraceDelay(0),
m_triggerOneShot(false),
@ -68,7 +66,7 @@ ScopeVis::ScopeVis(GLScopeInterface* glScope) :
m_currentTraceMemoryIndex(0)
{
setObjectName("ScopeVis");
m_traceDiscreteMemory.resize(m_traceChunkDefaultSize); // arbitrary
m_traceDiscreteMemory.resize(GLScopeSettings::m_traceChunkDefaultSize); // arbitrary
m_glScope->setTraces(&m_traces.m_tracesData, &m_traces.m_traces[0]);
for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) {
m_projectorCache[i] = 0.0;
@ -217,7 +215,6 @@ void ScopeVis::setMemoryIndex(uint32_t memoryIndex)
}
void ScopeVis::feed(const std::vector<SampleVector::const_iterator>& vbegin, int nbSamples)
//void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly)
{
if (vbegin.size() == 0) {
return;
@ -286,12 +283,12 @@ void ScopeVis::feed(const std::vector<SampleVector::const_iterator>& vbegin, int
void ScopeVis::processMemoryTrace()
{
if ((m_currentTraceMemoryIndex > 0) && (m_currentTraceMemoryIndex < m_nbTraceMemories))
if ((m_currentTraceMemoryIndex > 0) && (m_currentTraceMemoryIndex < GLScopeSettings::m_nbTraceMemories))
{
int traceMemoryIndex = m_traceDiscreteMemory.currentIndex() - m_currentTraceMemoryIndex; // actual index in memory bank
if (traceMemoryIndex < 0) {
traceMemoryIndex += m_nbTraceMemories;
traceMemoryIndex += GLScopeSettings::m_nbTraceMemories;
}
SampleVector::const_iterator mend = m_traceDiscreteMemory.at(traceMemoryIndex).m_endPoint;

View File

@ -43,63 +43,6 @@ class GLScopeInterface;
class SDRGUI_API ScopeVis : public QObject {
Q_OBJECT
public:
struct TriggerData
{
uint32_t m_streamIndex; //!< I/Q stream index
Projector::ProjectionType m_projectionType; //!< Complex to real projection type
uint32_t m_inputIndex; //!< Input or feed index this trigger is associated with
Real m_triggerLevel; //!< Level in real units
int m_triggerLevelCoarse;
int m_triggerLevelFine;
bool m_triggerPositiveEdge; //!< Trigger on the positive edge (else negative)
bool m_triggerBothEdges; //!< Trigger on both edges (else only one)
uint32_t m_triggerHoldoff; //!< Trigger holdoff in number of samples
uint32_t m_triggerDelay; //!< Delay before the trigger is kicked off in number of samples (trigger delay)
double m_triggerDelayMult; //!< Trigger delay as a multiplier of trace length
int m_triggerDelayCoarse;
int m_triggerDelayFine;
uint32_t m_triggerRepeat; //!< Number of trigger conditions before the final decisive trigger
QColor m_triggerColor; //!< Trigger line display color
float m_triggerColorR; //!< Trigger line display color - red shortcut
float m_triggerColorG; //!< Trigger line display color - green shortcut
float m_triggerColorB; //!< Trigger line display color - blue shortcut
TriggerData() :
m_streamIndex(0),
m_projectionType(Projector::ProjectionReal),
m_inputIndex(0),
m_triggerLevel(0.0f),
m_triggerLevelCoarse(0),
m_triggerLevelFine(0),
m_triggerPositiveEdge(true),
m_triggerBothEdges(false),
m_triggerHoldoff(1),
m_triggerDelay(0),
m_triggerDelayMult(0.0),
m_triggerDelayCoarse(0),
m_triggerDelayFine(0),
m_triggerRepeat(0),
m_triggerColor(0,255,0)
{
setColor(m_triggerColor);
}
void setColor(QColor color)
{
m_triggerColor = color;
qreal r,g,b,a;
m_triggerColor.getRgbF(&r, &g, &b, &a);
m_triggerColorR = r;
m_triggerColorG = g;
m_triggerColorB = b;
}
};
static const uint32_t m_traceChunkDefaultSize;
static const uint32_t m_maxNbTriggers = 10;
static const uint32_t m_maxNbTraces = 10;
static const uint32_t m_nbTraceMemories = 50;
ScopeVis(GLScopeInterface* glScope = nullptr);
virtual ~ScopeVis();
@ -151,7 +94,7 @@ public:
QByteArray buf;
bool traceDiscreteMemorySuccess;
d.readU32(1, &traceSize, m_traceChunkDefaultSize);
d.readU32(1, &traceSize, GLScopeSettings::m_traceChunkDefaultSize);
d.readU32(2, &preTriggerDelay, 0);
d.readS32(3, &sampleRate, 0);
setSampleRate(sampleRate);
@ -191,7 +134,6 @@ public:
uint32_t getNbTriggers() const { return m_triggerConditions.size(); }
void feed(const std::vector<SampleVector::const_iterator>& vbegin, int nbSamples);
//virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
//virtual void start();
//virtual void stop();
bool handleMessage(const Message& message);
@ -869,7 +811,7 @@ private:
void addTrace(const GLScopeSettings::TraceData& traceData, int traceSize)
{
if (m_traces[0].size() < m_maxNbTraces)
if (m_traces[0].size() < GLScopeSettings::m_maxNbTraces)
{
qDebug("ScopeVis::addTrace");
m_traces[0].push_back(0);
@ -955,8 +897,8 @@ private:
{
delete[] m_x0;
delete[] m_x1;
m_x0 = new float[2*m_traceSize*m_maxNbTraces];
m_x1 = new float[2*m_traceSize*m_maxNbTraces];
m_x0 = new float[2*m_traceSize*GLScopeSettings::m_maxNbTraces];
m_x1 = new float[2*m_traceSize*GLScopeSettings::m_maxNbTraces];
m_maxTraceSize = m_traceSize;
}

View File

@ -51,13 +51,13 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
qDebug("GLScopeGUI::GLScopeGUI");
setEnabled(false);
ui->setupUi(this);
ui->trigDelayFine->setMaximum(ScopeVis::m_traceChunkDefaultSize / 10.0);
ui->trigDelayFine->setMaximum(GLScopeSettings::m_traceChunkDefaultSize / 10.0);
ui->traceColor->setStyleSheet("QLabel { background-color : rgb(255,255,64); }");
m_focusedTraceColor.setRgb(255,255,64);
ui->trigColor->setStyleSheet("QLabel { background-color : rgb(0,255,0); }");
m_focusedTriggerColor.setRgb(0,255,0);
ui->traceText->setText("X");
ui->mem->setMaximum(ScopeVis::m_nbTraceMemories - 1);
ui->mem->setMaximum(GLScopeSettings::m_nbTraceMemories - 1);
}
GLScopeGUI::~GLScopeGUI()