fit-file-parser 1.9.5 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,6 +28,7 @@ fs.readFile('./example.fit', function (err, content) {
28
28
  speedUnit: 'km/h',
29
29
  lengthUnit: 'km',
30
30
  temperatureUnit: 'kelvin',
31
+ pressureUnit: 'bar', // accept bar, cbar and psi (default is bar)
31
32
  elapsedRecordField: true,
32
33
  mode: 'cascade',
33
34
  });
package/dist/binary.js CHANGED
@@ -232,6 +232,10 @@ function applyOptions(data, field, options) {
232
232
  case 'avg_temperature':
233
233
  case 'max_temperature':
234
234
  return convertTo(data, 'temperatureUnits', options.temperatureUnit);
235
+ case 'pressure':
236
+ case 'start_pressure':
237
+ case 'end_pressure':
238
+ return convertTo(data, 'pressureUnits', options.pressureUnit);
235
239
  default:
236
240
  return data;
237
241
  }
@@ -24,6 +24,7 @@ var FitParser = function () {
24
24
  lengthUnit: options.lengthUnit || 'm',
25
25
  temperatureUnit: options.temperatureUnit || 'celsius',
26
26
  elapsedRecordField: options.elapsedRecordField || false,
27
+ pressureUnit: options.pressureUnit || 'bar',
27
28
  mode: options.mode || 'list'
28
29
  };
29
30
  }
@@ -107,6 +108,8 @@ var FitParser = function () {
107
108
  var file_ids = [];
108
109
  var monitor_info = [];
109
110
  var lengths = [];
111
+ var tank_updates = [];
112
+ var tank_summaries = [];
110
113
 
111
114
  var loopIndex = headerLength;
112
115
  var messageTypes = [];
@@ -198,6 +201,12 @@ var FitParser = function () {
198
201
  case 'software':
199
202
  fitObj.software = message;
200
203
  break;
204
+ case 'tank_update':
205
+ tank_updates.push(message);
206
+ break;
207
+ case 'tank_summary':
208
+ tank_summaries.push(message);
209
+ break;
201
210
  default:
202
211
  if (messageType !== '') {
203
212
  fitObj[messageType] = message;
@@ -238,6 +247,8 @@ var FitParser = function () {
238
247
  fitObj.file_ids = file_ids;
239
248
  fitObj.monitor_info = monitor_info;
240
249
  fitObj.definitions = definitions;
250
+ fitObj.tank_updates = tank_updates;
251
+ fitObj.tank_summaries = tank_summaries;
241
252
  }
242
253
 
243
254
  callback(null, fitObj);
package/dist/fit.js CHANGED
@@ -10,6 +10,8 @@ var metersInOneKilometer = 1000;
10
10
  var secondsInOneHour = 3600;
11
11
  // according to https://en.wikipedia.org/wiki/Mile
12
12
  var metersInOneMile = 1609.344;
13
+ var centiBarsInOneBar = 100;
14
+ var psiInOneBar = 14.5037738;
13
15
 
14
16
  var FIT = exports.FIT = {
15
17
  scConst: 180 / Math.pow(2, 31),
@@ -64,6 +66,20 @@ var FIT = exports.FIT = {
64
66
  multiplier: 9 / 5,
65
67
  offset: 32
66
68
  }
69
+ },
70
+ pressureUnits: {
71
+ cbar: {
72
+ multiplier: 1,
73
+ offset: 0
74
+ },
75
+ bar: {
76
+ multiplier: 1 / centiBarsInOneBar,
77
+ offset: 0
78
+ },
79
+ psi: {
80
+ multiplier: 1 / centiBarsInOneBar * psiInOneBar,
81
+ offset: 0
82
+ }
67
83
  }
68
84
  },
69
85
  messages: {
@@ -848,6 +864,19 @@ var FIT = exports.FIT = {
848
864
  9: { field: 'o2_toxicity', type: 'uint16', scale: null, offset: 0, units: 'OTUs' },
849
865
  10: { field: 'dive_number', type: 'uint32', scale: null, offset: 0, units: '' },
850
866
  11: { field: 'bottom_time', type: 'uint32', scale: null, offset: 0, units: 's' }
867
+ },
868
+ 319: {
869
+ name: 'tank_update',
870
+ 253: { field: 'timestamp', type: 'date_time', scale: null, offset: 0, units: 's' },
871
+ 0: { field: 'sensor', type: 'uint32', scale: null, offset: 0, units: '' },
872
+ 1: { field: 'pressure', type: 'uint16', scale: null, offset: 0, units: 'cbar' }
873
+ },
874
+ 323: {
875
+ name: 'tank_summary',
876
+ 0: { field: 'sensor', type: 'uint32', scale: null, offset: 0, units: '' },
877
+ 1: { field: 'start_pressure', type: 'uint16', scale: null, offset: 0, units: 'cbar' },
878
+ 2: { field: 'end_pressure', type: 'uint16', scale: null, offset: 0, units: 'cbar' },
879
+ 3: { field: 'volume_used', type: 'uint16', scale: null, offset: 0, units: 'cbar' }
851
880
  }
852
881
  },
853
882
  types: {
@@ -961,6 +990,8 @@ var FIT = exports.FIT = {
961
990
  268: 'dive_summary',
962
991
  285: 'jump',
963
992
  317: 'climb_pro',
993
+ 319: 'tank_pressure',
994
+ 323: 'tank_summary',
964
995
  65280: 'mfg_range_min',
965
996
  65534: 'mfg_range_max'
966
997
  },
package/package.json CHANGED
@@ -65,13 +65,14 @@
65
65
  },
66
66
  "scripts": {
67
67
  "example-output": "node_modules/gulp/bin/gulp.js; node examples/example.js examples/example.fit > examples/output.json",
68
+ "example-output-tank": "node_modules/gulp/bin/gulp.js; node examples/example.js examples/example-diving.fit > examples/output-diving.json",
68
69
  "example-output-summary-first": "node_modules/gulp/bin/gulp.js; node examples/example.js examples/triathlon_summary_first.fit > examples/output_summary_first.json",
69
70
  "example-output-summary-last": "node_modules/gulp/bin/gulp.js; node examples/example.js examples/triathlon_summary_last.fit > examples/output_summary_last.json",
70
71
  "example": "node_modules/gulp/bin/gulp.js; node examples/example.js examples/triathlon_summary_first.fit",
71
72
  "test": "node_modules/gulp/bin/gulp.js;",
72
73
  "build": "node_modules/gulp/bin/gulp.js babel"
73
74
  },
74
- "version": "1.9.5",
75
+ "version": "1.10.0",
75
76
  "dependencies": {
76
77
  "buffer": "^5.1.0"
77
78
  }