1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

New scope: compute trace in ScopeVis only when required by GLScope. Fixed trace and trigger color dialogs

This commit is contained in:
f4exb 2017-02-13 00:17:59 +01:00
parent e32659b86a
commit 710e2b931d
6 changed files with 61 additions and 19 deletions

View File

@ -10,7 +10,7 @@ add_subdirectory(udpsrc)
add_subdirectory(demodwfm)
add_subdirectory(chanalyzer)
add_subdirectory(chanalyzerng)
add_subdirectory(demodatv)
#add_subdirectory(demodatv)
if(LIBDSDCC_FOUND AND LIBMBE_FOUND)
add_subdirectory(demoddsd)

View File

@ -269,6 +269,11 @@ void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const
}
// trace process
if (m_glScope->getDataChanged()) // optimization: process trace only if required by glScope
{
m_triggerState = TriggerUntriggered;
}
if (m_triggerState == TriggerTriggered)
{
int remainder = -1;
@ -306,6 +311,7 @@ void ScopeVisNG::processTrace(const SampleVector::const_iterator& cbegin, const
m_traceDiscreteMemory.current().m_endPoint = mbegin;
m_traceDiscreteMemory.store(); // next memory trace
m_triggerState = TriggerUntriggered;
//if (m_glScope) m_glScope->incrementTraceCounter();
// process remainder recursively
if (remainder != 0)

View File

@ -58,6 +58,8 @@ GLScopeNG::GLScopeNG(QWidget* parent) :
m_powerOverlayFont.setBold(true);
m_powerOverlayFont.setPointSize(font().pointSize()+1);
//m_traceCounter = 0;
}
GLScopeNG::~GLScopeNG()
@ -177,6 +179,11 @@ void GLScopeNG::paintGL()
if(m_configChanged)
applyConfig();
// qDebug("GLScopeNG::paintGL: m_traceCounter: %d", m_traceCounter);
// m_traceCounter = 0;
m_dataChanged = false;
QOpenGLFunctions *glFunctions = QOpenGLContext::currentContext()->functions();
glFunctions->glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glFunctions->glClear(GL_COLOR_BUFFER_BIT);
@ -343,7 +350,10 @@ void GLScopeNG::paintGL()
}
}
m_dataChanged = false;
else if (m_displayMode == DisplayY) // display only traces #1..n
{
}
m_mutex.unlock();
}
@ -425,6 +435,10 @@ void GLScopeNG::applyConfig()
{
setYScale(m_y2Scale, m_highlightedTraceIndex > 0 ? m_highlightedTraceIndex : 1); // if Highlighted trace is #0 (X trace) set it to first Y trace (trace #1)
}
else
{
setYScale(m_y1Scale, 0); // Default to the X trace (trace #0) - If there is only one trace it should not get there (Y displays disabled in the UI)
}
if ((m_displayMode == DisplayX) || (m_displayMode == DisplayY)) // unique display
{

View File

@ -68,6 +68,9 @@ public:
void setDisplayGridIntensity(int intensity);
void setDisplayTraceIntensity(int intensity);
void setFocusedTriggerData(ScopeVisNG::TriggerData& triggerData) { m_focusedTriggerData = triggerData; }
//void incrementTraceCounter() { m_traceCounter++; }
bool getDataChanged() const { return m_dataChanged; }
signals:
void sampleRateChanged(int);
@ -76,6 +79,7 @@ private:
std::vector<ScopeVisNG::TraceData> *m_tracesData;
std::vector<float *> *m_traces;
ScopeVisNG::TriggerData m_focusedTriggerData;
//int m_traceCounter;
uint32_t m_bufferIndex;
DisplayMode m_displayMode;
QTimer m_timer;

View File

@ -64,6 +64,10 @@ void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis,
ui->horizontalXY->setChecked(false);
ui->verticalXY->setChecked(false);
ui->polar->setChecked(false);
ui->onlyY->setEnabled(false);
ui->horizontalXY->setEnabled(false);
ui->verticalXY->setEnabled(false);
ui->polar->setEnabled(false);
m_glScope->setDisplayMode(GLScopeNG::DisplayX);
// initialize trigger combo
@ -337,12 +341,16 @@ void GLScopeNGGUI::on_traceDelay_valueChanged(int value)
void GLScopeNGGUI::on_traceColor_clicked()
{
QColor newColor = QColorDialog::getColor();
m_focusedTraceColor = newColor;
int r,g,b,a;
m_focusedTraceColor.getRgb(&r, &g, &b, &a);
ui->traceColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
changeCurrentTrace();
QColor newColor = QColorDialog::getColor(m_focusedTraceColor);
if (newColor.isValid()) // user clicked OK and selected a color
{
m_focusedTraceColor = newColor;
int r,g,b,a;
m_focusedTraceColor.getRgb(&r, &g, &b, &a);
ui->traceColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
changeCurrentTrace();
}
}
void GLScopeNGGUI::on_trigMode_currentIndexChanged(int index)
@ -422,12 +430,16 @@ void GLScopeNGGUI::on_trigPre_valueChanged(int value)
void GLScopeNGGUI::on_trigColor_clicked()
{
QColor newColor = QColorDialog::getColor();
m_focusedTriggerColor = newColor;
int r,g,b,a;
m_focusedTriggerColor.getRgb(&r, &g, &b, &a);
ui->trigColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
changeCurrentTrigger();
QColor newColor = QColorDialog::getColor(m_focusedTriggerColor);
if (newColor.isValid()) // user clicked "OK"
{
m_focusedTriggerColor = newColor;
int r,g,b,a;
m_focusedTriggerColor.getRgb(&r, &g, &b, &a);
ui->trigColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
changeCurrentTrigger();
}
}
void GLScopeNGGUI::on_trigOneShot_toggled(bool checked)
@ -625,13 +637,13 @@ void GLScopeNGGUI::setTrigLevelDisplay()
}
if(fabs(a) < 0.000001)
ui->trigLevelText->setText(tr("%1\nn").arg(a * 1000000000.0f));
ui->trigLevelText->setText(tr("%1\nn").arg(a * 1000000000.0f, 0, 'f', 2));
else if(fabs(a) < 0.001)
ui->trigLevelText->setText(tr("%1\nµ").arg(a * 1000000.0f));
ui->trigLevelText->setText(tr("%1\nµ").arg(a * 1000000.0f, 0, 'f', 2));
else if(fabs(a) < 1.0)
ui->trigLevelText->setText(tr("%1\nm").arg(a * 1000.0f));
ui->trigLevelText->setText(tr("%1\nm").arg(a * 1000.0f, 0, 'f', 2));
else
ui->trigLevelText->setText(tr("%1").arg(a * 1.0f));
ui->trigLevelText->setText(tr("%1").arg(a * 1.0f, 0, 'f', 2));
}
}

View File

@ -917,6 +917,9 @@ kS/s</string>
<height>16</height>
</size>
</property>
<property name="toolTip">
<string>Current trace color (click to change)</string>
</property>
<property name="text">
<string/>
</property>
@ -1311,7 +1314,7 @@ kS/s</string>
<widget class="QLabel" name="trigLevelText">
<property name="minimumSize">
<size>
<width>36</width>
<width>40</width>
<height>0</height>
</size>
</property>
@ -1529,6 +1532,9 @@ kS/s</string>
<height>16</height>
</size>
</property>
<property name="toolTip">
<string>Current trigger color (click to change)</string>
</property>
<property name="text">
<string/>
</property>