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

GLScope redesign: using GLScopeSettings (1)

This commit is contained in:
f4exb 2021-06-09 01:02:20 +02:00
parent ce5de5b419
commit d08844a34c
11 changed files with 434 additions and 315 deletions

View File

@ -72,7 +72,7 @@ void InterferometerWebAPIAdapter::webapiFormatChannelSettings(
swgScope->getTracesData()->back()->setAmp(traceIt->m_amp);
swgScope->getTracesData()->back()->setAmpIndex(traceIt->m_ampIndex);
swgScope->getTracesData()->back()->setHasTextOverlay(traceIt->m_hasTextOverlay ? 1 : 0);
swgScope->getTracesData()->back()->setInputIndex(traceIt->m_inputIndex);
swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex);
swgScope->getTracesData()->back()->setOfs(traceIt->m_ofs);
swgScope->getTracesData()->back()->setOfsCoarse(traceIt->m_ofsCoarse);
swgScope->getTracesData()->back()->setOfsFine(traceIt->m_ofsFine);
@ -212,8 +212,8 @@ void InterferometerWebAPIAdapter::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].hasTextOverlay").arg(i))) {
scopeSettings.m_tracesData.back().m_hasTextOverlay = traceData->getHasTextOverlay() != 0;
}
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].inputIndex").arg(i))) {
scopeSettings.m_tracesData.back().m_inputIndex = traceData->getInputIndex();
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].streamIndex").arg(i))) {
scopeSettings.m_tracesData.back().m_streamIndex = traceData->getStreamIndex();
}
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].ofs").arg(i))) {
scopeSettings.m_tracesData.back().m_ofs = traceData->getOfs();

View File

@ -89,7 +89,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
swgScope->getTracesData()->back()->setAmp(traceIt->m_amp);
swgScope->getTracesData()->back()->setAmpIndex(traceIt->m_ampIndex);
swgScope->getTracesData()->back()->setHasTextOverlay(traceIt->m_hasTextOverlay ? 1 : 0);
swgScope->getTracesData()->back()->setInputIndex(traceIt->m_inputIndex);
swgScope->getTracesData()->back()->setStreamIndex(traceIt->m_streamIndex);
swgScope->getTracesData()->back()->setOfs(traceIt->m_ofs);
swgScope->getTracesData()->back()->setOfsCoarse(traceIt->m_ofsCoarse);
swgScope->getTracesData()->back()->setOfsFine(traceIt->m_ofsFine);
@ -279,7 +279,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
scopeSettings.m_tracesData.back().m_hasTextOverlay = traceData->getHasTextOverlay() != 0;
}
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].inputIndex").arg(i))) {
scopeSettings.m_tracesData.back().m_inputIndex = traceData->getInputIndex();
scopeSettings.m_tracesData.back().m_streamIndex = traceData->getStreamIndex();
}
if (channelSettingsKeys.contains(QString("scopeConfig.tracesData[%1].ofs").arg(i))) {
scopeSettings.m_tracesData.back().m_ofs = traceData->getOfs();

View File

@ -435,7 +435,7 @@ AISDemodGUI::AISDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
traceDataQ.m_ofsCoarse = 0;
ui->scopeGUI->changeTrace(0, traceDataI);
ui->scopeGUI->addTrace(traceDataQ);
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayXYV);
ui->scopeGUI->setDisplayMode(GLScopeSettings::DisplayXYV);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
GLScopeSettings::TriggerData triggerData;

View File

@ -380,7 +380,7 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de
traceDataQ.m_ofsCoarse = 0;
ui->scopeGUI->changeTrace(0, traceDataI);
ui->scopeGUI->addTrace(traceDataQ);
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayPol);
ui->scopeGUI->setDisplayMode(GLScopeSettings::DisplayPol);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
GLScopeSettings::TriggerData triggerData;

View File

@ -510,7 +510,7 @@ AISModGUI::AISModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
traceDataQ.m_ofsCoarse = 0;
ui->scopeGUI->changeTrace(0, traceDataI);
ui->scopeGUI->addTrace(traceDataQ);
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayPol);
ui->scopeGUI->setDisplayMode(GLScopeSettings::DisplayPol);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
GLScopeSettings::TriggerData triggerData;

View File

@ -35,6 +35,27 @@ GLScopeSettings::GLScopeSettings()
resetToDefaults();
}
GLScopeSettings::GLScopeSettings(const GLScopeSettings& t)
{
resetToDefaults();
for (unsigned int i = 0; i < m_maxNbTraces; i++) {
m_tracesData[i] = t.m_tracesData[i];
}
for (unsigned int i = 0; i < m_maxNbTriggers; i++) {
m_triggersData[i] = t.m_triggersData[i];
}
m_displayMode = t.m_displayMode;
m_traceIntensity = t.m_traceIntensity;
m_gridIntensity = t.m_gridIntensity;
m_time = t.m_time;
m_timeOfs = t.m_timeOfs;
m_traceLen = t.m_traceLen;
m_trigPre = t.m_trigPre;
}
GLScopeSettings::~GLScopeSettings()
{}
@ -218,3 +239,28 @@ bool GLScopeSettings::deserialize(const QByteArray& data)
return false;
}
}
GLScopeSettings& GLScopeSettings::operator=(const GLScopeSettings& t)
{
// Check for self assignment
if (this != &t)
{
for (unsigned int i = 0; i < m_maxNbTraces; i++) {
m_tracesData[i] = t.m_tracesData[i];
}
for (unsigned int i = 0; i < m_maxNbTriggers; i++) {
m_triggersData[i] = t.m_triggersData[i];
}
m_displayMode = t.m_displayMode;
m_traceIntensity = t.m_traceIntensity;
m_gridIntensity = t.m_gridIntensity;
m_time = t.m_time;
m_timeOfs = t.m_timeOfs;
m_traceLen = t.m_traceLen;
m_trigPre = t.m_trigPre;
}
return *this;
}

View File

@ -44,7 +44,6 @@ public:
{
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 trace is associated with
float m_amp; //!< Amplification factor
uint32_t m_ampIndex; //!< Index in list of amplification factors
float m_ofs; //!< Offset factor
@ -81,7 +80,6 @@ public:
{
m_streamIndex = 0;
m_projectionType = Projector::ProjectionReal;
m_inputIndex = 0;
m_amp = 1.0f;
m_ampIndex = 0;
m_ofs = 0.0f;
@ -172,12 +170,14 @@ public:
static const uint32_t m_nbTraceBuffers = 2;
GLScopeSettings();
GLScopeSettings(const GLScopeSettings& t);
virtual ~GLScopeSettings();
void resetToDefaults();
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
GLScopeSettings& operator=(const GLScopeSettings& t);
};

View File

@ -25,15 +25,16 @@
#include "dsp/dspcommands.h"
#include "dsp/glscopeinterface.h"
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVis, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVisNG, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGAddTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGChangeTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGRemoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGAddTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGChangeTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGRemoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisAddTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisChangeTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisRemoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGOneShot, Message)
@ -206,8 +207,11 @@ void ScopeVis::addTrace(const GLScopeSettings::TraceData& traceData)
<< " m_amp: " << traceData.m_amp
<< " m_ofs: " << traceData.m_ofs
<< " m_traceDelay: " << traceData.m_traceDelay;
Message* cmd = MsgScopeVisNGAddTrace::create(traceData);
getInputMessageQueue()->push(cmd);
m_traces.addTrace(traceData, m_traceSize);
initTraceBuffers();
updateMaxTraceDelay();
computeDisplayTriggerLevels();
updateGLScopeDisplay();
}
void ScopeVis::changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
@ -217,16 +221,25 @@ void ScopeVis::changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t
<< " m_amp: " << traceData.m_amp
<< " m_ofs: " << traceData.m_ofs
<< " m_traceDelay: " << traceData.m_traceDelay;
Message* cmd = MsgScopeVisNGChangeTrace::create(traceData, traceIndex);
getInputMessageQueue()->push(cmd);
bool doComputeTriggerLevelsOnDisplay = m_traces.isVerticalDisplayChange(traceData, traceIndex);
m_traces.changeTrace(traceData, traceIndex);
updateMaxTraceDelay();
if (doComputeTriggerLevelsOnDisplay) {
computeDisplayTriggerLevels();
}
updateGLScopeDisplay();
}
void ScopeVis::removeTrace(uint32_t traceIndex)
{
qDebug() << "ScopeVis::removeTrace:"
<< " trace: " << traceIndex;
Message* cmd = MsgScopeVisNGRemoveTrace::create(traceIndex);
getInputMessageQueue()->push(cmd);
m_traces.removeTrace(traceIndex);
updateMaxTraceDelay();
computeDisplayTriggerLevels();
updateGLScopeDisplay();
}
void ScopeVis::moveTrace(uint32_t traceIndex, bool upElseDown)
@ -794,6 +807,13 @@ bool ScopeVis::handleMessage(const Message& message)
qDebug() << "ScopeVis::handleMessage: DSPSignalNotification: m_sampleRate: " << m_sampleRate;
return true;
}
else if (MsgConfigureScopeVis::match(message))
{
QMutexLocker configLocker(&m_mutex);
const MsgConfigureScopeVis& cmd = (const MsgConfigureScopeVis&) message;
applySettings(cmd.getSettings(), cmd.getForce());
return true;
}
else if (MsgConfigureScopeVisNG::match(message))
{
QMutexLocker configLocker(&m_mutex);
@ -952,41 +972,30 @@ bool ScopeVis::handleMessage(const Message& message)
return true;
}
else if (MsgScopeVisNGAddTrace::match(message))
else if (MsgScopeVisAddTrace::match(message))
{
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGAddTrace";
qDebug() << "ScopeVis::handleMessage: MsgScopeVisAddTrace";
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGAddTrace& conf = (MsgScopeVisNGAddTrace&) message;
m_traces.addTrace(conf.getTraceData(), m_traceSize);
initTraceBuffers();
updateMaxTraceDelay();
computeDisplayTriggerLevels();
updateGLScopeDisplay();
MsgScopeVisAddTrace& conf = (MsgScopeVisAddTrace&) message;
addTrace(conf.getTraceData());
return true;
}
else if (MsgScopeVisNGChangeTrace::match(message))
else if (MsgScopeVisChangeTrace::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGChangeTrace& conf = (MsgScopeVisNGChangeTrace&) message;
bool doComputeTriggerLevelsOnDisplay = m_traces.isVerticalDisplayChange(conf.getTraceData(), conf.getTraceIndex());
MsgScopeVisChangeTrace& conf = (MsgScopeVisChangeTrace&) message;
uint32_t traceIndex = conf.getTraceIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGChangeTrace: " << traceIndex;
m_traces.changeTrace(conf.getTraceData(), traceIndex);
updateMaxTraceDelay();
if (doComputeTriggerLevelsOnDisplay) computeDisplayTriggerLevels();
updateGLScopeDisplay();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisRemoveTrace: " << traceIndex;
changeTrace(conf.getTraceData(), traceIndex);
return true;
}
else if (MsgScopeVisNGRemoveTrace::match(message))
else if (MsgScopeVisRemoveTrace::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGRemoveTrace& conf = (MsgScopeVisNGRemoveTrace&) message;
MsgScopeVisRemoveTrace& conf = (MsgScopeVisRemoveTrace&) message;
uint32_t traceIndex = conf.getTraceIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGRemoveTrace: " << traceIndex;
m_traces.removeTrace(traceIndex);
updateMaxTraceDelay();
computeDisplayTriggerLevels();
updateGLScopeDisplay();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisRemoveTrace: " << traceIndex;
removeTrace(traceIndex);
return true;
}
else if (MsgScopeVisNGMoveTrace::match(message))
@ -1072,6 +1081,29 @@ bool ScopeVis::handleMessage(const Message& message)
}
}
void ScopeVis::applySettings(const GLScopeSettings& settings, bool force)
{
(void) force;
if (m_traces.size() > m_settings.m_tracesData.size())
{
for (unsigned int i = m_traces.size(); i > m_settings.m_tracesData.size(); i--) {
removeTrace(i-1);
}
}
for (unsigned int i = 0; i < m_settings.m_tracesData.size(); i++)
{
if (i < m_traces.size()) { // change trace
changeTrace(m_settings.m_tracesData[i], i);
} else { // add trace
addTrace(m_settings.m_tracesData[i]);
}
}
m_settings = settings;
}
void ScopeVis::updateMaxTraceDelay()
{
int maxTraceDelay = 0;

View File

@ -45,153 +45,28 @@ class SpectrumVis;
class SDRBASE_API ScopeVis : public QObject {
Q_OBJECT
public:
ScopeVis();
virtual ~ScopeVis();
void setGLScope(GLScopeInterface* glScope);
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
void setLiveRate(int sampleRate);
void configure(uint32_t nbStreams, uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun);
void addTrace(const GLScopeSettings::TraceData& traceData);
void changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex);
void removeTrace(uint32_t traceIndex);
void moveTrace(uint32_t traceIndex, bool upElseDown);
void focusOnTrace(uint32_t traceIndex);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex);
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
void focusOnTrigger(uint32_t triggerIndex);
void setOneShot(bool oneShot);
void setMemoryIndex(uint32_t memoryIndex);
void setTraceChunkSize(uint32_t chunkSize) { m_traceChunkSize = chunkSize; }
uint32_t getTraceChunkSize() const { return m_traceChunkSize; }
QByteArray serializeMemory() const
{
SimpleSerializer s(1);
s.writeU32(1, m_traceSize);
s.writeU32(2, m_preTriggerDelay);
s.writeS32(3, m_sampleRate);
QByteArray buffer = m_traceDiscreteMemory.serialize();
s.writeBlob(4, buffer);
return s.final();
}
bool deserializeMemory(const QByteArray& data)
{
SimpleDeserializer d(data);
if(!d.isValid()) {
return false;
}
if (d.getVersion() == 1)
{
uint32_t traceSize, preTriggerDelay;
int sampleRate;
QByteArray buf;
bool traceDiscreteMemorySuccess;
d.readU32(1, &traceSize, GLScopeSettings::m_traceChunkDefaultSize);
d.readU32(2, &preTriggerDelay, 0);
d.readS32(3, &sampleRate, 0);
setSampleRate(sampleRate);
setTraceSize(traceSize, true);
setPreTriggerDelay(preTriggerDelay, true);
d.readBlob(4, &buf);
traceDiscreteMemorySuccess = m_traceDiscreteMemory.deserialize(buf);
if (traceDiscreteMemorySuccess && (m_glScope) && (m_currentTraceMemoryIndex > 0)) {
processMemoryTrace();
}
return traceDiscreteMemorySuccess;
}
else
{
return false;
}
}
void getTriggerData(GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
if (triggerIndex < m_triggerConditions.size()) {
triggerData = m_triggerConditions[triggerIndex]->m_triggerData;
}
}
void getTraceData(GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
{
if (traceIndex < m_traces.m_tracesData.size()) {
traceData = m_traces.m_tracesData[traceIndex];
}
}
const GLScopeSettings::TriggerData& getTriggerData(uint32_t triggerIndex) const { return m_triggerConditions[triggerIndex]->m_triggerData; }
const std::vector<GLScopeSettings::TraceData>& getTracesData() const { return m_traces.m_tracesData; }
uint32_t getNbTriggers() const { return m_triggerConditions.size(); }
void feed(const std::vector<SampleVector::const_iterator>& vbegin, int nbSamples);
//virtual void start();
//virtual void stop();
bool handleMessage(const Message& message);
int getTriggerLocation() const { return m_triggerLocation; }
bool getFreeRun() const { return m_freeRun; }
private:
// === messages ===
// ---------------------------------------------
class MsgConfigureScopeVisNG : public Message {
class MsgConfigureScopeVis : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureScopeVisNG* create(
uint32_t nbStreams,
uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun)
const GLScopeSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureScopeVis* create(const GLScopeSettings& settings, bool force)
{
return new MsgConfigureScopeVisNG(nbStreams, traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
return new MsgConfigureScopeVis(settings, force);
}
uint32_t getNbStreams() const { return m_nbStreams; }
uint32_t getTraceSize() const { return m_traceSize; }
uint32_t getTimeBase() const { return m_timeBase; }
uint32_t getTimeOfsProMill() const { return m_timeOfsProMill; }
uint32_t getTriggerPre() const { return m_triggerPre; }
bool getFreeRun() const { return m_freeRun; }
private:
uint32_t m_nbStreams;
uint32_t m_traceSize;
uint32_t m_timeBase;
uint32_t m_timeOfsProMill;
uint32_t m_triggerPre;
bool m_freeRun;
GLScopeSettings m_settings;
bool m_force;
MsgConfigureScopeVisNG(
uint32_t nbStreams,
uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun
) :
m_nbStreams(nbStreams),
m_traceSize(traceSize),
m_timeBase(timeBase),
m_timeOfsProMill(timeOfsProMill),
m_triggerPre(triggerPre),
m_freeRun(freeRun)
{}
MsgConfigureScopeVis(const GLScopeSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
{ }
};
// ---------------------------------------------
@ -307,14 +182,14 @@ private:
};
// ---------------------------------------------
class MsgScopeVisNGAddTrace : public Message {
class MsgScopeVisAddTrace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGAddTrace* create(
static MsgScopeVisAddTrace* create(
const GLScopeSettings::TraceData& traceData)
{
return new MsgScopeVisNGAddTrace(traceData);
return new MsgScopeVisAddTrace(traceData);
}
const GLScopeSettings::TraceData& getTraceData() const { return m_traceData; }
@ -322,20 +197,20 @@ private:
private:
GLScopeSettings::TraceData m_traceData;
MsgScopeVisNGAddTrace(const GLScopeSettings::TraceData& traceData) :
MsgScopeVisAddTrace(const GLScopeSettings::TraceData& traceData) :
m_traceData(traceData)
{}
};
// ---------------------------------------------
class MsgScopeVisNGChangeTrace : public Message {
class MsgScopeVisChangeTrace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGChangeTrace* create(
static MsgScopeVisChangeTrace* create(
const GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
{
return new MsgScopeVisNGChangeTrace(traceData, traceIndex);
return new MsgScopeVisChangeTrace(traceData, traceIndex);
}
const GLScopeSettings::TraceData& getTraceData() const { return m_traceData; }
@ -345,21 +220,21 @@ private:
GLScopeSettings::TraceData m_traceData;
uint32_t m_traceIndex;
MsgScopeVisNGChangeTrace(GLScopeSettings::TraceData traceData, uint32_t traceIndex) :
MsgScopeVisChangeTrace(GLScopeSettings::TraceData traceData, uint32_t traceIndex) :
m_traceData(traceData),
m_traceIndex(traceIndex)
{}
};
// ---------------------------------------------
class MsgScopeVisNGRemoveTrace : public Message {
class MsgScopeVisRemoveTrace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGRemoveTrace* create(
static MsgScopeVisRemoveTrace* create(
uint32_t traceIndex)
{
return new MsgScopeVisNGRemoveTrace(traceIndex);
return new MsgScopeVisRemoveTrace(traceIndex);
}
uint32_t getTraceIndex() const { return m_traceIndex; }
@ -367,7 +242,7 @@ private:
private:
uint32_t m_traceIndex;
MsgScopeVisNGRemoveTrace(uint32_t traceIndex) :
MsgScopeVisRemoveTrace(uint32_t traceIndex) :
m_traceIndex(traceIndex)
{}
};
@ -460,7 +335,152 @@ private:
{}
};
ScopeVis();
virtual ~ScopeVis();
void setGLScope(GLScopeInterface* glScope);
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
void setLiveRate(int sampleRate);
void configure(uint32_t nbStreams, uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun);
void moveTrace(uint32_t traceIndex, bool upElseDown);
void focusOnTrace(uint32_t traceIndex);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex);
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
void focusOnTrigger(uint32_t triggerIndex);
void setOneShot(bool oneShot);
void setMemoryIndex(uint32_t memoryIndex);
void setTraceChunkSize(uint32_t chunkSize) { m_traceChunkSize = chunkSize; }
uint32_t getTraceChunkSize() const { return m_traceChunkSize; }
QByteArray serializeMemory() const
{
SimpleSerializer s(1);
s.writeU32(1, m_traceSize);
s.writeU32(2, m_preTriggerDelay);
s.writeS32(3, m_sampleRate);
QByteArray buffer = m_traceDiscreteMemory.serialize();
s.writeBlob(4, buffer);
return s.final();
}
bool deserializeMemory(const QByteArray& data)
{
SimpleDeserializer d(data);
if(!d.isValid()) {
return false;
}
if (d.getVersion() == 1)
{
uint32_t traceSize, preTriggerDelay;
int sampleRate;
QByteArray buf;
bool traceDiscreteMemorySuccess;
d.readU32(1, &traceSize, GLScopeSettings::m_traceChunkDefaultSize);
d.readU32(2, &preTriggerDelay, 0);
d.readS32(3, &sampleRate, 0);
setSampleRate(sampleRate);
setTraceSize(traceSize, true);
setPreTriggerDelay(preTriggerDelay, true);
d.readBlob(4, &buf);
traceDiscreteMemorySuccess = m_traceDiscreteMemory.deserialize(buf);
if (traceDiscreteMemorySuccess && (m_glScope) && (m_currentTraceMemoryIndex > 0)) {
processMemoryTrace();
}
return traceDiscreteMemorySuccess;
}
else
{
return false;
}
}
void getTriggerData(GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
if (triggerIndex < m_triggerConditions.size()) {
triggerData = m_triggerConditions[triggerIndex]->m_triggerData;
}
}
void getTraceData(GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
{
if (traceIndex < m_traces.m_tracesData.size()) {
traceData = m_traces.m_tracesData[traceIndex];
}
}
const GLScopeSettings::TriggerData& getTriggerData(uint32_t triggerIndex) const { return m_triggerConditions[triggerIndex]->m_triggerData; }
const std::vector<GLScopeSettings::TraceData>& getTracesData() const { return m_traces.m_tracesData; }
uint32_t getNbTriggers() const { return m_triggerConditions.size(); }
uint32_t getNbTraces() const { return m_traces.size(); }
void feed(const std::vector<SampleVector::const_iterator>& vbegin, int nbSamples);
//virtual void start();
//virtual void stop();
bool handleMessage(const Message& message);
int getTriggerLocation() const { return m_triggerLocation; }
bool getFreeRun() const { return m_freeRun; }
private:
// === messages ===
// ---------------------------------------------
class MsgConfigureScopeVisNG : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgConfigureScopeVisNG* create(
uint32_t nbStreams,
uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun)
{
return new MsgConfigureScopeVisNG(nbStreams, traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
}
uint32_t getNbStreams() const { return m_nbStreams; }
uint32_t getTraceSize() const { return m_traceSize; }
uint32_t getTimeBase() const { return m_timeBase; }
uint32_t getTimeOfsProMill() const { return m_timeOfsProMill; }
uint32_t getTriggerPre() const { return m_triggerPre; }
bool getFreeRun() const { return m_freeRun; }
private:
uint32_t m_nbStreams;
uint32_t m_traceSize;
uint32_t m_timeBase;
uint32_t m_timeOfsProMill;
uint32_t m_triggerPre;
bool m_freeRun;
MsgConfigureScopeVisNG(
uint32_t nbStreams,
uint32_t traceSize,
uint32_t timeBase,
uint32_t timeOfsProMill,
uint32_t triggerPre,
bool freeRun
) :
m_nbStreams(nbStreams),
m_traceSize(traceSize),
m_timeBase(timeBase),
m_timeOfsProMill(timeOfsProMill),
m_triggerPre(triggerPre),
m_freeRun(freeRun)
{}
};
/**
* Trigger stuff
@ -984,7 +1004,8 @@ private:
void changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
{
if (traceIndex < m_tracesControl.size()) {
if (traceIndex < m_tracesControl.size())
{
TraceControl *traceControl = m_tracesControl[traceIndex];
traceControl->releaseProjector();
traceControl->initProjector(traceData.m_projectionType);
@ -1076,8 +1097,7 @@ private:
{
evenOddIndex = !evenOddIndex;
for (std::vector<TraceControl*>::iterator it = m_tracesControl.begin(); it != m_tracesControl.end(); ++it)
{
for (std::vector<TraceControl*>::iterator it = m_tracesControl.begin(); it != m_tracesControl.end(); ++it) {
(*it)->m_traceCount[currentBufferIndex()] = 0;
}
}
@ -1090,8 +1110,7 @@ private:
class TriggerComparator
{
public:
TriggerComparator() : m_level(0), m_reset(true)
{
TriggerComparator() : m_level(0), m_reset(true) {
computeLevels();
}
@ -1120,7 +1139,9 @@ private:
if (triggerCondition.m_trues < triggerCondition.m_triggerData.m_triggerHoldoff) {
condition = false;
triggerCondition.m_trues++;
} else {
}
else
{
triggerCondition.m_falses = 0;
}
}
@ -1129,7 +1150,9 @@ private:
if (triggerCondition.m_falses < triggerCondition.m_triggerData.m_triggerHoldoff) {
condition = true;
triggerCondition.m_falses++;
} else {
}
else
{
triggerCondition.m_trues = 0;
}
}
@ -1161,8 +1184,7 @@ private:
return trigger;
}
void reset()
{
void reset() {
m_reset = true;
}
@ -1181,6 +1203,7 @@ private:
GLScopeInterface* m_glScope;
SpectrumVis *m_spectrumVis;
GLScopeSettings m_settings;
MessageQueue m_inputMessageQueue;
MessageQueue *m_messageQueueToGUI;
uint32_t m_preTriggerDelay; //!< Pre-trigger delay in number of samples
@ -1212,6 +1235,12 @@ private:
bool m_triggerWaitForReset; //!< In one shot mode suspended until reset by UI
uint32_t m_currentTraceMemoryIndex; //!< The current index of trace in memory (0: current)
void applySettings(const GLScopeSettings& settings, bool force = false);
void addTrace(const GLScopeSettings::TraceData& traceData);
void changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex);
void removeTrace(uint32_t traceIndex);
/**
* Moves on to the next trigger if any or increments trigger count if in repeat mode
* - If not final it returns true

View File

@ -40,13 +40,15 @@ const double GLScopeGUI::amps[27] = {
GLScopeGUI::GLScopeGUI(QWidget* parent) :
QWidget(parent),
ui(new Ui::GLScopeGUI),
m_messageQueue(0),
m_scopeVis(0),
m_glScope(0),
m_messageQueue(nullptr),
m_scopeVis(nullptr),
m_glScope(nullptr),
m_sampleRate(0),
m_timeBase(1),
m_timeOffset(0),
m_traceLenMult(1)
m_traceLenMult(1),
m_ctlTraceIndex(0),
m_ctlTriggerIndex(0)
{
qDebug("GLScopeGUI::GLScopeGUI");
setEnabled(false);
@ -74,11 +76,6 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc
m_glScope = glScope;
// initialize display combo
ui->onlyX->setChecked(true);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
ui->onlyY->setEnabled(false);
ui->horizontalXY->setEnabled(false);
ui->verticalXY->setEnabled(false);
@ -101,7 +98,8 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc
// Add a trace
GLScopeSettings::TraceData traceData;
fillTraceData(traceData);
m_scopeVis->addTrace(traceData);
ScopeVis::MsgScopeVisAddTrace *msg = ScopeVis::MsgScopeVisAddTrace::create(traceData);
m_scopeVis->getInputMessageQueue()->push(msg);
setEnabled(true);
connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int)));
@ -239,12 +237,12 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);
if(!d.isValid()) {
if (!d.isValid()) {
resetToDefaults();
return false;
}
if(d.getVersion() == 1)
if (d.getVersion() == 1)
{
TraceUIBlocker traceUIBlocker(ui);
TrigUIBlocker trigUIBlocker(ui);
@ -252,42 +250,9 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
uint32_t uintValue;
bool boolValue;
ui->onlyX->setEnabled(false);
ui->onlyY->setEnabled(false);
ui->horizontalXY->setEnabled(false);
ui->verticalXY->setEnabled(false);
ui->polar->setEnabled(false);
ui->traceMode->setCurrentIndex(0);
d.readS32(1, &intValue, (int) GLScope::DisplayX);
m_glScope->setDisplayMode((GLScope::DisplayMode) intValue);
ui->onlyX->setChecked(false);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
switch (m_glScope->getDisplayMode())
{
case GLScope::DisplayY:
ui->onlyY->setChecked(true);
break;
case GLScope::DisplayXYH:
ui->horizontalXY->setChecked(true);
break;
case GLScope::DisplayXYV:
ui->verticalXY->setChecked(true);
break;
case GLScope::DisplayPol:
ui->polar->setChecked(true);
break;
case GLScope::DisplayX:
default:
ui->onlyX->setChecked(true);
break;
}
GLScopeSettings::DisplayMode displayMode = (GLScopeSettings::DisplayMode) intValue;
d.readS32(2, &intValue, 50);
ui->traceIntensity->setValue(intValue);
d.readS32(3, &intValue, 10);
@ -310,7 +275,8 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
while (iTrace > nbTracesSaved) // remove possible traces in excess
{
m_scopeVis->removeTrace(iTrace - 1);
ScopeVis::MsgScopeVisRemoveTrace *msg = ScopeVis::MsgScopeVisRemoveTrace::create(iTrace - 1);
m_scopeVis->getInputMessageQueue()->push(msg);
iTrace--;
}
@ -342,15 +308,16 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
if (iTrace < tracesData.size()) // change existing traces
{
m_scopeVis->changeTrace(traceData, iTrace);
ScopeVis::MsgScopeVisChangeTrace *msg = ScopeVis::MsgScopeVisChangeTrace::create(traceData, iTrace);
m_scopeVis->getInputMessageQueue()->push(msg);
}
else // add new traces
{
m_scopeVis->addTrace(traceData);
ScopeVis::MsgScopeVisAddTrace *msg = ScopeVis::MsgScopeVisAddTrace::create(traceData);
m_scopeVis->getInputMessageQueue()->push(msg);
}
}
ui->trace->setMaximum(nbTracesSaved-1);
ui->trace->setValue(nbTracesSaved-1);
m_glScope->setFocusedTraceIndex(nbTracesSaved-1);
@ -363,12 +330,7 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
setAmpScaleDisplay();
setAmpOfsDisplay();
setTraceDelayDisplay();
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(nbTracesSaved > 1);
ui->horizontalXY->setEnabled(nbTracesSaved > 1);
ui->verticalXY->setEnabled(nbTracesSaved > 1);
ui->polar->setEnabled(nbTracesSaved > 1);
setDisplayMode(displayMode);
// trigger stuff
@ -461,17 +423,16 @@ void GLScopeGUI::on_onlyX_toggled(bool checked)
{
if (checked)
{
m_glScope->setDisplayMode(GLScope::DisplayX);
ui->onlyX->setEnabled(false);
ui->onlyY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->horizontalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->verticalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->polar->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
m_glScope->setDisplayMode(GLScope::DisplayX);
}
else
{
if (!ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) {
ui->polar->setChecked(true);
}
}
}
@ -479,17 +440,16 @@ void GLScopeGUI::on_onlyY_toggled(bool checked)
{
if (checked)
{
m_glScope->setDisplayMode(GLScope::DisplayY);
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(false);
ui->horizontalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->verticalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->polar->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->onlyX->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
m_glScope->setDisplayMode(GLScope::DisplayY);
}
else
{
if (!ui->onlyX->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) {
ui->polar->setChecked(true);
}
}
}
@ -497,17 +457,16 @@ void GLScopeGUI::on_horizontalXY_toggled(bool checked)
{
if (checked)
{
m_glScope->setDisplayMode(GLScope::DisplayXYH);
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->horizontalXY->setEnabled(false);
ui->verticalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->polar->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->onlyX->setChecked(false);
ui->onlyY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
m_glScope->setDisplayMode(GLScope::DisplayXYH);
}
else
{
if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) {
ui->polar->setChecked(true);
}
}
}
@ -515,17 +474,16 @@ void GLScopeGUI::on_verticalXY_toggled(bool checked)
{
if (checked)
{
m_glScope->setDisplayMode(GLScope::DisplayXYV);
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->horizontalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->verticalXY->setEnabled(false);
ui->polar->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->onlyX->setChecked(false);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->polar->setChecked(false);
m_glScope->setDisplayMode(GLScope::DisplayXYV);
}
else
{
if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->polar->isChecked()) {
ui->polar->setChecked(true);
}
}
}
@ -533,17 +491,16 @@ void GLScopeGUI::on_polar_toggled(bool checked)
{
if (checked)
{
m_glScope->setDisplayMode(GLScope::DisplayPol);
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->horizontalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->verticalXY->setEnabled(m_scopeVis->getNbTraces() > 1);
ui->polar->setEnabled(false);
ui->onlyX->setChecked(false);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
m_glScope->setDisplayMode(GLScope::DisplayPol);
}
else
{
if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked()) {
ui->polar->setChecked(true);
}
}
}
@ -634,6 +591,7 @@ void GLScopeGUI::on_trace_valueChanged(int value)
{
ui->traceText->setText(value == 0 ? "X" : QString("Y%1").arg(ui->trace->value()));
m_ctlTraceIndex = value;
GLScopeSettings::TraceData traceData;
m_scopeVis->getTraceData(traceData, value);
@ -665,7 +623,6 @@ void GLScopeGUI::on_traceDel_clicked(bool checked)
if (ui->trace->value() == 0)
{
ui->onlyX->setChecked(true);
ui->onlyY->setEnabled(false);
ui->horizontalXY->setEnabled(false);
ui->verticalXY->setEnabled(false);
@ -673,7 +630,9 @@ void GLScopeGUI::on_traceDel_clicked(bool checked)
m_glScope->setDisplayMode(GLScope::DisplayX);
}
m_scopeVis->removeTrace(ui->trace->value());
ScopeVis::MsgScopeVisRemoveTrace *msg = ScopeVis::MsgScopeVisRemoveTrace::create(ui->trace->value());
m_scopeVis->getInputMessageQueue()->push(msg);
changeCurrentTrace();
}
}
@ -712,6 +671,7 @@ void GLScopeGUI::on_trig_valueChanged(int value)
{
ui->trigText->setText(tr("%1").arg(value));
m_ctlTriggerIndex = value;
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, value);
@ -1326,7 +1286,8 @@ void GLScopeGUI::changeCurrentTrace()
GLScopeSettings::TraceData traceData;
fillTraceData(traceData);
uint32_t currentTraceIndex = ui->trace->value();
m_scopeVis->changeTrace(traceData, currentTraceIndex);
ScopeVis::MsgScopeVisChangeTrace *msg = ScopeVis::MsgScopeVisChangeTrace::create(traceData, currentTraceIndex);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::changeCurrentTrigger()
@ -1382,7 +1343,6 @@ void GLScopeGUI::fillTraceData(GLScopeSettings::TraceData& traceData)
traceData.m_projectionType = (Projector::ProjectionType) ui->traceMode->currentIndex();
traceData.m_hasTextOverlay = (traceData.m_projectionType == Projector::ProjectionMagDB) || (traceData.m_projectionType == Projector::ProjectionMagSq);
traceData.m_textOverlay.clear();
traceData.m_inputIndex = 0;
traceData.m_amp = 0.2 / amps[ui->amp->value()];
traceData.m_ampIndex = ui->amp->value();
@ -1496,8 +1456,40 @@ void GLScopeGUI::setTriggerUI(const GLScopeSettings::TriggerData& triggerData)
ui->trigColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
}
void GLScopeGUI::applySettings()
void GLScopeGUI::applySettings(const GLScopeSettings& settings, bool force)
{
if (m_scopeVis)
{
ScopeVis::MsgConfigureScopeVis *msg = ScopeVis::MsgConfigureScopeVis::create(settings, force);
m_scopeVis->getInputMessageQueue()->push(msg);
}
}
void GLScopeGUI::displaySettings()
{
TraceUIBlocker traceUIBlocker(ui);
TrigUIBlocker trigUIBlocker(ui);
MainUIBlocker mainUIBlocker(ui);
ui->traceText->setText(m_ctlTraceIndex == 0 ? "X" : QString("Y%1").arg(m_ctlTraceIndex));
ui->trace->setValue(m_ctlTraceIndex);
const GLScopeSettings::TraceData& traceData = m_settings.m_tracesData[m_ctlTraceIndex];
setTraceUI(traceData);
ui->trigText->setText(tr("%1").arg(m_ctlTriggerIndex));
ui->trig->setValue(m_ctlTriggerIndex);
const GLScopeSettings::TriggerData& triggerData = m_settings.m_triggersData[m_ctlTriggerIndex];
setTriggerUI(triggerData);
setDisplayMode(m_settings.m_displayMode);
ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(m_settings.m_traceIntensity));
ui->traceIntensity->setValue(m_settings.m_traceIntensity);
m_glScope->setDisplayTraceIntensity(m_settings.m_traceIntensity);
ui->gridIntensity->setToolTip(QString("Grid intensity: %1").arg(m_settings.m_gridIntensity));
ui->gridIntensity->setValue(m_settings.m_gridIntensity);
m_glScope->setDisplayGridIntensity(m_settings.m_gridIntensity);
setTimeScaleDisplay();
ui->timeOfs->setValue(m_settings.m_timeOfs);
setTimeOfsDisplay();
ui->traceLen->setValue(m_traceLenMult);
}
bool GLScopeGUI::handleMessage(Message* message)
@ -1602,33 +1594,54 @@ void GLScopeGUI::MainUIBlocker::unBlock()
// m_ui->traceLen->blockSignals(m_oldStateTraceLen);
}
void GLScopeGUI::setDisplayMode(DisplayMode displayMode)
void GLScopeGUI::setDisplayMode(GLScopeSettings::DisplayMode displayMode)
{
uint32_t nbTraces = m_scopeVis->getNbTraces();
ui->onlyX->setChecked(false);
ui->onlyY->setChecked(false);
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
ui->onlyX->setEnabled(true);
ui->onlyY->setEnabled(nbTraces > 1);
ui->horizontalXY->setEnabled(nbTraces > 1);
ui->verticalXY->setEnabled(nbTraces > 1);
ui->polar->setEnabled(nbTraces > 1);
if (ui->trace->maximum() == 0)
{
ui->onlyX->setChecked(true);
ui->onlyX->setEnabled(false);
}
else
{
switch (displayMode)
{
case DisplayX:
case GLScopeSettings::DisplayX:
ui->onlyX->setChecked(true);
ui->onlyX->setEnabled(false);
break;
case DisplayY:
case GLScopeSettings::DisplayY:
ui->onlyY->setChecked(true);
ui->onlyY->setEnabled(false);
break;
case DisplayXYH:
case GLScopeSettings::DisplayXYH:
ui->horizontalXY->setChecked(true);
ui->horizontalXY->setEnabled(false);
break;
case DisplayXYV:
case GLScopeSettings::DisplayXYV:
ui->verticalXY->setChecked(true);
ui->verticalXY->setEnabled(false);
break;
case DisplayPol:
case GLScopeSettings::DisplayPol:
ui->polar->setChecked(true);
ui->polar->setEnabled(false);
break;
default:
ui->onlyX->setChecked(true);
ui->onlyX->setEnabled(false);
break;
}
}
@ -1690,7 +1703,8 @@ void GLScopeGUI::setPreTrigger(int step)
void GLScopeGUI::changeTrace(int traceIndex, const GLScopeSettings::TraceData& traceData)
{
m_scopeVis->changeTrace(traceData, traceIndex);
ScopeVis::MsgScopeVisChangeTrace *msg = ScopeVis::MsgScopeVisChangeTrace::create(traceData, traceIndex);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::addTrace(const GLScopeSettings::TraceData& traceData)
@ -1705,7 +1719,8 @@ void GLScopeGUI::addTrace(const GLScopeSettings::TraceData& traceData)
ui->polar->setEnabled(true);
}
m_scopeVis->addTrace(traceData);
ScopeVis::MsgScopeVisAddTrace *msg = ScopeVis::MsgScopeVisAddTrace::create(traceData);
m_scopeVis->getInputMessageQueue()->push(msg);
ui->trace->setMaximum(ui->trace->maximum() + 1);
}
}

View File

@ -26,6 +26,7 @@
#include "export.h"
#include "util/message.h"
#include "dsp/scopevis.h"
#include "dsp/glscopesettings.h"
#include "settings/serializable.h"
namespace Ui {
@ -39,14 +40,6 @@ class SDRGUI_API GLScopeGUI : public QWidget, public Serializable {
Q_OBJECT
public:
enum DisplayMode {
DisplayXYH,
DisplayXYV,
DisplayX,
DisplayY,
DisplayPol
};
explicit GLScopeGUI(QWidget* parent = 0);
~GLScopeGUI();
@ -61,7 +54,7 @@ public:
// preconfiguration methods
// global (first line):
void setDisplayMode(DisplayMode displayMode);
void setDisplayMode(GLScopeSettings::DisplayMode displayMode);
void setTraceIntensity(int value);
void setGridIntensity(int value);
void setTimeBase(int step);
@ -147,6 +140,7 @@ private:
MessageQueue* m_messageQueue;
ScopeVis* m_scopeVis;
GLScope* m_glScope;
GLScopeSettings m_settings;
int m_sampleRate;
int m_timeBase;
@ -154,10 +148,13 @@ private:
int m_traceLenMult;
QColor m_focusedTraceColor;
QColor m_focusedTriggerColor;
int m_ctlTraceIndex; //!< controlled trace index
int m_ctlTriggerIndex; //!< controlled trigger index
static const double amps[27];
void applySettings();
void applySettings(const GLScopeSettings& settings, bool force = false);
void displaySettings();
// First row
void setTraceIndexDisplay();
void setTimeScaleDisplay();