Skip to content

Commit 5a2864d

Browse files
authored
Garmin FIT SDK 21.170.0
1 parent 92993d5 commit 5a2864d

18 files changed

+1482
-1549
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@garmin/fitsdk",
3-
"version": "21.169.0",
3+
"version": "21.170.0",
44
"description": "FIT JavaScript SDK",
55
"main": "src/index.js",
66
"type": "module",

src/accumulator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/bit-stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/crc-calculator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/decoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/encoder.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

@@ -20,6 +20,9 @@ import Utils from "./utils.js";
2020
const HEADER_WITH_CRC_SIZE = 14;
2121
const HEADER_WITHOUT_CRC_SIZE = 12;
2222

23+
const FIELD_DEFAULT_SCALE = 1;
24+
const FIELD_DEFAULT_OFFSET = 0;
25+
2326
/**
2427
* A class for encoding FIT files.
2528
* @class
@@ -212,10 +215,17 @@ class Encoder {
212215
throw new Error();
213216
}
214217

215-
const scale = fieldDefinition.components.length > 1 ? 1 : fieldDefinition.scale;
216-
const offset = fieldDefinition.components.length > 1 ? 0 : fieldDefinition.offset;
218+
const scale = fieldDefinition.components.length > 1 ? FIELD_DEFAULT_SCALE : fieldDefinition.scale;
219+
const offset = fieldDefinition.components.length > 1 ? FIELD_DEFAULT_OFFSET : fieldDefinition.offset;
220+
const hasScaleOrOffset = (scale != FIELD_DEFAULT_SCALE || offset != FIELD_DEFAULT_OFFSET);
221+
222+
if (hasScaleOrOffset) {
223+
const scaledValue = (value + offset) * scale;
217224

218-
return (value + offset) * scale;
225+
return FIT.FloatingPointFieldTypes.includes(fieldDefinition.type) ? scaledValue : Math.round(scaledValue);
226+
}
227+
228+
return value;
219229
}
220230

221231
// Is this a date_time field?

src/fit.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

13+
/**
14+
* FIT Base Type enum
15+
*/
1316
const BaseType = {
1417
ENUM: 0x00,
1518
SINT8: 0x01,
@@ -68,6 +71,11 @@ const NumericFieldTypes = [
6871
"uint64z"
6972
];
7073

74+
const FloatingPointFieldTypes = [
75+
"float32",
76+
"float64",
77+
];
78+
7179
const FieldTypeToBaseType = {
7280
"enum": BaseType.UINT8,
7381
"sint8": BaseType.SINT8,
@@ -152,6 +160,7 @@ export default {
152160
BaseType,
153161
BaseTypeDefinitions,
154162
NumericFieldTypes,
163+
FloatingPointFieldTypes,
155164
FieldTypeToBaseType,
156165
BaseTypeToFieldType,
157166
isNullOrUndefined,

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/mesg-definition.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

@@ -147,7 +147,7 @@ class MesgDefinition {
147147
}
148148

149149
equals(other) {
150-
if (this.globalMesgNumber !== other.globalMesgNumber
150+
if (this.globalMessageNumber !== other.globalMessageNumber
151151
|| this.fieldDefinitions.length !== other.fieldDefinitions.length
152152
|| this.developerFieldDefinitions.length !== other.developerFieldDefinitions.length) {
153153
return false;

src/output-stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.169.0Release
9-
// Tag = production/release/21.169.0-0-g7105132
8+
// Profile Version = 21.170.0Release
9+
// Tag = production/release/21.170.0-0-g5991e72
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

0 commit comments

Comments
 (0)