incyclist-devices 1.4.89 → 1.4.90
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/ble-device.js +0 -1
- package/lib/ble/wahoo-kickr.d.ts +12 -0
- package/lib/ble/wahoo-kickr.js +6 -2
- package/package.json +1 -1
package/lib/ble/ble-device.js
CHANGED
|
@@ -276,7 +276,6 @@ class BleDevice extends ble_1.BleDeviceClass {
|
|
|
276
276
|
onData(characteristic, data) {
|
|
277
277
|
const isDuplicate = this.checkForDuplicate(characteristic, data);
|
|
278
278
|
if (isDuplicate) {
|
|
279
|
-
console.log('~~~ duplicate data', characteristic, data.toString('hex'));
|
|
280
279
|
return;
|
|
281
280
|
}
|
|
282
281
|
this.logEvent({ message: 'got data', characteristic, data: data.toString('hex'), writeQueue: this.writeQueue.length });
|
package/lib/ble/wahoo-kickr.d.ts
CHANGED
|
@@ -3,6 +3,18 @@ import BleProtocol from './incyclist-protocol';
|
|
|
3
3
|
import { BleDeviceClass, BleWriteProps } from './ble';
|
|
4
4
|
import DeviceAdapter from '../Device';
|
|
5
5
|
import BleFitnessMachineDevice, { FmAdapter } from './fm';
|
|
6
|
+
export declare const enum OpCode {
|
|
7
|
+
unlock = 32,
|
|
8
|
+
setResistanceMode = 64,
|
|
9
|
+
setStandardMode = 65,
|
|
10
|
+
setErgMode = 66,
|
|
11
|
+
setSimMode = 67,
|
|
12
|
+
setSimCRR = 68,
|
|
13
|
+
setSimWindResistance = 69,
|
|
14
|
+
setSimGrade = 70,
|
|
15
|
+
setSimWindSpeed = 71,
|
|
16
|
+
setWheelCircumference = 72
|
|
17
|
+
}
|
|
6
18
|
declare type IndoorBikeData = {
|
|
7
19
|
speed?: number;
|
|
8
20
|
averageSpeed?: number;
|
package/lib/ble/wahoo-kickr.js
CHANGED
|
@@ -340,8 +340,12 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
340
340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
341
|
this.logger.logEvent({ message: 'setSimGrade', slope });
|
|
342
342
|
try {
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
let s = slope;
|
|
344
|
+
if (s < -100)
|
|
345
|
+
s = -100;
|
|
346
|
+
if (s > 100)
|
|
347
|
+
s = 100;
|
|
348
|
+
const slopeVal = Math.min(Math.floor(327.68 * s), 32767);
|
|
345
349
|
const data = Buffer.alloc(2);
|
|
346
350
|
data.writeInt16LE(slopeVal, 0);
|
|
347
351
|
const res = yield this.writeWahooFtmsMessage(70, data);
|