Always use phase enhancement; silently ignore --phase-enhance if given.
This commit is contained in:
parent
93c135ea66
commit
d419b62a65
3
debian/config-template
vendored
3
debian/config-template
vendored
|
@ -34,9 +34,6 @@ PPM=
|
||||||
# If yes, enable sampling at 2.4MHz. Otherwise, 2.0MHz is used.
|
# If yes, enable sampling at 2.4MHz. Otherwise, 2.0MHz is used.
|
||||||
OVERSAMPLE=
|
OVERSAMPLE=
|
||||||
|
|
||||||
# If yes, enables phase-enhancement of messages
|
|
||||||
PHASE_ENHANCE=
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Decoding options
|
# Decoding options
|
||||||
#
|
#
|
||||||
|
|
1
debian/dump1090-mutability.config
vendored
1
debian/dump1090-mutability.config
vendored
|
@ -26,7 +26,6 @@ if [ -e $CONFIGFILE ]; then
|
||||||
db_set_yn $NAME/rtlsdr-oversample "$OVERSAMPLE"
|
db_set_yn $NAME/rtlsdr-oversample "$OVERSAMPLE"
|
||||||
|
|
||||||
db_set_yn $NAME/decode-fixcrc "$FIX_CRC"
|
db_set_yn $NAME/decode-fixcrc "$FIX_CRC"
|
||||||
db_set_yn $NAME/decode-phase-enhance "$PHASE_ENHANCE"
|
|
||||||
db_set $NAME/decode-lat "$LAT"
|
db_set $NAME/decode-lat "$LAT"
|
||||||
db_set $NAME/decode-lon "$LON"
|
db_set $NAME/decode-lon "$LON"
|
||||||
db_set $NAME/decode-max-range "$MAX_RANGE"
|
db_set $NAME/decode-max-range "$MAX_RANGE"
|
||||||
|
|
1
debian/dump1090-mutability.postinst
vendored
1
debian/dump1090-mutability.postinst
vendored
|
@ -77,7 +77,6 @@ case "$1" in
|
||||||
subvar rtlsdr-ppm PPM
|
subvar rtlsdr-ppm PPM
|
||||||
subvar_yn rtlsdr-oversample OVERSAMPLE
|
subvar_yn rtlsdr-oversample OVERSAMPLE
|
||||||
subvar_yn decode-fixcrc FIX_CRC
|
subvar_yn decode-fixcrc FIX_CRC
|
||||||
subvar_yn decode-phase-enhance PHASE_ENHANCE
|
|
||||||
subvar decode-lat LAT
|
subvar decode-lat LAT
|
||||||
subvar decode-lon LON
|
subvar decode-lon LON
|
||||||
subvar decode-max-range MAX_RANGE
|
subvar decode-max-range MAX_RANGE
|
||||||
|
|
7
debian/dump1090-mutability.templates
vendored
7
debian/dump1090-mutability.templates
vendored
|
@ -69,13 +69,6 @@ Description: Fix detected CRC errors?
|
||||||
Type: boolean
|
Type: boolean
|
||||||
Default: true
|
Default: true
|
||||||
|
|
||||||
Template: dump1090-mutability/decode-phase-enhance
|
|
||||||
Description: Apply phase enhancement?
|
|
||||||
dump1090 can attempt to correct for messages that are received
|
|
||||||
out-of-phase from the sampling rate, at the expense of taking more CPU.
|
|
||||||
Type: boolean
|
|
||||||
Default: true
|
|
||||||
|
|
||||||
Template: dump1090-mutability/decode-lat
|
Template: dump1090-mutability/decode-lat
|
||||||
Description: Latitude of receiver, in decimal degrees:
|
Description: Latitude of receiver, in decimal degrees:
|
||||||
If the location of the receiver is provided, dump1090 can do
|
If the location of the receiver is provided, dump1090 can do
|
||||||
|
|
|
@ -880,8 +880,8 @@ void demodulate2000(struct mag_buf *mag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retry with phase correction if enabled, necessary and possible.
|
// Retry with phase correction if necessary and possible.
|
||||||
if (Modes.phase_enhance && (!message_ok || mm.correctedbits > 0) && !use_correction && j && detectOutOfPhase(pPreamble)) {
|
if ((!message_ok || mm.correctedbits > 0) && !use_correction && j && detectOutOfPhase(pPreamble)) {
|
||||||
use_correction = 1; j--;
|
use_correction = 1; j--;
|
||||||
} else {
|
} else {
|
||||||
use_correction = 0;
|
use_correction = 0;
|
||||||
|
|
45
demod_2400.c
45
demod_2400.c
|
@ -118,33 +118,6 @@ static inline int correlate_check_4(uint16_t *m) {
|
||||||
abs(correlate_phase2(&m[10]));
|
abs(correlate_phase2(&m[10]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Work out the best phase offset to use for the given message.
|
|
||||||
static int best_phase(uint16_t *m) {
|
|
||||||
int test;
|
|
||||||
int best = -1;
|
|
||||||
int bestval = (m[0] + m[1] + m[2] + m[3] + m[4] + m[5]); // minimum correlation quality we will accept
|
|
||||||
|
|
||||||
// empirical testing suggests that 4..8 is the best range to test for here
|
|
||||||
// (testing a wider range runs the danger of picking the wrong phase for
|
|
||||||
// a message that would otherwise be successfully decoded - the correlation
|
|
||||||
// functions can match well with a one symbol / half bit offset)
|
|
||||||
|
|
||||||
// this is consistent with the peak detection which should produce
|
|
||||||
// the first data symbol with phase offset 4..8
|
|
||||||
|
|
||||||
test = correlate_check_4(&m[0]);
|
|
||||||
if (test > bestval) { bestval = test; best = 4; }
|
|
||||||
test = correlate_check_0(&m[1]);
|
|
||||||
if (test > bestval) { bestval = test; best = 5; }
|
|
||||||
test = correlate_check_1(&m[1]);
|
|
||||||
if (test > bestval) { bestval = test; best = 6; }
|
|
||||||
test = correlate_check_2(&m[1]);
|
|
||||||
if (test > bestval) { bestval = test; best = 7; }
|
|
||||||
test = correlate_check_3(&m[1]);
|
|
||||||
if (test > bestval) { bestval = test; best = 8; }
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Given 'mlen' magnitude samples in 'm', sampled at 2.4MHz,
|
// Given 'mlen' magnitude samples in 'm', sampled at 2.4MHz,
|
||||||
// try to demodulate some Mode S messages.
|
// try to demodulate some Mode S messages.
|
||||||
|
@ -170,7 +143,7 @@ void demodulate2400(struct mag_buf *mag)
|
||||||
uint16_t *preamble = &m[j];
|
uint16_t *preamble = &m[j];
|
||||||
int high;
|
int high;
|
||||||
uint32_t base_signal, base_noise;
|
uint32_t base_signal, base_noise;
|
||||||
int initial_phase, first_phase, last_phase, try_phase;
|
int try_phase;
|
||||||
int msglen;
|
int msglen;
|
||||||
|
|
||||||
// Look for a message starting at around sample 0 with phase offset 3..7
|
// Look for a message starting at around sample 0 with phase offset 3..7
|
||||||
|
@ -252,22 +225,10 @@ void demodulate2400(struct mag_buf *mag)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modes.phase_enhance) {
|
// try all phases
|
||||||
first_phase = 4;
|
|
||||||
last_phase = 8; // try all phases
|
|
||||||
} else {
|
|
||||||
// Crosscorrelate against the first few bits to find a likely phase offset
|
|
||||||
initial_phase = best_phase(&preamble[19]);
|
|
||||||
if (initial_phase < 0) {
|
|
||||||
continue; // nothing satisfactory
|
|
||||||
}
|
|
||||||
|
|
||||||
first_phase = last_phase = initial_phase; // try only the phase we think it is
|
|
||||||
}
|
|
||||||
|
|
||||||
Modes.stats_current.demod_preambles++;
|
Modes.stats_current.demod_preambles++;
|
||||||
bestmsg = NULL; bestscore = -2; bestphase = -1;
|
bestmsg = NULL; bestscore = -2; bestphase = -1;
|
||||||
for (try_phase = first_phase; try_phase <= last_phase; ++try_phase) {
|
for (try_phase = 4; try_phase <= 8; ++try_phase) {
|
||||||
uint16_t *pPtr;
|
uint16_t *pPtr;
|
||||||
int phase, i, score, bytelen;
|
int phase, i, score, bytelen;
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,6 @@ void showHelp(void) {
|
||||||
"--fix Enable single-bits error correction using CRC\n"
|
"--fix Enable single-bits error correction using CRC\n"
|
||||||
"--no-fix Disable single-bits error correction using CRC\n"
|
"--no-fix Disable single-bits error correction using CRC\n"
|
||||||
"--no-crc-check Disable messages with broken CRC (discouraged)\n"
|
"--no-crc-check Disable messages with broken CRC (discouraged)\n"
|
||||||
"--phase-enhance Enable phase enhancement\n"
|
|
||||||
#ifdef ALLOW_AGGRESSIVE
|
#ifdef ALLOW_AGGRESSIVE
|
||||||
"--aggressive More CPU for more messages (two bits fixes, ...)\n"
|
"--aggressive More CPU for more messages (two bits fixes, ...)\n"
|
||||||
#endif
|
#endif
|
||||||
|
@ -964,7 +963,7 @@ int main(int argc, char **argv) {
|
||||||
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
||||||
Modes.check_crc = 0;
|
Modes.check_crc = 0;
|
||||||
} else if (!strcmp(argv[j],"--phase-enhance")) {
|
} else if (!strcmp(argv[j],"--phase-enhance")) {
|
||||||
Modes.phase_enhance = 1;
|
// Ignored, always enabled
|
||||||
} else if (!strcmp(argv[j],"--raw")) {
|
} else if (!strcmp(argv[j],"--raw")) {
|
||||||
Modes.raw = 1;
|
Modes.raw = 1;
|
||||||
} else if (!strcmp(argv[j],"--net")) {
|
} else if (!strcmp(argv[j],"--net")) {
|
||||||
|
|
|
@ -282,7 +282,6 @@ struct { // Internal state
|
||||||
// Configuration
|
// Configuration
|
||||||
char *filename; // Input form file, --ifile option
|
char *filename; // Input form file, --ifile option
|
||||||
int oversample;
|
int oversample;
|
||||||
int phase_enhance; // Enable phase enhancement if true
|
|
||||||
int nfix_crc; // Number of crc bit error(s) to correct
|
int nfix_crc; // Number of crc bit error(s) to correct
|
||||||
int check_crc; // Only display messages with good CRC
|
int check_crc; // Only display messages with good CRC
|
||||||
int raw; // Raw output format
|
int raw; // Raw output format
|
||||||
|
|
Loading…
Reference in a new issue