Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
67b466d
c
bonchan Nov 21, 2022
fd50956
haslinghuis diff from 602#issuecomment-1320958859
bonchan Nov 21, 2022
e48ef6f
Merge branch 'gps-maybe' into graph-gps-data
bonchan Nov 21, 2022
803b3b7
added check undefined returning undefined
bonchan Nov 21, 2022
f8b1755
displays data in table and graph
LinusThorsell Nov 21, 2022
5bfad3f
progress, table loads offset by 5, but works
LinusThorsell Nov 21, 2022
11ecff5
GPS G Frame logs successfully.
LinusThorsell Nov 21, 2022
df6ee3e
removed unecessary comments
LinusThorsell Nov 21, 2022
b877867
fixed names in table
LinusThorsell Nov 21, 2022
0dc3295
removed test code in main, remove whitespaces
LinusThorsell Nov 21, 2022
5a9be0f
Merge branch 'master' into display-gps-data-better
LinusThorsell Nov 21, 2022
cd08b16
fixed GPS cases and added gps example graph
bonchan Nov 21, 2022
5ce7fad
Merge pull request #1 from bonchan/display-gps-data-better-fixes
LinusThorsell Nov 22, 2022
cd5f022
using const name of, instead of normal for in flightlog
LinusThorsell Nov 22, 2022
3ac4278
changes suggested by ctzsnooze (presentability)
LinusThorsell Nov 22, 2022
368711c
readability changes
LinusThorsell Nov 22, 2022
f1bb6a4
make numsat and speed start at bottom of graph
LinusThorsell Nov 22, 2022
cabd414
removed time field. refactored code
LinusThorsell Nov 22, 2022
f2949e5
cosmetic code changes
LinusThorsell Nov 22, 2022
44d91e2
changed live gps to GPS Reported Altitude
LinusThorsell Nov 22, 2022
b1bc7a5
fixed gps ASL altitude scaling, changed reported gps alt to alt ASL
LinusThorsell Nov 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions js/flightlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function FlightLog(logData) {
} else
return false;
};

function buildFieldNames() {
// Make an independent copy
fieldNames = parser.frameDefs.I.name.slice(0);
Expand All @@ -218,6 +218,12 @@ function FlightLog(logData) {
fieldNames.push(parser.frameDefs.S.name[i]);
}
}
// Add names of gps fields which we'll merge into the main stream
if (parser.frameDefs.G) {
for (let i = 0; i < parser.frameDefs.G.name.length; i++) {
fieldNames.push(parser.frameDefs.G.name[i]);
}
}

// Add names for our ADDITIONAL_COMPUTED_FIELDS
if (!that.isFieldDisabled().GYRO) {
Expand Down Expand Up @@ -375,7 +381,9 @@ function FlightLog(logData) {
var
mainFrameIndex = 0,
slowFrameLength = parser.frameDefs.S ? parser.frameDefs.S.count : 0,
lastSlow = parser.frameDefs.S ? iframeDirectory.initialSlow[chunkIndex].slice(0) : [];
lastSlow = parser.frameDefs.S ? iframeDirectory.initialSlow[chunkIndex].slice(0) : [],
lastGPSLength = parser.frameDefs.G ? parser.frameDefs.G.count : 0, //Should I expand the outputFields?
lastGPS = parser.frameDefs.G ? iframeDirectory.initialGPS[chunkIndex].slice(0) : [];

parser.onFrameReady = function(frameValid, frame, frameType, frameOffset, frameSize) {
var
Expand All @@ -392,7 +400,7 @@ function FlightLog(logData) {
//The parser re-uses the "frame" array so we must copy that data somewhere else

var
numOutputFields = frame.length + slowFrameLength + ADDITIONAL_COMPUTED_FIELD_COUNT;
numOutputFields = frame.length + slowFrameLength + lastGPSLength + ADDITIONAL_COMPUTED_FIELD_COUNT;

//Do we have a recycled chunk to copy on top of?
if (chunk.frames[mainFrameIndex]) {
Expand All @@ -410,8 +418,12 @@ function FlightLog(logData) {
}

// Then merge in the last seen slow-frame data
for (var i = 0; i < slowFrameLength; i++) {
destFrame[i + frame.length] = lastSlow[i] === undefined ? null : lastSlow[i];
for (let slowFrameIndex = 0; slowFrameIndex < slowFrameLength; slowFrameIndex++) {
destFrame[slowFrameIndex + frame.length] = lastSlow[slowFrameIndex] === undefined ? null : lastSlow[slowFrameIndex];
}
// Also merge last seen gps-frame data
for (let gpsFrameIndex = 0; gpsFrameIndex < lastGPSLength; gpsFrameIndex++) {
destFrame[gpsFrameIndex + frame.length + slowFrameLength] = lastGPS[gpsFrameIndex] === undefined ? null : lastGPS[gpsFrameIndex];
}

for (var i = 0; i < eventNeedsTimestamp.length; i++) {
Expand Down Expand Up @@ -446,10 +458,17 @@ function FlightLog(logData) {
}
break;
case 'H':
// TODO
// contains coordinates only
// should be handled separately
case 'G':
// TODO pending to do something with GPS frames
// The frameValid can be false, when no GPS home (the G frames contains GPS position as diff of GPS Home position).
// But other data from the G frame can be valid (time, num sats)

//H Field G name:time,GPS_numSat,GPS_coord[0],GPS_coord[1],GPS_altitude,GPS_speed,GPS_ground_course
for (let i = 0; i < frame.length; i++) {
lastGPS[i] = frame[i];
}
break;
}
} else {
Expand Down
26 changes: 26 additions & 0 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ function FlightLogFieldPresenter() {
'rxSignalReceived': 'RX Signal Received',
'rxFlightChannelsValid': 'RX Flight Ch. Valid',
'rssi': 'RSSI',

'lastGPS[all]': 'GPS Data',
//'time': "GPS timeframe", can't change this one since
//it shares a name with the normal time field.
'GPS_numSat': "GPS NumSat",
'GPS_coord[0]': "GPS Latitude",
'GPS_coord[1]': "GPS Longitude",
'GPS_altitude': "GPS Altitude",
'GPS_speed': "GPS Speed",
'GPS_ground_course': "GPS Ground course",
};

const DEBUG_FRIENDLY_FIELD_NAMES_INITIAL = {
Expand Down Expand Up @@ -977,6 +987,22 @@ function FlightLogFieldPresenter() {
case 'rssi':
return (value / 1024 * 100).toFixed(2) + " %";

//H Field G name:time,GPS_numSat,GPS_coord[0],GPS_coord[1],GPS_altitude,GPS_speed,GPS_ground_course
case 'lastGPS[0]':
case 'lastGPS[1]': // GPS_numSat
return `${value}`;
case 'lastGPS[2]': // GPS_coord[0]
return `${value}`;
case 'lastGPS[3]': // GPS_coord[1]
return `${value}`;
case 'lastGPS[4]': // GPS_altitude
return `${value}`;
case 'lastGPS[5]': // GPS_speed
return `${value}`;
case 'lastGPS[6]': // GPS_ground_course
return `${value}`;


case 'debug[0]':
case 'debug[1]':
case 'debug[2]':
Expand Down
12 changes: 9 additions & 3 deletions js/flightlog_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function FlightLogIndex(logData) {
initialIMU: [],
initialSlow: [],
initialGPSHome: [],
initialGPS: [],
hasEvent: [],
minTime: false,
maxTime: false
Expand Down Expand Up @@ -77,14 +78,15 @@ function FlightLogIndex(logData) {
var
sysConfig = parser.sysConfig,
mainFrameDef = parser.frameDefs.I,

gyroADC = [mainFrameDef.nameToIndex["gyroADC[0]"], mainFrameDef.nameToIndex["gyroADC[1]"], mainFrameDef.nameToIndex["gyroADC[2]"]],
accSmooth = [mainFrameDef.nameToIndex["accSmooth[0]"], mainFrameDef.nameToIndex["accSmooth[1]"], mainFrameDef.nameToIndex["accSmooth[2]"]],
magADC = [mainFrameDef.nameToIndex["magADC[0]"], mainFrameDef.nameToIndex["magADC[1]"], mainFrameDef.nameToIndex["magADC[2]"]],

lastSlow = [],
lastGPSHome = [];

lastGPSHome = [],
lastGPS = [];

// Identify motor fields so they can be used to show the activity summary bar
for (var j = 0; j < 8; j++) {
if (mainFrameDef.nameToIndex["motor[" + j + "]"] !== undefined) {
Expand Down Expand Up @@ -139,6 +141,7 @@ function FlightLogIndex(logData) {
intraIndex.initialIMU.push(new IMU(imu));
intraIndex.initialSlow.push(lastSlow);
intraIndex.initialGPSHome.push(lastGPSHome);
intraIndex.initialGPS.push(lastGPS);
}

iframeCount++;
Expand All @@ -153,6 +156,9 @@ function FlightLogIndex(logData) {
magADC ? [frame[magADC[0]], frame[magADC[1]], frame[magADC[2]]] : false
);
break;
case 'G':
lastGPS = frame.slice(0);
break;
case 'H':
lastGPSHome = frame.slice(0);
break;
Expand Down
4 changes: 4 additions & 0 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,10 @@ GraphConfig.load = function(config) {
EXAMPLE_GRAPHS.push({label: "Debug",fields: ["debug[all]"]});
}

if (!flightLog.isFieldDisabled().GPS) {
EXAMPLE_GRAPHS.push({label: "GPS",fields: ["lastGPS[all]"]});
}

for (i = 0; i < EXAMPLE_GRAPHS.length; i++) {
var
srcGraph = EXAMPLE_GRAPHS[i],
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function BlackboxLogViewer() {

if (value === null)
return "(absent)";

return value.toFixed(2);
}

Expand Down