1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 07:35:47 -05:00

Display trigger line in linear magnitude mode

This commit is contained in:
f4exb 2015-07-26 13:06:15 +02:00
parent f06c8e1e58
commit da9d4d7d52
2 changed files with 34 additions and 8 deletions

View File

@ -320,7 +320,11 @@ void GLScope::paintGL()
glPopMatrix(); glPopMatrix();
// paint trigger level // paint trigger level
if(m_triggerChannel == ScopeVis::TriggerChannelI) { if ((m_triggerChannel == ScopeVis::TriggerChannelI)
|| (m_triggerChannel == ScopeVis::TriggerMagLin)
|| (m_triggerChannel == ScopeVis::TriggerMagDb)
)
{
glPushMatrix(); glPushMatrix();
glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0); glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0);
glScalef(m_glScopeRect1.width(), -(m_glScopeRect1.height() / 2) * m_amp1, 1); glScalef(m_glScopeRect1.width(), -(m_glScopeRect1.height() / 2) * m_amp1, 1);
@ -330,8 +334,20 @@ void GLScope::paintGL()
glLineWidth(1.0f); glLineWidth(1.0f);
glColor4f(0, 1, 0, 0.3f); glColor4f(0, 1, 0, 0.3f);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
if (m_triggerChannel == ScopeVis::TriggerChannelI)
{
glVertex2f(0, m_triggerLevel); glVertex2f(0, m_triggerLevel);
glVertex2f(1, m_triggerLevel); glVertex2f(1, m_triggerLevel);
}
else if (m_triggerChannel == ScopeVis::TriggerMagLin)
{
Real y = (m_triggerLevel + 1.0 - (m_ofs / 2.0)) * m_amp1;
//std::cerr << "y=" << y << " ofs=" << m_ofs << std::endl;
glVertex2f(0, (y - 1.0)/m_amp1);
glVertex2f(1, (y - 1.0)/m_amp1);
}
glEnd(); glEnd();
/* /*
glColor4f(0, 0.8f, 0.0, 0.3f); glColor4f(0, 0.8f, 0.0, 0.3f);
@ -492,7 +508,8 @@ void GLScope::paintGL()
glPopMatrix(); glPopMatrix();
// paint trigger level // paint trigger level
if(m_triggerChannel == ScopeVis::TriggerPhase) { if((m_triggerChannel == ScopeVis::TriggerPhase) || (m_triggerChannel == ScopeVis::TriggerChannelQ))
{
glPushMatrix(); glPushMatrix();
glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0); glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0);
glScalef(m_glScopeRect2.width(), -(m_glScopeRect2.height() / 2) * m_amp2, 1); glScalef(m_glScopeRect2.width(), -(m_glScopeRect2.height() / 2) * m_amp2, 1);

View File

@ -201,14 +201,17 @@ void GLScopeGUI::applyTriggerSettings()
quint32 preTriggerSamples = (m_glScope->getTraceSize() * m_triggerPre) / 100; quint32 preTriggerSamples = (m_glScope->getTraceSize() * m_triggerPre) / 100;
if (m_triggerChannel == ScopeVis::TriggerMagDb) { if (m_triggerChannel == ScopeVis::TriggerMagDb) {
triggerLevel = m_triggerLevel/10.0 - 100.0; triggerLevel = m_triggerLevel/10.0 - 100.0; // [-200.0, 0.0]
}
else if (m_triggerChannel == ScopeVis::TriggerMagLin) {
triggerLevel = 1.0 + (m_triggerLevel / 1000.0); // [0.0, 2.0]
} }
else { else {
triggerLevel = m_triggerLevel / 1000.0; triggerLevel = m_triggerLevel / 1000.0; // [-1.0, 1.0]
} }
m_glScope->setTriggerChannel((ScopeVis::TriggerChannel) m_triggerChannel); m_glScope->setTriggerChannel((ScopeVis::TriggerChannel) m_triggerChannel);
m_glScope->setTriggerLevel(m_triggerLevel / 1000.0); m_glScope->setTriggerLevel(m_triggerLevel / 1000.0); // [-1.0, 1.0]
m_scopeVis->configure(m_messageQueue, m_scopeVis->configure(m_messageQueue,
(ScopeVis::TriggerChannel) m_triggerChannel, (ScopeVis::TriggerChannel) m_triggerChannel,
@ -227,7 +230,13 @@ void GLScopeGUI::setTrigLevelDisplay()
} }
else else
{ {
qreal a = m_triggerLevel / 1000.0; qreal a;
if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) {
a = 1.0 + (m_triggerLevel/1000.0);
} else {
a = m_triggerLevel/1000.0;
}
if(fabs(a) < 0.000001) if(fabs(a) < 0.000001)
ui->trigText->setText(tr("%1\nn").arg(a * 1000000000.0)); ui->trigText->setText(tr("%1\nn").arg(a * 1000000000.0));