incyclist-devices 2.3.16 → 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/factories/adapters.d.ts +1 -1
- package/lib/factories/adapters.js +1 -4
- package/lib/modes/antble-smarttrainer.js +4 -3
- 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 });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IncyclistDeviceAdapter } from "../base/adpater";
|
|
2
2
|
import { DeviceProperties, DeviceSettings } from "../types/device";
|
|
3
3
|
export default class AdapterFactory {
|
|
4
|
-
static adapters: IncyclistDeviceAdapter[];
|
|
4
|
+
protected static adapters: IncyclistDeviceAdapter[];
|
|
5
5
|
static reset(): void;
|
|
6
6
|
static create(settings: DeviceSettings, props?: DeviceProperties): any;
|
|
7
7
|
}
|
|
@@ -40,10 +40,7 @@ class AdapterFactory {
|
|
|
40
40
|
adapter = ble_1.BleAdapterFactory.getInstance('ble').createInstance(settings, props);
|
|
41
41
|
break;
|
|
42
42
|
case device_1.INTERFACE.DC:
|
|
43
|
-
|
|
44
|
-
const factory = ble_1.BleAdapterFactory.getInstance('wifi');
|
|
45
|
-
adapter = ble_1.BleAdapterFactory.getInstance('wifi').createInstance(settings, props);
|
|
46
|
-
}
|
|
43
|
+
adapter = ble_1.BleAdapterFactory.getInstance('wifi').createInstance(settings, props);
|
|
47
44
|
break;
|
|
48
45
|
case device_1.INTERFACE.SIMULATOR:
|
|
49
46
|
adapter = new Simulator_1.Simulator(settings, props);
|
|
@@ -25,10 +25,10 @@ class SmartTrainerCyclingMode extends power_base_1.default {
|
|
|
25
25
|
}
|
|
26
26
|
checkSlope(request, newRequest = {}) {
|
|
27
27
|
if (request.slope !== undefined) {
|
|
28
|
-
newRequest.slope = parseFloat(request.slope.toFixed(1));
|
|
28
|
+
const targetSlope = newRequest.slope = parseFloat(request.slope.toFixed(1));
|
|
29
29
|
this.data.slope = newRequest.slope;
|
|
30
30
|
try {
|
|
31
|
-
const slopeAdj = this.getSetting('slopeAdj');
|
|
31
|
+
const slopeAdj = targetSlope >= 0 ? this.getSetting('slopeAdj') : this.getSetting('slopeAdjDown');
|
|
32
32
|
if (slopeAdj !== undefined)
|
|
33
33
|
newRequest.slope = newRequest.slope * slopeAdj / 100;
|
|
34
34
|
}
|
|
@@ -68,7 +68,8 @@ SmartTrainerCyclingMode.config = {
|
|
|
68
68
|
description: "Calculates speed based on power and slope. Slope is set to the device",
|
|
69
69
|
properties: [
|
|
70
70
|
{ key: 'bikeType', name: 'Bike Type', description: '', type: types_1.CyclingModeProperyType.SingleSelect, options: ['Race', 'Mountain', 'Triathlon'], default: 'Race' },
|
|
71
|
-
{ key: 'slopeAdj', name: '
|
|
71
|
+
{ key: 'slopeAdj', name: 'Bike Reality Factor', description: 'Percentage of slope that should be sent to the SmartTrainer. Should be used in case the slopes are feeling too hard', type: types_1.CyclingModeProperyType.Integer, default: 100, min: 0, max: 200 },
|
|
72
|
+
{ key: 'slopeAdjDown', name: 'Bike Reality Factor downhill', description: 'Percentage of slope that should be sent during downhill sections. Should be used to avoid spinning out', type: types_1.CyclingModeProperyType.Integer, default: 50, min: 0, max: 100 }
|
|
72
73
|
]
|
|
73
74
|
};
|
|
74
75
|
exports.default = SmartTrainerCyclingMode;
|