incyclist-devices 3.0.31 → 3.0.32

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.
@@ -41,6 +41,7 @@ class CscMeasurement {
41
41
  const { rpm } = this.parseCrankData(crankData);
42
42
  this.data.cadence = rpm;
43
43
  }
44
+ this.data.raw = data.toString('hex');
44
45
  return this.data;
45
46
  }
46
47
  parseCrankData(crankData) {
@@ -49,6 +49,10 @@ class BleCyclingSpeedCadenceDevice extends sensor_js_1.TBleSensor {
49
49
  }
50
50
  const parsed = parser.parse(data);
51
51
  this.data = { ...this.data, ...parsed };
52
+ if (this.data.speed < 0) {
53
+ this.logEvent({ message: 'error', fn: 'onData', error: 'speed<0', speed: this.data.speed, raw: this.data.raw });
54
+ return false;
55
+ }
52
56
  this.emit('data', this.data);
53
57
  return true;
54
58
  }
@@ -38,6 +38,7 @@ export class CscMeasurement {
38
38
  const { rpm } = this.parseCrankData(crankData);
39
39
  this.data.cadence = rpm;
40
40
  }
41
+ this.data.raw = data.toString('hex');
41
42
  return this.data;
42
43
  }
43
44
  parseCrankData(crankData) {
@@ -46,6 +46,10 @@ export class BleCyclingSpeedCadenceDevice extends TBleSensor {
46
46
  }
47
47
  const parsed = parser.parse(data);
48
48
  this.data = { ...this.data, ...parsed };
49
+ if (this.data.speed < 0) {
50
+ this.logEvent({ message: 'error', fn: 'onData', error: 'speed<0', speed: this.data.speed, raw: this.data.raw });
51
+ return false;
52
+ }
49
53
  this.emit('data', this.data);
50
54
  return true;
51
55
  }
@@ -3,6 +3,7 @@ import { CharacteristicParser, Feature } from "../types.js";
3
3
  export type CyclingCadenceAndSpeed = {
4
4
  cadence?: number;
5
5
  speed?: number;
6
+ raw?: string;
6
7
  };
7
8
  export declare class CscMeasurement implements CharacteristicParser<CyclingCadenceAndSpeed> {
8
9
  protected data: CyclingCadenceAndSpeed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "3.0.31",
3
+ "version": "3.0.32",
4
4
  "scripts": {
5
5
  "lint": "eslint . --ext .ts",
6
6
  "build": "npm run build:esm && npm run build:cjs",