1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 14:21:49 -05:00

GLScope: fixed pi crossing on phase derivative displays

This commit is contained in:
f4exb 2015-10-29 20:46:52 +01:00
parent f6b19085fb
commit 2b2fb4abb2

View File

@ -782,6 +782,16 @@ void GLScope::handleMode()
for(std::vector<Complex>::const_iterator src = m_rawTrace.begin(); src != m_rawTrace.end(); ++src) for(std::vector<Complex>::const_iterator src = m_rawTrace.begin(); src != m_rawTrace.end(); ++src)
{ {
curArg = arg(*src) - m_prevArg; curArg = arg(*src) - m_prevArg;
if (curArg < -M_PI)
{
curArg += 2.0 * M_PI;
}
else if (curArg > M_PI)
{
curArg -= 2.0 * M_PI;
}
*dst++ = Complex(abs(*src) - m_ofs/2.0, curArg / M_PI); *dst++ = Complex(abs(*src) - m_ofs/2.0, curArg / M_PI);
m_prevArg = arg(*src); m_prevArg = arg(*src);
} }
@ -806,6 +816,16 @@ void GLScope::handleMode()
*powDst++ = v; *powDst++ = v;
v = (100.0f - m_ofs*100.0f + (10.0f * log10f(v))) / 100.0f; v = (100.0f - m_ofs*100.0f + (10.0f * log10f(v))) / 100.0f;
curArg = arg(*src) - m_prevArg; curArg = arg(*src) - m_prevArg;
if (curArg < -M_PI)
{
curArg += 2.0 * M_PI;
}
else if (curArg > M_PI)
{
curArg -= 2.0 * M_PI;
}
*dst++ = Complex(v, curArg / M_PI); *dst++ = Complex(v, curArg / M_PI);
m_prevArg = arg(*src); m_prevArg = arg(*src);
} }