incyclist-devices 1.4.86 → 1.4.87
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
CHANGED
|
@@ -13,6 +13,7 @@ exports.BleDevice = void 0;
|
|
|
13
13
|
const gd_eventlog_1 = require("gd-eventlog");
|
|
14
14
|
const ble_1 = require("./ble");
|
|
15
15
|
const CONNECT_WAIT_TIMEOUT = 10000;
|
|
16
|
+
const BLE_TIMEOUT = 1000;
|
|
16
17
|
class BleDevice extends ble_1.BleDeviceClass {
|
|
17
18
|
constructor(props) {
|
|
18
19
|
super();
|
|
@@ -344,7 +345,7 @@ class BleDevice extends ble_1.BleDeviceClass {
|
|
|
344
345
|
else {
|
|
345
346
|
const writeId = this.writeQueue.length;
|
|
346
347
|
let messageDeleted = false;
|
|
347
|
-
this.writeQueue.push({ uuid: characteristicUuid.toLocaleLowerCase(), data, timeout: Date.now() +
|
|
348
|
+
this.writeQueue.push({ uuid: characteristicUuid.toLocaleLowerCase(), data, timeout: Date.now() + BLE_TIMEOUT, resolve, reject });
|
|
348
349
|
const to = setTimeout(() => {
|
|
349
350
|
if (this.writeQueue.length > writeId && !messageDeleted)
|
|
350
351
|
this.writeQueue.splice(writeId, 1);
|
package/lib/ble/wahoo-kickr.d.ts
CHANGED
package/lib/ble/wahoo-kickr.js
CHANGED
|
@@ -54,6 +54,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
54
54
|
this.timeOffset = 0;
|
|
55
55
|
this.tsPrevWrite = undefined;
|
|
56
56
|
this.prevSlope = undefined;
|
|
57
|
+
this.weight = Device_1.DEFAULT_BIKE_WEIGHT + Device_1.DEFAULT_USER_WEIGHT;
|
|
57
58
|
this.data = {};
|
|
58
59
|
this.wahooCP = consts_1.WAHOO_ADVANCED_TRAINER_CP;
|
|
59
60
|
}
|
|
@@ -277,6 +278,9 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
277
278
|
this.logEvent({ message: 'setSimMode failed', reason: 'control is disabled' });
|
|
278
279
|
return false;
|
|
279
280
|
}
|
|
281
|
+
this.weight = weight;
|
|
282
|
+
this.crr = crr;
|
|
283
|
+
this.cw = cw;
|
|
280
284
|
const data = Buffer.alloc(6);
|
|
281
285
|
data.writeInt16LE(Math.round(weight * 100), 0);
|
|
282
286
|
data.writeInt16LE(Math.round(crr * 10000), 2);
|
|
@@ -374,10 +378,9 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
374
378
|
if (this.prevSlope !== undefined && slope === this.prevSlope)
|
|
375
379
|
return;
|
|
376
380
|
try {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.
|
|
380
|
-
return false;
|
|
381
|
+
if (!this.isSimMode) {
|
|
382
|
+
const { weight, crr, cw } = this;
|
|
383
|
+
yield this.setSimMode(weight, crr, cw);
|
|
381
384
|
}
|
|
382
385
|
const res = yield this.setSimGrade(slope);
|
|
383
386
|
this.logEvent({ message: 'setSlope result', res });
|