1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 05:22:25 -04:00

New scope: set a reference to trace count for better code clarity

This commit is contained in:
f4exb 2017-02-26 05:13:21 +01:00
parent b3cb4d3f70
commit 9a48e8b090

View File

@ -412,6 +412,7 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
{ {
SampleVector::const_iterator begin(cbegin); SampleVector::const_iterator begin(cbegin);
int shift = (m_timeOfsProMill / 1000.0) * m_traceSize; int shift = (m_timeOfsProMill / 1000.0) * m_traceSize;
int length = m_traceSize / m_timeBase;
while ((begin < end) && (m_nbSamples > 0)) while ((begin < end) && (m_nbSamples > 0))
{ {
@ -429,6 +430,7 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
if (itCtl->m_traceCount[m_traces.currentBufferIndex()] < m_traceSize) if (itCtl->m_traceCount[m_traces.currentBufferIndex()] < m_traceSize)
{ {
int& traceCount = itCtl->m_traceCount[m_traces.currentBufferIndex()]; // reference for code clarity
float v; float v;
if (projectionType == ProjectionMagLin) if (projectionType == ProjectionMagLin)
@ -444,7 +446,7 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
float p = pdB - (100.0f * itData->m_ofs); float p = pdB - (100.0f * itData->m_ofs);
v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f; v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f;
if (itCtl->m_nbPow == 0) if ((traceCount - shift) == 0)
{ {
itCtl->m_maxPow = -200.0f; itCtl->m_maxPow = -200.0f;
itCtl->m_sumPow = 0.0f; itCtl->m_sumPow = 0.0f;
@ -481,10 +483,10 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
v = -1.0f; v = -1.0f;
} }
(*itTrace)[2*(itCtl->m_traceCount[m_traces.currentBufferIndex()])] (*itTrace)[2*traceCount]
= (itCtl->m_traceCount[m_traces.currentBufferIndex()] - shift); // display x = traceCount - shift; // display x
(*itTrace)[2*(itCtl->m_traceCount[m_traces.currentBufferIndex()]) + 1] = v; // display y (*itTrace)[2*traceCount + 1] = v; // display y
itCtl->m_traceCount[m_traces.currentBufferIndex()]++; traceCount++;
} }
else else
{ {
@ -723,7 +725,6 @@ bool ScopeVisNG::handleMessage(const Message& message)
} }
} }
void ScopeVisNG::updateMaxTraceDelay() void ScopeVisNG::updateMaxTraceDelay()
{ {
int maxTraceDelay = 0; int maxTraceDelay = 0;