incyclist-devices 2.3.17 → 2.3.19
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/antv2/cad/adapter.d.ts +1 -1
- package/lib/antv2/cad/adapter.js +4 -4
- package/lib/antv2/sc/adapter.js +1 -1
- package/lib/antv2/spd/adapter.js +1 -1
- package/lib/ble/characteristics/csc/measurement.js +4 -2
- package/lib/ble/csc/adapter.js +1 -1
- package/lib/ble/csc/sensor.js +3 -1
- package/lib/modes/antble-smarttrainer.js +0 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CadenceSensorState, Profile } from "incyclist-ant-plus";
|
|
2
2
|
import AntAdapter from "../base/adapter";
|
|
3
3
|
import { AntDeviceProperties, AntDeviceSettings, LegacyProfile } from "../types";
|
|
4
|
-
export default class
|
|
4
|
+
export default class AntCadAdapter extends AntAdapter<CadenceSensorState> {
|
|
5
5
|
protected static INCYCLIST_PROFILE_NAME: LegacyProfile;
|
|
6
6
|
protected static ANT_PROFILE_NAME: Profile;
|
|
7
7
|
constructor(settings: AntDeviceSettings, props?: AntDeviceProperties);
|
package/lib/antv2/cad/adapter.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const adapter_1 = __importDefault(require("../base/adapter"));
|
|
7
7
|
const types_1 = require("../../types");
|
|
8
|
-
class
|
|
8
|
+
class AntCadAdapter extends adapter_1.default {
|
|
9
9
|
constructor(settings, props) {
|
|
10
10
|
super(settings, props);
|
|
11
11
|
this.capabilities = [types_1.IncyclistCapability.Cadence];
|
|
@@ -20,6 +20,6 @@ class AntHrAdapter extends adapter_1.default {
|
|
|
20
20
|
return this.deviceData.CalculatedCadence !== undefined && this.deviceData.CalculatedCadence !== null;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
exports.default =
|
|
23
|
+
AntCadAdapter.INCYCLIST_PROFILE_NAME = 'Cadence Sensor';
|
|
24
|
+
AntCadAdapter.ANT_PROFILE_NAME = 'CAD';
|
|
25
|
+
exports.default = AntCadAdapter;
|
package/lib/antv2/sc/adapter.js
CHANGED
|
@@ -8,7 +8,7 @@ const types_1 = require("../../types");
|
|
|
8
8
|
class AntSpdAdapter extends adapter_1.default {
|
|
9
9
|
mapToAdapterData(deviceData) {
|
|
10
10
|
if (deviceData.CalculatedSpeed !== undefined) {
|
|
11
|
-
this.data.speed = deviceData.CalculatedSpeed;
|
|
11
|
+
this.data.speed = deviceData.CalculatedSpeed * 3.6;
|
|
12
12
|
this.data.timestamp = Date.now();
|
|
13
13
|
}
|
|
14
14
|
if (deviceData.CalculatedDistance !== undefined) {
|
package/lib/antv2/spd/adapter.js
CHANGED
|
@@ -8,7 +8,7 @@ const types_1 = require("../../types");
|
|
|
8
8
|
class AntSpdAdapter extends adapter_1.default {
|
|
9
9
|
mapToAdapterData(deviceData) {
|
|
10
10
|
if (deviceData.CalculatedSpeed !== undefined) {
|
|
11
|
-
this.data.speed = deviceData.CalculatedSpeed;
|
|
11
|
+
this.data.speed = deviceData.CalculatedSpeed * 3.6;
|
|
12
12
|
this.data.timestamp = Date.now();
|
|
13
13
|
}
|
|
14
14
|
if (deviceData.CalculatedDistance !== undefined) {
|
|
@@ -56,7 +56,8 @@ class CscMeasurement {
|
|
|
56
56
|
}
|
|
57
57
|
if (c.revolutions < p.revolutions)
|
|
58
58
|
revs += 0x10000;
|
|
59
|
-
|
|
59
|
+
const seconds = time / 1024;
|
|
60
|
+
rpm = 60 * revs / seconds;
|
|
60
61
|
}
|
|
61
62
|
else if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
|
62
63
|
rpm = 0;
|
|
@@ -85,7 +86,8 @@ class CscMeasurement {
|
|
|
85
86
|
time += 0x10000;
|
|
86
87
|
this.timeOffset += 0x10000;
|
|
87
88
|
}
|
|
88
|
-
const
|
|
89
|
+
const seconds = time / 1024;
|
|
90
|
+
const rps = revs / seconds;
|
|
89
91
|
speed = rps * this.cw;
|
|
90
92
|
}
|
|
91
93
|
else if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
package/lib/ble/csc/adapter.js
CHANGED
package/lib/ble/csc/sensor.js
CHANGED
|
@@ -31,7 +31,9 @@ class BleCyclingSpeedCadenceDevice extends sensor_1.TBleSensor {
|
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
try {
|
|
33
33
|
const data = yield this.read(consts_1.CSC_FEATURE);
|
|
34
|
-
|
|
34
|
+
const features = this.featureParser.parse(data);
|
|
35
|
+
this.logEvent({ message: 'supported features', features, raw: data === null || data === void 0 ? void 0 : data.toString('hex') });
|
|
36
|
+
return features;
|
|
35
37
|
}
|
|
36
38
|
catch (err) {
|
|
37
39
|
this.logEvent({ message: 'read failed', characteristic: consts_1.CSC_FEATURE, reason: err.message });
|
|
@@ -59,7 +59,6 @@ class SmartTrainerCyclingMode extends power_base_1.default {
|
|
|
59
59
|
catch (err) {
|
|
60
60
|
this.logger.logEvent({ message: "error", fn: 'sendBikeUpdate()', error: err.message, stack: err.stack });
|
|
61
61
|
}
|
|
62
|
-
console.log('#sendBikeUpdate', newRequest);
|
|
63
62
|
return newRequest;
|
|
64
63
|
}
|
|
65
64
|
}
|