From 763d4865143c34cdf6a8646d22271afc522787fd Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 23 Feb 2017 08:18:03 +0100 Subject: [PATCH] Mew scope: trace memory interim state (1) --- sdrbase/dsp/scopevisng.cpp | 14 +++++++++++++- sdrbase/dsp/scopevisng.h | 23 ++++++++++++++++++++++ sdrbase/gui/glscopenggui.cpp | 37 ++++++++++++++++++++++++++++++++++++ sdrbase/gui/glscopenggui.h | 2 ++ 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/scopevisng.cpp b/sdrbase/dsp/scopevisng.cpp index d04ef9df0..7fbc871ff 100644 --- a/sdrbase/dsp/scopevisng.cpp +++ b/sdrbase/dsp/scopevisng.cpp @@ -32,6 +32,7 @@ MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGOneShot, Message) +MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGMemoryTrace, Message) const uint ScopeVisNG::m_traceChunkSize = 4800; @@ -50,7 +51,7 @@ ScopeVisNG::ScopeVisNG(GLScopeNG* glScope) : m_zTraceIndex(-1), m_timeOfsProMill(0), m_sampleRate(0), - m_traceDiscreteMemory(10), + m_traceDiscreteMemory(m_nbTraceMemories), m_freeRun(true), m_maxTraceDelay(0), m_triggerOneShot(false), @@ -145,6 +146,12 @@ void ScopeVisNG::setOneShot(bool oneShot) getInputMessageQueue()->push(cmd); } +void ScopeVisNG::setMemoryIndex(uint32_t memoryIndex) +{ + Message* cmd = MsgScopeVisNGMemoryTrace::create(memoryIndex); + getInputMessageQueue()->push(cmd); +} + void ScopeVisNG::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly) { if (m_freeRun) { @@ -627,6 +634,11 @@ bool ScopeVisNG::handleMessage(const Message& message) m_triggerOneShot = oneShot; if (m_triggerWaitForReset && !oneShot) m_triggerWaitForReset = false; } + else if (MsgScopeVisNGMemoryTrace::match(message)) + { + MsgScopeVisNGMemoryTrace& conf = (MsgScopeVisNGMemoryTrace&) message; + uint32_t memoryIndex = conf.getMemoryIndex(); + } else { return false; diff --git a/sdrbase/dsp/scopevisng.h b/sdrbase/dsp/scopevisng.h index 69e63cb58..c2370a558 100644 --- a/sdrbase/dsp/scopevisng.h +++ b/sdrbase/dsp/scopevisng.h @@ -145,6 +145,7 @@ public: static const uint32_t m_traceChunkSize; static const uint32_t m_maxNbTriggers = 10; static const uint32_t m_maxNbTraces = 10; + static const uint32_t m_nbTraceMemories = 16; ScopeVisNG(GLScopeNG* glScope = 0); virtual ~ScopeVisNG(); @@ -160,6 +161,7 @@ public: void removeTrigger(uint32_t triggerIndex); void focusOnTrigger(uint32_t triggerIndex); void setOneShot(bool oneShot); + void setMemoryIndex(uint32_t memoryIndex); void getTriggerData(TriggerData& triggerData, uint32_t triggerIndex) { @@ -420,6 +422,27 @@ private: {} }; + // --------------------------------------------- + class MsgScopeVisNGMemoryTrace : public Message { + MESSAGE_CLASS_DECLARATION + + public: + static MsgScopeVisNGMemoryTrace* create( + uint32_t memoryIndex) + { + return new MsgScopeVisNGMemoryTrace(memoryIndex); + } + + bool getMemoryIndex() const { return m_memoryIndex; } + + private: + uint32_t m_memoryIndex; + + MsgScopeVisNGMemoryTrace(uint32_t memoryIndex) : + m_memoryIndex(memoryIndex) + {} + }; + // --------------------------------------------- /** diff --git a/sdrbase/gui/glscopenggui.cpp b/sdrbase/gui/glscopenggui.cpp index e9a1aa6a2..7f4397970 100644 --- a/sdrbase/gui/glscopenggui.cpp +++ b/sdrbase/gui/glscopenggui.cpp @@ -44,6 +44,7 @@ GLScopeNGGUI::GLScopeNGGUI(QWidget* parent) : ui->trigColor->setStyleSheet("QLabel { background-color : rgb(0,255,0); }"); m_focusedTriggerColor.setRgb(0,255,0); ui->traceText->setText("X"); // TODO: remove when more than 2 traces are supported + ui->mem->setMaximum(ScopeVisNG::m_nbTraceMemories - 1); } GLScopeNGGUI::~GLScopeNGGUI() @@ -663,6 +664,22 @@ void GLScopeNGGUI::on_traceColor_clicked() } } +void GLScopeNGGUI::on_mem_valueChanged(int value) +{ + QString text; + text.sprintf("%02d", value); + ui->memText->setText(text); + + if (value > 0) + { + disableLiveMode(true); // block trigger UI line + } + else + { + disableLiveMode(false); // unblock trigger UI line + } +} + void GLScopeNGGUI::on_trigMode_currentIndexChanged(int index) { setTrigLevelDisplay(); @@ -1074,6 +1091,26 @@ void GLScopeNGGUI::fillProjectionCombo(QComboBox* comboBox) comboBox->addItem("dPhi", ScopeVisNG::ProjectionDPhase); } +void GLScopeNGGUI::disableLiveMode(bool disable) +{ + ui->traceLen->setEnabled(!disable); + ui->trig->setEnabled(!disable); + ui->trigAdd->setEnabled(!disable); + ui->trigDel->setEnabled(!disable); + ui->trigMode->setEnabled(!disable); + ui->trigCount->setEnabled(!disable); + ui->trigPos->setEnabled(!disable); + ui->trigNeg->setEnabled(!disable); + ui->trigBoth->setEnabled(!disable); + ui->trigLevelCoarse->setEnabled(!disable); + ui->trigLevelFine->setEnabled(!disable); + ui->trigDelayCoarse->setEnabled(!disable); + ui->trigDelayFine->setEnabled(!disable); + ui->trigPre->setEnabled(!disable); + ui->trigOneShot->setEnabled(!disable); + ui->freerun->setEnabled(!disable); +} + void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData) { traceData.m_projectionType = (ScopeVisNG::ProjectionType) ui->traceMode->currentIndex(); diff --git a/sdrbase/gui/glscopenggui.h b/sdrbase/gui/glscopenggui.h index 6ab247143..fb4ba52fb 100644 --- a/sdrbase/gui/glscopenggui.h +++ b/sdrbase/gui/glscopenggui.h @@ -156,6 +156,7 @@ private: void setTraceUI(ScopeVisNG::TraceData& traceData); void fillProjectionCombo(QComboBox* comboBox); + void disableLiveMode(bool disable); private slots: void on_scope_sampleRateChanged(int value); @@ -181,6 +182,7 @@ private slots: void on_traceDelayCoarse_valueChanged(int value); void on_traceDelayFine_valueChanged(int value); void on_traceColor_clicked(); + void on_mem_valueChanged(int value); // Third row void on_trig_valueChanged(int value); void on_trigAdd_clicked(bool checked);