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

GLScope: new delta phase displays

This commit is contained in:
f4exb 2015-10-29 09:24:08 +01:00
parent 9641895e68
commit f6b19085fb
4 changed files with 88 additions and 16 deletions

View File

@ -40,6 +40,8 @@ public:
ModeIQ,
ModeMagLinPha,
ModeMagdBPha,
ModeMagLinDPha,
ModeMagdBDPha,
ModeDerived12,
ModeCyclostationary
};
@ -116,6 +118,7 @@ private:
Real m_triggerLevel;
Real m_triggerPre;
int m_nbPow;
Real m_prevArg;
// graphics stuff
QRectF m_glScopeRect1;

View File

@ -37,6 +37,7 @@ GLScope::GLScope(QWidget* parent) :
m_triggerChannel(ScopeVis::TriggerFreeRun),
m_triggerLevel(0.0),
m_triggerPre(0.0),
m_prevArg(0),
m_displayGridIntensity(5),
m_displayTraceIntensity(50),
m_left1ScaleTextureAllocated(false),
@ -393,7 +394,7 @@ void GLScope::paintGL()
v = negLimit;
glVertex2f(i - start, v);
if (m_mode == ModeMagdBPha)
if ((m_mode == ModeMagdBPha) || (m_mode == ModeMagdBDPha))
{
if (i == start)
{
@ -422,7 +423,7 @@ void GLScope::paintGL()
// Paint powers overlays
if (m_mode == ModeMagdBPha)
if ((m_mode == ModeMagdBPha) || (m_mode == ModeMagdBDPha))
{
if (m_nbPow > 0)
{
@ -760,11 +761,9 @@ void GLScope::handleMode()
m_powTrace.resize(m_rawTrace.size());
std::vector<Complex>::iterator dst = m_mathTrace.begin();
std::vector<Real>::iterator powDst = m_powTrace.begin();
//Real mult = (10.0f / log2f(10.0f));
for(std::vector<Complex>::const_iterator src = m_rawTrace.begin(); src != m_rawTrace.end(); ++src) {
Real v = src->real() * src->real() + src->imag() * src->imag();
*powDst++ = v;
//v = (100.0 - m_ofs*100.0 + (mult * log2f(v))) / 100.0; // TODO: first term is the offset
v = (100.0f - m_ofs*100.0f + (10.0f * log10f(v))) / 100.0f; // TODO: first term is the offset
*dst++ = Complex(v, arg(*src) / M_PI);
}
@ -775,6 +774,49 @@ void GLScope::handleMode()
m_ofs2 = 0.0;
break;
}
case ModeMagLinDPha: {
m_mathTrace.resize(m_rawTrace.size());
std::vector<Complex>::iterator dst = m_mathTrace.begin();
Real curArg;
for(std::vector<Complex>::const_iterator src = m_rawTrace.begin(); src != m_rawTrace.end(); ++src)
{
curArg = arg(*src) - m_prevArg;
*dst++ = Complex(abs(*src) - m_ofs/2.0, curArg / M_PI);
m_prevArg = arg(*src);
}
m_displayTrace = &m_mathTrace;
m_amp1 = m_amp;
m_amp2 = 1.0;
m_ofs1 = -1.0 / m_amp1;
m_ofs2 = 0.0;
break;
}
case ModeMagdBDPha: {
m_mathTrace.resize(m_rawTrace.size());
m_powTrace.resize(m_rawTrace.size());
std::vector<Complex>::iterator dst = m_mathTrace.begin();
std::vector<Real>::iterator powDst = m_powTrace.begin();
Real curArg;
for(std::vector<Complex>::const_iterator src = m_rawTrace.begin(); src != m_rawTrace.end(); ++src)
{
Real v = src->real() * src->real() + src->imag() * src->imag();
*powDst++ = v;
v = (100.0f - m_ofs*100.0f + (10.0f * log10f(v))) / 100.0f;
curArg = arg(*src) - m_prevArg;
*dst++ = Complex(v, curArg / M_PI);
m_prevArg = arg(*src);
}
m_displayTrace = &m_mathTrace;
m_amp1 = 2.0 * m_amp;
m_amp2 = 1.0;
m_ofs1 = -1.0 / m_amp1;
m_ofs2 = 0.0;
break;
}
case ModeDerived12: {
if(m_rawTrace.size() > 3) {
m_mathTrace.resize(m_rawTrace.size() - 3);
@ -901,7 +943,9 @@ void GLScope::applyConfig()
}
break;
}
case ModeMagLinPha: {
case ModeMagLinPha:
case ModeMagLinDPha:
{
if (amp_range < 2.0) {
m_y1Scale.setRange(Unit::None, amp_ofs * 500.0, amp_range * 1000.0 + amp_ofs * 500.0);
} else {
@ -910,7 +954,9 @@ void GLScope::applyConfig()
m_y2Scale.setRange(Unit::None, -1.0, 1.0); // Scale to Pi
break;
}
case ModeMagdBPha: {
case ModeMagdBPha:
case ModeMagdBDPha:
{
m_y1Scale.setRange(Unit::Decibel, pow_floor, pow_floor + pow_range);
m_y2Scale.setRange(Unit::AngleDegrees, -1.0, 1.0); // Scale to Pi
break;

View File

@ -262,9 +262,12 @@ void GLScopeGUI::setTrigLevelDisplay()
void GLScopeGUI::setAmpScaleDisplay()
{
if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) {
if ((m_glScope->getDataMode() == GLScope::ModeMagdBPha) || (m_glScope->getDataMode() == GLScope::ModeMagdBDPha))
{
ui->ampText->setText(tr("%1\ndB").arg(amps[m_amplification]*500.0, 0, 'f', 1));
} else {
}
else
{
qreal a = amps[m_amplification]*10.0;
if(a < 0.000001)
@ -280,16 +283,20 @@ void GLScopeGUI::setAmpScaleDisplay()
void GLScopeGUI::setAmpOfsDisplay()
{
if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) {
if ((m_glScope->getDataMode() == GLScope::ModeMagdBPha) || (m_glScope->getDataMode() == GLScope::ModeMagdBDPha))
{
ui->ampOfsText->setText(tr("%1\ndB").arg(m_ampOffset/10.0 - 100.0, 0, 'f', 1));
}
else
{
qreal a;
if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) {
if ((m_glScope->getDataMode() == GLScope::ModeMagLinPha) || (m_glScope->getDataMode() == GLScope::ModeMagLinDPha))
{
a = m_ampOffset/2000.0;
} else {
}
else
{
a = m_ampOffset/1000.0;
}
@ -498,10 +505,16 @@ void GLScopeGUI::on_dataMode_currentIndexChanged(int index)
case 2: // mag(dB)+pha
m_glScope->setMode(GLScope::ModeMagdBPha);
break;
case 3: // derived1+derived2
case 3: // mag(lin)+dPha
m_glScope->setMode(GLScope::ModeMagLinDPha);
break;
case 4: // mag(dB)+dPha
m_glScope->setMode(GLScope::ModeMagdBDPha);
break;
case 5: // derived1+derived2
m_glScope->setMode(GLScope::ModeDerived12);
break;
case 4: // clostationary
case 6: // clostationary
m_glScope->setMode(GLScope::ModeCyclostationary);
break;

View File

@ -79,17 +79,27 @@
</property>
<item>
<property name="text">
<string>1:I 2:Q (linear)</string>
<string>1:I 2:Q (lin)</string>
</property>
</item>
<item>
<property name="text">
<string>1:Mag (linear) 2:Phi</string>
<string>1:Mag (lin) 2:Phi</string>
</property>
</item>
<item>
<property name="text">
<string>1:Mag (dB) 2: Phi</string>
<string>1:Mag (dB) 2:Phi</string>
</property>
</item>
<item>
<property name="text">
<string>1:Mag (lin) 2:dPhi</string>
</property>
</item>
<item>
<property name="text">
<string>1:Mag(dB) 2:dPhi</string>
</property>
</item>
<item>