From c3409302ce0209f8d21dfa7d746f02abe9ee14e1 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sat, 27 Sep 2014 16:44:26 +0100 Subject: [PATCH] Fix mlat inter-block timestamp accounting in oversampling mode. Add calculated phase into the per-message timestamp (it is already exactly a 12MHz offset) --- dump1090.c | 5 ++++- mode_s.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dump1090.c b/dump1090.c index 150126c..64087f1 100644 --- a/dump1090.c +++ b/dump1090.c @@ -918,7 +918,10 @@ int main(int argc, char **argv) { detectModeS(Modes.magnitude, MODES_ASYNC_BUF_SAMPLES); // Update the timestamp ready for the next block - Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*6); + if (Modes.oversample) + Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*5); + else + Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*6); Modes.stat_blocks_processed++; } else { pthread_cond_signal (&Modes.data_cond); diff --git a/mode_s.c b/mode_s.c index 80b7765..9c9903f 100644 --- a/mode_s.c +++ b/mode_s.c @@ -2292,7 +2292,7 @@ void detectModeS_oversample(uint16_t *m, uint32_t mlen) { // be correct, but this can be handled by the next layer. if ( (msglen > 0) && (errors <= MODES_MSG_ENCODER_ERRS) ) { // Set initial mm structure details - mm.timestampMsg = Modes.timestampBlk + (j*5); + mm.timestampMsg = Modes.timestampBlk + (j*5) + initial_phase; mm.signalLevel = 0; mm.phase_corrected = 0;