GLScope: IQ linear and IQ polar displays

pull/6/head
f4exb 2015-11-06 06:20:52 +01:00
rodzic 2726625e97
commit f8e6cc6cce
4 zmienionych plików z 79 dodań i 67 usunięć

Wyświetl plik

@ -179,6 +179,7 @@ For Debian Jessie or Stretch:
- Scope: trace history
- Scope: trigger countdown
- Scope: multiple trigger chaining
- Scope: new mode with linear IQ (two traces) on the primary display and polar IQ on the secondary display
<h2>Major redesign</h2>

Wyświetl plik

@ -670,32 +670,71 @@ void GLScope::paintGL()
// paint trace #2
if(m_displayTrace->size() > 0) {
glPushMatrix();
glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0);
glScalef(m_glScopeRect2.width() * (float)m_timeBase / (float)(m_displayTrace->size() - 1), -(m_glScopeRect2.height() / 2) * m_amp2, 1);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f);
glColor4f(1, 1, 0.25f, m_displayTraceIntensity / 100.0);
int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2)
start--;
float posLimit = 1.0 / m_amp2;
float negLimit = -1.0 / m_amp2;
glBegin(GL_LINE_STRIP);
for(int i = start; i < end; i++) {
float v = (*m_displayTrace)[i].imag();
if(v > posLimit)
v = posLimit;
else if(v < negLimit)
v = negLimit;
glVertex2f(i - start, v);
if (m_mode == ModeIQPolar)
{
glPushMatrix();
glTranslatef(m_glScopeRect2.x() + m_glScopeRect2.width() / 2.0, m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0);
glScalef(m_glScopeRect2.width() / 2, -(m_glScopeRect2.height() / 2), 1);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1.0f);
glColor4f(1, 1, 0.25f, m_displayTraceIntensity / 100.0);
int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2)
start--;
glBegin(GL_LINE_STRIP);
for(int i = start; i < end; i++)
{
float x = (*m_displayTrace)[i].real() * m_amp1;
float y = (*m_displayTrace)[i].imag() * m_amp2;
if(x > 1.0f)
x = 1.0f;
else if(x < -1.0f)
x = -1.0f;
if(y > 1.0f)
y = 1.0f;
else if(y < -1.0f)
y = -1.0f;
glVertex2f(x, y);
}
glEnd();
glPopMatrix();
}
else
{
glPushMatrix();
glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0);
glScalef(m_glScopeRect2.width() * (float)m_timeBase / (float)(m_displayTrace->size() - 1), -(m_glScopeRect2.height() / 2) * m_amp2, 1);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f);
glColor4f(1, 1, 0.25f, m_displayTraceIntensity / 100.0);
int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2)
start--;
float posLimit = 1.0 / m_amp2;
float negLimit = -1.0 / m_amp2;
glBegin(GL_LINE_STRIP);
for(int i = start; i < end; i++) {
float v = (*m_displayTrace)[i].imag();
if(v > posLimit)
v = posLimit;
else if(v < negLimit)
v = negLimit;
glVertex2f(i - start, v);
}
glEnd();
//glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
glEnd();
//glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
} // Both displays or secondary display only

Wyświetl plik

@ -110,15 +110,9 @@ QByteArray GLScopeGUI::serialize() const
s.writeS32(6, m_displayGridIntensity);
s.writeS32(7, m_amp1OffsetCoarse);
s.writeS32(8, m_displays);
//s.writeS32(9, m_triggerChannel);
//s.writeS32(10, m_triggerLevelCoarse);
//s.writeBool(11, m_triggerPositiveEdge);
s.writeS32(12, m_displayTraceIntensity);
s.writeS32(13, m_triggerPre);
s.writeS32(14, m_traceLenMult);
//s.writeS32(15, m_triggerDelay);
//s.writeBool(16, m_triggerBothEdges);
//s.writeS32(17, m_triggerLevelFine);
s.writeS32(18, m_amp1OffsetFine);
s.writeS32(19, m_amplification2);
s.writeS32(20, m_amp2OffsetCoarse);
@ -158,11 +152,6 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
m_timeBase = 1;
d.readS32(7, &m_amp1OffsetCoarse, 0);
d.readS32(8, &m_displays, GLScope::DisplayBoth);
//d.readS32(9, &m_triggerChannel, ScopeVis::TriggerFreeRun);
//ui->trigMode->setCurrentIndex(m_triggerChannel);
//d.readS32(10, &m_triggerLevelCoarse, 0);
//ui->trigLevelCoarse->setValue(m_triggerLevelCoarse);
//d.readBool(11, &m_triggerPositiveEdge, true);
d.readS32(12, &m_displayTraceIntensity, 50);
d.readS32(13, &m_triggerPre, 0);
ui->trigPre->setValue(m_triggerPre);
@ -170,24 +159,7 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
d.readS32(14, &m_traceLenMult, 20);
ui->traceLen->setValue(m_traceLenMult);
setTraceLenDisplay();
//d.readS32(15, &m_triggerDelay, 0);
//ui->trigDelay->setValue(m_triggerDelay);
setTrigDelayDisplay();
//d.readBool(16, &m_triggerBothEdges, false);
/*
if (m_triggerBothEdges) {
ui->slopePos->setChecked(false);
ui->slopeNeg->setChecked(false);
ui->slopeBoth->setChecked(true);
} else {
ui->slopeBoth->setChecked(false);
ui->slopePos->setChecked(m_triggerPositiveEdge);
ui->slopeNeg->setChecked(!m_triggerPositiveEdge);
}*/
//d.readS32(17, &m_triggerLevelFine, 0);
//ui->trigLevelFine->setValue(m_triggerLevelFine);
d.readS32(18, &m_amp1OffsetFine, 0);
d.readS32(19, &m_amplification2, 0);
d.readS32(20, &m_amp2OffsetCoarse, 0);
@ -673,26 +645,26 @@ void GLScopeGUI::on_dataMode_currentIndexChanged(int index)
case 0: // i+q
m_glScope->setMode(GLScope::ModeIQ);
break;
case 1: // mag(lin)+pha
case 1: // clostationary
m_glScope->setMode(GLScope::ModeIQPolar);
break;
case 2: // mag(lin)+pha
m_glScope->setMode(GLScope::ModeMagLinPha);
break;
case 2: // mag(dB)+pha
case 3: // mag(dB)+pha
m_glScope->setMode(GLScope::ModeMagdBPha);
break;
case 3: // mag(lin)+dPha
case 4: // mag(lin)+dPha
m_glScope->setMode(GLScope::ModeMagLinDPha);
break;
case 4: // mag(dB)+dPha
case 5: // mag(dB)+dPha
m_glScope->setMode(GLScope::ModeMagdBDPha);
break;
case 5: // derived1+derived2
case 6: // derived1+derived2
m_glScope->setMode(GLScope::ModeDerived12);
break;
case 6: // clostationary
m_glScope->setMode(GLScope::ModeCyclostationary);
break;
case 7: // clostationary
m_glScope->setMode(GLScope::ModeIQPolar);
m_glScope->setMode(GLScope::ModeCyclostationary);
break;
default:

Wyświetl plik

@ -82,6 +82,11 @@
<string>1:I 2:Q (lin)</string>
</property>
</item>
<item>
<property name="text">
<string>1:IQ (lin) 2:IQ (pol)</string>
</property>
</item>
<item>
<property name="text">
<string>1:Mag (lin) 2:Phi</string>
@ -112,11 +117,6 @@
<string>1,2:Cyclostationary</string>
</property>
</item>
<item>
<property name="text">
<string>1:IQ (lin) 2:IQ (pol)</string>
</property>
</item>
</widget>
</item>
<item>