From 085c8c084512cbcbc4396f6b60ea3b09dcae3174 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Wed, 24 Mar 2021 08:08:04 +0100 Subject: [PATCH] make nextTraceStart more obvious --- html/planeObject.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 2e7eb47..c0cf5ed 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -914,7 +914,7 @@ PlaneObject.prototype.processTrace = function() { for (let j = 0; j < 2 && !stop; j++) { let start; let end; - let nextTraceStart; + let nextTraceStart = null; if (j == 0) { if (!this.fullTrace || !this.fullTrace.trace) continue; @@ -922,8 +922,8 @@ PlaneObject.prototype.processTrace = function() { continue; timeZero = this.fullTrace.timestamp; - // stop processing when we have the timestamp in recent - nextTraceStart = this.recentTrace ? this.recentTrace.timestamp : timeZero + 1e9; + // after fullTrace, recentTrace will be processed, set to null if no recentTrace + nextTraceStart = this.recentTrace ? this.recentTrace.timestamp : null; _last = timeZero - 1; @@ -941,7 +941,10 @@ PlaneObject.prototype.processTrace = function() { if (!this.recentTrace || !this.recentTrace.trace) continue; timeZero = this.recentTrace.timestamp; - nextTraceStart = timeZero + 864000; // no next trace, set it 10 days in the future + + // no next trace to process + nextTraceStart = null; + if (!trace) { _last = timeZero - 1; } @@ -965,7 +968,9 @@ PlaneObject.prototype.processTrace = function() { let stale = state[6] & 1; const leg_marker = state[6] & 2; - if (timestamp >= nextTraceStart) + // data from recentTrace are preferred due to leg marking internals + // stop processing when we have the timestamp in recent + if (nextTraceStart && timestamp >= nextTraceStart) break; _now = timestamp;