dji_srt_parser
Advanced tools
Comparing version 1.1.5 to 1.1.6
14
index.js
@@ -171,4 +171,4 @@ const toMGJSON = require('./modules/toMGJSON'); | ||
if (i > 0) { | ||
let origin2d = [cmp[i - 1].GPS.LATITUDE, cmp[i - 1].GPS.LATITUDE]; | ||
let destin2d = [pck.GPS.LATITUDE, pck.GPS.LATITUDE]; | ||
let origin2d = [cmp[i - 1].GPS.LATITUDE, cmp[i - 1].GPS.LONGITUDE]; | ||
let destin2d = [pck.GPS.LATITUDE, pck.GPS.LONGITUDE]; | ||
let distance2D = measure( | ||
@@ -185,3 +185,5 @@ origin2d[0], | ||
let time = 1; //Fallback time, 1 second | ||
if (pck.DATE) { | ||
if (pck.DIFFTIME != null) { | ||
time = pck.DIFFTIME / 1000; | ||
} else if (pck.DATE) { | ||
time = | ||
@@ -539,4 +541,6 @@ (new Date(pck.DATE).getTime() - | ||
function getElevation(src) { | ||
//GPS elevation data is almost useless, so we replace with barometer if available | ||
if (src.BAROMETER != undefined) { | ||
//Elevation has different names on each format | ||
if (src.ALTITUDE != undefined) { | ||
return src.ALTITUDE; | ||
} else if (src.BAROMETER != undefined) { | ||
return src.BAROMETER; | ||
@@ -543,0 +547,0 @@ } else if (src.HB != undefined) { |
@@ -33,3 +33,3 @@ function preload(file) { | ||
test('The average 3D speed should be set', () => { | ||
expect(MavicPro.metadata().stats.SPEED.THREED.avg).toBe(17.781097679002578); | ||
expect(MavicPro.metadata().stats.SPEED.THREED.avg).toBe(21.639140507206356); | ||
}); | ||
@@ -43,3 +43,3 @@ test('The max altitude should be readable from the barometer', () => { | ||
test('We should get the flight distance', () => { | ||
expect(MavicPro.metadata().stats.DISTANCE).toBe(2311.5426982713075); | ||
expect(MavicPro.metadata().stats.DISTANCE).toBe(2813.7409936548734); | ||
}); | ||
@@ -68,3 +68,3 @@ test('We should be able to read the aperture', () => { | ||
test('The average 3D speed should be set in the old format', () => { | ||
expect(Old_Format.metadata().stats.SPEED.THREED.avg).toBe(17.781097679002578); | ||
expect(Old_Format.metadata().stats.SPEED.THREED.avg).toBe(21.63914050720636); | ||
}); | ||
@@ -87,3 +87,3 @@ test('The max altitude should be readable from the HB field', () => { | ||
test('The average 2D speed should be set in the Mavic 2 format', () => { | ||
expect(Mavic_2.metadata().stats.SPEED.TWOD.avg).toBe(15.469517716020455); | ||
expect(Mavic_2.metadata().stats.SPEED.TWOD.avg).toBe(19.531079073870547); | ||
}); | ||
@@ -96,2 +96,17 @@ test('We should be able to read the aperture in the Mavic 2 format', () => { | ||
}); | ||
//mavic 2 zoom | ||
data = preload(`./samples/m2zoom.SRT`); | ||
let m2z = DJISRTParser(data, 'm2zoom.SRT'); | ||
test('Mavic 2 Zoom Format result should contain metadata', () => { | ||
expect(m2z.metadata()).toBeDefined(); | ||
}); | ||
test('The average 2D speed should be set in the Mavic 2 Zoom format', () => { | ||
expect(m2z.metadata().stats.SPEED.TWOD.avg).toBe(10.102267576077548); | ||
}); | ||
test('We should be able to read the aperture in the Mavic 2 Zoom format', () => { | ||
expect(m2z.metadata().packets[0].FNUM).toBe(2.8); | ||
}); | ||
test('We should be able to read the exposure in the Mavic 2 Zoom format', () => { | ||
expect(m2z.metadata().stats.EV.avg).toBe(0); | ||
}); | ||
//mavic pro buggy format | ||
@@ -104,3 +119,3 @@ data = preload(`./samples/mavic_pro_buggy.SRT`); | ||
test('The average 3D speed should be set in the buggy format', () => { | ||
expect(Buggy.metadata().stats.SPEED.THREED.avg).toBe(10.194917607142946); | ||
expect(Buggy.metadata().stats.SPEED.THREED.avg).toBe(13.453024023265257); | ||
}); | ||
@@ -107,0 +122,0 @@ test('The max satellites should be readable from the SATELLITES field', () => { |
{ | ||
"name": "dji_srt_parser", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Parses and interprets DJI's drones SRT metadata", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5049621
21
1553