kopia lustrzana https://github.com/f4exb/sdrangel
GLScope redesign: settings synchro (1)
rodzic
e699099946
commit
5d615e453c
|
@ -26,7 +26,6 @@
|
|||
#include "dsp/glscopeinterface.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVis, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVisNG, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisAddTrigger, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisChangeTrigger, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisRemoveTrigger, Message)
|
||||
|
@ -71,15 +70,18 @@ ScopeVis::ScopeVis() :
|
|||
{
|
||||
setObjectName("ScopeVis");
|
||||
m_traceDiscreteMemory.resize(GLScopeSettings::m_traceChunkDefaultSize); // arbitrary
|
||||
|
||||
for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) {
|
||||
m_projectorCache[i] = 0.0;
|
||||
}
|
||||
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
}
|
||||
|
||||
ScopeVis::~ScopeVis()
|
||||
{
|
||||
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
|
||||
for (std::vector<TriggerCondition*>::iterator it = m_triggerConditions.begin(); it != m_triggerConditions.end(); ++ it) {
|
||||
delete *it;
|
||||
}
|
||||
|
@ -141,17 +143,11 @@ void ScopeVis::configure(
|
|||
)
|
||||
{
|
||||
QMutexLocker configLocker(&m_mutex);
|
||||
// MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
|
||||
|
||||
// uint32_t nbStreams = conf.getNbStreams();
|
||||
// uint32_t traceSize = conf.getTraceSize();
|
||||
// uint32_t timeBase = conf.getTimeBase();
|
||||
// uint32_t timeOfsProMill = conf.getTimeOfsProMill();
|
||||
// uint32_t triggerPre = conf.getTriggerPre();
|
||||
// bool freeRun = conf.getFreeRun();
|
||||
|
||||
if (m_traceSize != traceSize) {
|
||||
if (m_traceSize != traceSize)
|
||||
{
|
||||
setTraceSize(traceSize);
|
||||
m_settings.m_traceLen = traceSize;
|
||||
}
|
||||
|
||||
if (m_nbStreams != nbStreams)
|
||||
|
@ -163,6 +159,7 @@ void ScopeVis::configure(
|
|||
if (m_timeBase != timeBase)
|
||||
{
|
||||
m_timeBase = timeBase;
|
||||
m_settings.m_time = timeBase;
|
||||
|
||||
if (m_glScope) {
|
||||
m_glScope->setTimeBase(m_timeBase);
|
||||
|
@ -172,21 +169,24 @@ void ScopeVis::configure(
|
|||
if (m_timeOfsProMill != timeOfsProMill)
|
||||
{
|
||||
m_timeOfsProMill = timeOfsProMill;
|
||||
m_settings.m_timeOfs = timeOfsProMill;
|
||||
|
||||
if (m_glScope) {
|
||||
m_glScope->setTimeOfsProMill(m_timeOfsProMill);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_preTriggerDelay != triggerPre) {
|
||||
if (m_preTriggerDelay != triggerPre)
|
||||
{
|
||||
setPreTriggerDelay(triggerPre);
|
||||
m_settings.m_trigPre = triggerPre;
|
||||
}
|
||||
|
||||
if (freeRun != m_freeRun) {
|
||||
m_freeRun = freeRun;
|
||||
}
|
||||
|
||||
qDebug() << "ScopeVis::handleMessage: MsgConfigureScopeVisNG:"
|
||||
qDebug() << "ScopeVis::configure:"
|
||||
<< " m_nbStreams: " << m_nbStreams
|
||||
<< " m_traceSize: " << m_traceSize
|
||||
<< " m_timeOfsProMill: " << m_timeOfsProMill
|
||||
|
@ -196,9 +196,24 @@ void ScopeVis::configure(
|
|||
if ((m_glScope) && (m_currentTraceMemoryIndex > 0)) {
|
||||
processMemoryTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Message* cmd = MsgConfigureScopeVisNG::create(nbStreams, traceSize, timeBase, timeOfsProMill, triggerPre, freeRun);
|
||||
// getInputMessageQueue()->push(cmd);
|
||||
void ScopeVis::configure(
|
||||
GLScopeSettings::DisplayMode displayMode,
|
||||
uint32_t traceIntensity,
|
||||
uint32_t gridIntensity
|
||||
)
|
||||
{
|
||||
QMutexLocker configLocker(&m_mutex);
|
||||
|
||||
m_settings.m_displayMode = displayMode;
|
||||
m_settings.m_traceIntensity = traceIntensity;
|
||||
m_settings.m_gridIntensity = gridIntensity;
|
||||
|
||||
qDebug() << "ScopeVis::configure:"
|
||||
<< " displayMode: " << displayMode
|
||||
<< " traceIntensity: " << traceIntensity
|
||||
<< " gridIntensity: " << gridIntensity;
|
||||
}
|
||||
|
||||
void ScopeVis::addTrace(const GLScopeSettings::TraceData& traceData)
|
||||
|
@ -212,6 +227,7 @@ void ScopeVis::addTrace(const GLScopeSettings::TraceData& traceData)
|
|||
updateMaxTraceDelay();
|
||||
computeDisplayTriggerLevels();
|
||||
updateGLScopeDisplay();
|
||||
m_settings.m_tracesData.push_back(traceData);
|
||||
}
|
||||
|
||||
void ScopeVis::changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex)
|
||||
|
@ -230,6 +246,10 @@ void ScopeVis::changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t
|
|||
}
|
||||
|
||||
updateGLScopeDisplay();
|
||||
|
||||
if (traceIndex < m_settings.m_tracesData.size()) {
|
||||
m_settings.m_tracesData[traceIndex] = traceData;
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVis::removeTrace(uint32_t traceIndex)
|
||||
|
@ -240,6 +260,15 @@ void ScopeVis::removeTrace(uint32_t traceIndex)
|
|||
updateMaxTraceDelay();
|
||||
computeDisplayTriggerLevels();
|
||||
updateGLScopeDisplay();
|
||||
|
||||
unsigned int iDest = 0;
|
||||
|
||||
for (unsigned int iSource = 0; iSource < m_settings.m_tracesData.size(); iSource++)
|
||||
{
|
||||
if (iSource != traceIndex) {
|
||||
m_settings.m_tracesData[iDest++] = m_settings.m_tracesData[iSource];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVis::moveTrace(uint32_t traceIndex, bool upElseDown)
|
||||
|
@ -250,6 +279,11 @@ void ScopeVis::moveTrace(uint32_t traceIndex, bool upElseDown)
|
|||
m_traces.moveTrace(traceIndex, upElseDown);
|
||||
computeDisplayTriggerLevels();
|
||||
updateGLScopeDisplay();
|
||||
|
||||
int nextTraceIndex = (traceIndex + (upElseDown ? 1 : -1)) % m_settings.m_tracesData.size();
|
||||
GLScopeSettings::TraceData nextTraceData = m_settings.m_tracesData[nextTraceIndex];
|
||||
m_settings.m_tracesData[nextTraceIndex] = m_settings.m_tracesData[traceIndex];
|
||||
m_settings.m_tracesData[traceIndex] = nextTraceData;
|
||||
}
|
||||
|
||||
void ScopeVis::focusOnTrace(uint32_t traceIndex)
|
||||
|
@ -271,6 +305,7 @@ void ScopeVis::addTrigger(const GLScopeSettings::TriggerData& triggerData)
|
|||
{
|
||||
m_triggerConditions.push_back(new TriggerCondition(triggerData));
|
||||
m_triggerConditions.back()->initProjector();
|
||||
m_settings.m_triggersData.push_back(triggerData);
|
||||
}
|
||||
|
||||
void ScopeVis::changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
|
||||
|
@ -290,6 +325,10 @@ void ScopeVis::changeTrigger(const GLScopeSettings::TriggerData& triggerData, ui
|
|||
updateGLScopeDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
if (triggerIndex < m_settings.m_triggersData.size()) {
|
||||
m_settings.m_triggersData[triggerIndex] = triggerData;
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVis::removeTrigger(uint32_t triggerIndex)
|
||||
|
@ -300,6 +339,15 @@ void ScopeVis::removeTrigger(uint32_t triggerIndex)
|
|||
m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
|
||||
delete triggerCondition;
|
||||
}
|
||||
|
||||
unsigned int iDest = 0;
|
||||
|
||||
for (unsigned int iSource = 0; iSource < m_settings.m_triggersData.size(); iSource++)
|
||||
{
|
||||
if (iSource != triggerIndex) {
|
||||
m_settings.m_triggersData[iDest++] = m_settings.m_triggersData[iSource];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVis::moveTrigger(uint32_t triggerIndex, bool upElseDown)
|
||||
|
@ -317,6 +365,11 @@ void ScopeVis::moveTrigger(uint32_t triggerIndex, bool upElseDown)
|
|||
}
|
||||
|
||||
updateGLScopeDisplay();
|
||||
|
||||
int nextTriggerIndexSettings = (triggerIndex + (upElseDown ? 1 : -1)) % m_settings.m_triggersData.size();
|
||||
GLScopeSettings::TriggerData nextTriggerData = m_settings.m_triggersData[nextTriggerIndexSettings];
|
||||
m_settings.m_triggersData[nextTriggerIndexSettings] = m_settings.m_triggersData[triggerIndex];
|
||||
m_settings.m_triggersData[triggerIndex] = nextTriggerData;
|
||||
}
|
||||
|
||||
void ScopeVis::focusOnTrigger(uint32_t triggerIndex)
|
||||
|
@ -861,67 +914,6 @@ bool ScopeVis::handleMessage(const Message& message)
|
|||
applySettings(cmd.getSettings(), cmd.getForce());
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureScopeVisNG::match(message))
|
||||
{
|
||||
QMutexLocker configLocker(&m_mutex);
|
||||
MsgConfigureScopeVisNG& conf = (MsgConfigureScopeVisNG&) message;
|
||||
|
||||
uint32_t nbStreams = conf.getNbStreams();
|
||||
uint32_t traceSize = conf.getTraceSize();
|
||||
uint32_t timeBase = conf.getTimeBase();
|
||||
uint32_t timeOfsProMill = conf.getTimeOfsProMill();
|
||||
uint32_t triggerPre = conf.getTriggerPre();
|
||||
bool freeRun = conf.getFreeRun();
|
||||
|
||||
if (m_traceSize != traceSize) {
|
||||
setTraceSize(traceSize);
|
||||
}
|
||||
|
||||
if (m_nbStreams != nbStreams)
|
||||
{
|
||||
m_traceDiscreteMemory.setNbStreams(nbStreams);
|
||||
m_nbStreams = nbStreams;
|
||||
}
|
||||
|
||||
if (m_timeBase != timeBase)
|
||||
{
|
||||
m_timeBase = timeBase;
|
||||
|
||||
if (m_glScope) {
|
||||
m_glScope->setTimeBase(m_timeBase);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_timeOfsProMill != timeOfsProMill)
|
||||
{
|
||||
m_timeOfsProMill = timeOfsProMill;
|
||||
|
||||
if (m_glScope) {
|
||||
m_glScope->setTimeOfsProMill(m_timeOfsProMill);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_preTriggerDelay != triggerPre) {
|
||||
setPreTriggerDelay(triggerPre);
|
||||
}
|
||||
|
||||
if (freeRun != m_freeRun) {
|
||||
m_freeRun = freeRun;
|
||||
}
|
||||
|
||||
qDebug() << "ScopeVis::handleMessage: MsgConfigureScopeVisNG:"
|
||||
<< " m_nbStreams: " << m_nbStreams
|
||||
<< " m_traceSize: " << m_traceSize
|
||||
<< " m_timeOfsProMill: " << m_timeOfsProMill
|
||||
<< " m_preTriggerDelay: " << m_preTriggerDelay
|
||||
<< " m_freeRun: " << m_freeRun;
|
||||
|
||||
if ((m_glScope) && (m_currentTraceMemoryIndex > 0)) {
|
||||
processMemoryTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgScopeVisAddTrigger::match(message))
|
||||
{
|
||||
qDebug() << "ScopeVis::handleMessage: MsgScopeVisAddTrigger";
|
||||
|
|
|
@ -45,6 +45,7 @@ class SpectrumVis;
|
|||
class SDRBASE_API ScopeVis : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
// === messages ===
|
||||
// ---------------------------------------------
|
||||
class MsgConfigureScopeVis : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
@ -344,7 +345,19 @@ public:
|
|||
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 configure(
|
||||
uint32_t nbStreams,
|
||||
uint32_t traceSize,
|
||||
uint32_t timeBase,
|
||||
uint32_t timeOfsProMill,
|
||||
uint32_t triggerPre,
|
||||
bool freeRun
|
||||
);
|
||||
void configure(
|
||||
GLScopeSettings::DisplayMode displayMode,
|
||||
uint32_t traceIntensity,
|
||||
uint32_t gridIntensity
|
||||
);
|
||||
void setOneShot(bool oneShot);
|
||||
void setMemoryIndex(uint32_t memoryIndex);
|
||||
void setTraceChunkSize(uint32_t chunkSize) { m_traceChunkSize = chunkSize; }
|
||||
|
@ -426,55 +439,6 @@ public:
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -437,6 +437,12 @@ void GLScopeGUI::on_onlyX_toggled(bool checked)
|
|||
ui->horizontalXY->setChecked(false);
|
||||
ui->verticalXY->setChecked(false);
|
||||
ui->polar->setChecked(false);
|
||||
m_settings.m_displayMode = GLScopeSettings::DisplayX;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,6 +460,12 @@ void GLScopeGUI::on_onlyY_toggled(bool checked)
|
|||
ui->horizontalXY->setChecked(false);
|
||||
ui->verticalXY->setChecked(false);
|
||||
ui->polar->setChecked(false);
|
||||
m_settings.m_displayMode = GLScopeSettings::DisplayY;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,6 +483,12 @@ void GLScopeGUI::on_horizontalXY_toggled(bool checked)
|
|||
ui->onlyY->setChecked(false);
|
||||
ui->verticalXY->setChecked(false);
|
||||
ui->polar->setChecked(false);
|
||||
m_settings.m_displayMode = GLScopeSettings::DisplayXYH;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,6 +506,12 @@ void GLScopeGUI::on_verticalXY_toggled(bool checked)
|
|||
ui->onlyY->setChecked(false);
|
||||
ui->horizontalXY->setChecked(false);
|
||||
ui->polar->setChecked(false);
|
||||
m_settings.m_displayMode = GLScopeSettings::DisplayXYV;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,6 +529,12 @@ void GLScopeGUI::on_polar_toggled(bool checked)
|
|||
ui->onlyY->setChecked(false);
|
||||
ui->horizontalXY->setChecked(false);
|
||||
ui->verticalXY->setChecked(false);
|
||||
m_settings.m_displayMode = GLScopeSettings::DisplayPol;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,12 +552,24 @@ void GLScopeGUI::on_traceIntensity_valueChanged(int value)
|
|||
{
|
||||
ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(value));
|
||||
m_glScope->setDisplayTraceIntensity(value);
|
||||
m_settings.m_traceIntensity = value;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
|
||||
void GLScopeGUI::on_gridIntensity_valueChanged(int value)
|
||||
{
|
||||
ui->gridIntensity->setToolTip(QString("Grid intensity: %1").arg(value));
|
||||
m_glScope->setDisplayGridIntensity(value);
|
||||
m_settings.m_gridIntensity = value;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
|
||||
void GLScopeGUI::on_time_valueChanged(int value)
|
||||
|
@ -1661,6 +1703,13 @@ void GLScopeGUI::setDisplayMode(GLScopeSettings::DisplayMode displayMode)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_settings.m_displayMode = displayMode;
|
||||
m_scopeVis->configure(
|
||||
m_settings.m_displayMode,
|
||||
m_settings.m_traceIntensity,
|
||||
m_settings.m_gridIntensity
|
||||
);
|
||||
}
|
||||
|
||||
void GLScopeGUI::setTraceIntensity(int value)
|
||||
|
|
Ładowanie…
Reference in New Issue