incyclist-devices 2.3.12 → 2.3.13
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/lib/ble/fm/sensor.js +3 -3
- package/package.json +1 -1
package/lib/ble/fm/sensor.js
CHANGED
|
@@ -144,9 +144,9 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
144
144
|
}
|
|
145
145
|
parseIndoorBikeData(_data) {
|
|
146
146
|
const data = Buffer.from(_data);
|
|
147
|
+
let offset = 2;
|
|
147
148
|
try {
|
|
148
149
|
const flags = data.readUInt16LE(0);
|
|
149
|
-
let offset = 2;
|
|
150
150
|
if ((flags & consts_2.IndoorBikeDataFlag.MoreData) === 0) {
|
|
151
151
|
this.data.speed = data.readUInt16LE(offset) / 100;
|
|
152
152
|
offset += 2;
|
|
@@ -196,7 +196,7 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
196
196
|
}
|
|
197
197
|
if (flags & consts_2.IndoorBikeDataFlag.MetabolicEquivalentPresent) {
|
|
198
198
|
this.data.metabolicEquivalent = data.readUInt8(offset) / 10;
|
|
199
|
-
offset +=
|
|
199
|
+
offset += 1;
|
|
200
200
|
}
|
|
201
201
|
if (flags & consts_2.IndoorBikeDataFlag.ElapsedTimePresent) {
|
|
202
202
|
this.data.time = data.readUInt16LE(offset);
|
|
@@ -207,7 +207,7 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
catch (err) {
|
|
210
|
-
this.logEvent({ message: 'error', fn: 'parseIndoorBikeData()', error: err.message | err, stack: err.stack });
|
|
210
|
+
this.logEvent({ message: 'error', fn: 'parseIndoorBikeData()', data: data.toString('hex'), offset, error: err.message | err, stack: err.stack });
|
|
211
211
|
}
|
|
212
212
|
return Object.assign(Object.assign({}, this.data), { raw: `2ad2:${data.toString('hex')}` });
|
|
213
213
|
}
|