M17: Demodulator: reduce indentation levels
Removed some indentation levels in M17Demodulator::update function body, no functional change. Signed-off-by: Silvano Seva <silseva@fastwebnet.it>
This commit is contained in:
parent
1c50bf8bad
commit
7b633c5bee
|
|
@ -235,8 +235,9 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
|
|
||||||
// Read samples from the ADC
|
// Read samples from the ADC
|
||||||
dataBlock_t baseband = inputStream_getData(basebandId);
|
dataBlock_t baseband = inputStream_getData(basebandId);
|
||||||
if(baseband.data != NULL)
|
if(baseband.data == NULL)
|
||||||
{
|
return false;
|
||||||
|
|
||||||
// Process samples
|
// Process samples
|
||||||
for(size_t i = 0; i < baseband.len; i++)
|
for(size_t i = 0; i < baseband.len; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -307,9 +308,10 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
|
|
||||||
case DemodState::LOCKED:
|
case DemodState::LOCKED:
|
||||||
{
|
{
|
||||||
|
if(sampleIndex != samplingPoint)
|
||||||
|
break;
|
||||||
|
|
||||||
// Quantize and update frame at each sampling point
|
// Quantize and update frame at each sampling point
|
||||||
if(sampleIndex == samplingPoint)
|
|
||||||
{
|
|
||||||
updateFrame(sample);
|
updateFrame(sample);
|
||||||
|
|
||||||
// When we have reached almost the end of a frame, switch
|
// When we have reached almost the end of a frame, switch
|
||||||
|
|
@ -320,7 +322,6 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
syncCount = SYNCWORD_SAMPLES * 2;
|
syncCount = SYNCWORD_SAMPLES * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DemodState::SYNC_UPDATE:
|
case DemodState::SYNC_UPDATE:
|
||||||
|
|
@ -333,10 +334,8 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
int32_t syncThresh = static_cast< int32_t >(corrThreshold * 33.0f);
|
int32_t syncThresh = static_cast< int32_t >(corrThreshold * 33.0f);
|
||||||
int8_t syncStatus = streamSync.update(correlator, syncThresh, -syncThresh);
|
int8_t syncStatus = streamSync.update(correlator, syncThresh, -syncThresh);
|
||||||
|
|
||||||
if(syncStatus != 0)
|
|
||||||
{
|
|
||||||
// Correlation has to coincide with a syncword!
|
// Correlation has to coincide with a syncword!
|
||||||
if(frameIndex == M17_SYNCWORD_SYMBOLS)
|
if((syncStatus != 0) && (frameIndex == M17_SYNCWORD_SYMBOLS))
|
||||||
{
|
{
|
||||||
uint8_t hd = hammingDistance((*demodFrame)[0], STREAM_SYNC_WORD[0]);
|
uint8_t hd = hammingDistance((*demodFrame)[0], STREAM_SYNC_WORD[0]);
|
||||||
hd += hammingDistance((*demodFrame)[1], STREAM_SYNC_WORD[1]);
|
hd += hammingDistance((*demodFrame)[1], STREAM_SYNC_WORD[1]);
|
||||||
|
|
@ -352,7 +351,6 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// No syncword found within the window, increase the count
|
// No syncword found within the window, increase the count
|
||||||
// of missed syncs and choose where to go. The lock is lost
|
// of missed syncs and choose where to go. The lock is lost
|
||||||
|
|
@ -380,7 +378,6 @@ bool M17Demodulator::update(const bool invertPhase)
|
||||||
sampleCount += 1;
|
sampleCount += 1;
|
||||||
sampleIndex = (sampleIndex + 1) % SAMPLES_PER_SYMBOL;
|
sampleIndex = (sampleIndex + 1) % SAMPLES_PER_SYMBOL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return newFrame;
|
return newFrame;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue