Make stats gathering conditional on Modes.stats
There is a quite complex if/else construct for gathering statistics inside the main decodeModeS loop. To speed the loop up when not gathering statistics, make the whole construct conditional on Modes.stat being set. Also tidy up a few comments
This commit is contained in:
parent
2e21367f85
commit
a296f2783f
34
dump1090.c
34
dump1090.c
|
@ -2021,25 +2021,25 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
|
||||||
// Decode the received message
|
// Decode the received message
|
||||||
decodeModesMessage(&mm, msg);
|
decodeModesMessage(&mm, msg);
|
||||||
|
|
||||||
/* Update statistics. */
|
// Update statistics
|
||||||
if (mm.crcok || use_correction) {
|
if (Modes.stats) {
|
||||||
if (errors == 0) Modes.stat_demodulated++;
|
if (mm.crcok || use_correction) {
|
||||||
if (mm.errorbit == -1) {
|
if (errors == 0) Modes.stat_demodulated++;
|
||||||
if (mm.crcok)
|
if (mm.errorbit == -1) {
|
||||||
Modes.stat_goodcrc++;
|
if (mm.crcok) {Modes.stat_goodcrc++;}
|
||||||
else
|
else {Modes.stat_badcrc++;}
|
||||||
|
} else {
|
||||||
Modes.stat_badcrc++;
|
Modes.stat_badcrc++;
|
||||||
} else {
|
Modes.stat_fixed++;
|
||||||
Modes.stat_badcrc++;
|
if (mm.errorbit < MODES_LONG_MSG_BITS)
|
||||||
Modes.stat_fixed++;
|
{Modes.stat_single_bit_fix++;}
|
||||||
if (mm.errorbit < MODES_LONG_MSG_BITS)
|
else
|
||||||
Modes.stat_single_bit_fix++;
|
{Modes.stat_two_bits_fix++;}
|
||||||
else
|
}
|
||||||
Modes.stat_two_bits_fix++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output debug mode info if needed. */
|
// Output debug mode info if needed
|
||||||
if (use_correction) {
|
if (use_correction) {
|
||||||
if (Modes.debug & MODES_DEBUG_DEMOD)
|
if (Modes.debug & MODES_DEBUG_DEMOD)
|
||||||
dumpRawMessage("Demodulated with 0 errors", msg, m, j);
|
dumpRawMessage("Demodulated with 0 errors", msg, m, j);
|
||||||
|
@ -2052,7 +2052,7 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
|
||||||
dumpRawMessage("Decoded with good CRC", msg, m, j);
|
dumpRawMessage("Decoded with good CRC", msg, m, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip this message if we are sure it's fine. */
|
// Skip this message if we are sure it's fine
|
||||||
if (mm.crcok) {
|
if (mm.crcok) {
|
||||||
j += (MODES_PREAMBLE_US+msglen)*2;
|
j += (MODES_PREAMBLE_US+msglen)*2;
|
||||||
good_message = 1;
|
good_message = 1;
|
||||||
|
@ -2060,7 +2060,7 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
|
||||||
mm.phase_corrected = 1;
|
mm.phase_corrected = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass data to the next layer */
|
// Pass data to the next layer
|
||||||
useModesMessage(&mm);
|
useModesMessage(&mm);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue