diff --git a/src/flightlog.js b/src/flightlog.js index 6eaa34fb..9f4d430a 100644 --- a/src/flightlog.js +++ b/src/flightlog.js @@ -1143,9 +1143,7 @@ export function FlightLog(logData) { this.getCurrentLogRowsCount = function () { const stats = this.getStats(this.getLogIndex()); - const countI = stats.frame['I'] ? stats.frame['I'].totalCount : 0; - const countP = stats.frame['P'] ? stats.frame['P'].totalCount : 0; - return countI + countP; + return stats.frame['I'].validCount + stats.frame['P'].validCount; }; } diff --git a/src/flightlog_parser.js b/src/flightlog_parser.js index 2025e2aa..5f033c32 100644 --- a/src/flightlog_parser.js +++ b/src/flightlog_parser.js @@ -1110,6 +1110,7 @@ export function FlightLogParser(logData) { mainHistory[0] = mainHistoryRing[2]; else mainHistory[0] = mainHistoryRing[0]; + return mainStreamIsValid; } /** @@ -1251,7 +1252,7 @@ export function FlightLogParser(logData) { that.onFrameReady(gpsHomeIsValid, lastGPS, frameType, frameStart, frameEnd - frameStart); } - return true; + return gpsHomeIsValid; } function completeSlowFrame(frameType, frameStart, frameEnd, raw) { @@ -1260,6 +1261,7 @@ export function FlightLogParser(logData) { if (that.onFrameReady) { that.onFrameReady(true, lastSlow, frameType, frameStart, frameEnd - frameStart); } + return true; } function completeInterframe(frameType, frameStart, frameEnd, raw) { @@ -1300,6 +1302,7 @@ export function FlightLogParser(logData) { else mainHistory[0] = mainHistoryRing[0]; } + return mainStreamIsValid; } /** @@ -1773,13 +1776,12 @@ export function FlightLogParser(logData) { sizeCount: new Int32Array(256), /* int32 arrays are zero-filled, handy! */ validCount: 0, corruptCount: 0, + desyncCount: 0, field: [], - totalCount: 0 }; } frameTypeStats = this.stats.frame[lastFrameType.marker]; - frameTypeStats.totalCount++; // If we see what looks like the beginning of a new frame, assume that the previous frame was valid: if (lastFrameSize <= FLIGHT_LOG_MAX_FRAME_LENGTH && looksLikeFrameCompleted) { var frameAccepted = true; @@ -1793,7 +1795,7 @@ export function FlightLogParser(logData) { frameTypeStats.sizeCount[lastFrameSize]++; frameTypeStats.validCount++; } else { - frameTypeStats.desyncCount = frameTypeStats.desyncCount ? ++frameTypeStats.desyncCount : 1; + frameTypeStats.desyncCount++; } } else { //The previous frame was corrupt @@ -1803,10 +1805,6 @@ export function FlightLogParser(logData) { frameTypeStats.corruptCount++; this.stats.totalCorruptFrames++; - //Let the caller know there was a corrupt frame (don't give them a pointer to the frame data because it is totally worthless) - if (this.onFrameReady) - this.onFrameReady(false, null, lastFrameType.marker, frameStart, lastFrameSize); - /* * Start the search for a frame beginning after the first byte of the previous corrupt frame. * This way we can find the start of the next frame after the corrupt frame if the corrupt frame