incyclist-devices 1.4.69 → 1.4.70
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/fm.js +2 -2
- package/lib/ble/wahoo-kickr.d.ts +1 -0
- package/lib/ble/wahoo-kickr.js +20 -4
- package/package.json +1 -1
package/lib/ble/fm.js
CHANGED
|
@@ -426,8 +426,8 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
|
|
|
426
426
|
return __awaiter(this, void 0, void 0, function* () {
|
|
427
427
|
const hasControl = yield this.requestControl();
|
|
428
428
|
if (!hasControl) {
|
|
429
|
-
this.logEvent({ message: '
|
|
430
|
-
return;
|
|
429
|
+
this.logEvent({ message: 'setIndoorBikeSimulation failed', reason: 'control is disabled' });
|
|
430
|
+
return false;
|
|
431
431
|
}
|
|
432
432
|
const data = Buffer.alloc(7);
|
|
433
433
|
data.writeUInt8(17, 0);
|
package/lib/ble/wahoo-kickr.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export default class WahooAdvancedFitnessMachineDevice extends BleFitnessMachine
|
|
|
34
34
|
currentCrankData: CrankData;
|
|
35
35
|
timeOffset: number;
|
|
36
36
|
tsPrevWrite: any;
|
|
37
|
+
prevSlope: any;
|
|
37
38
|
constructor(props?: any);
|
|
38
39
|
isMatching(characteristics: string[]): boolean;
|
|
39
40
|
init(): Promise<boolean>;
|
package/lib/ble/wahoo-kickr.js
CHANGED
|
@@ -37,7 +37,7 @@ const Device_1 = require("../Device");
|
|
|
37
37
|
const gd_eventlog_1 = require("gd-eventlog");
|
|
38
38
|
const fm_1 = __importStar(require("./fm"));
|
|
39
39
|
const WAHOO_ADVANCED_FTMS = 'a026e00b';
|
|
40
|
-
const WAHOO_ADVANCED_TRAINER_CP = '
|
|
40
|
+
const WAHOO_ADVANCED_TRAINER_CP = 'a026e005';
|
|
41
41
|
const cwABike = {
|
|
42
42
|
race: 0.35,
|
|
43
43
|
triathlon: 0.29,
|
|
@@ -52,6 +52,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
52
52
|
this.currentCrankData = undefined;
|
|
53
53
|
this.timeOffset = 0;
|
|
54
54
|
this.tsPrevWrite = undefined;
|
|
55
|
+
this.prevSlope = undefined;
|
|
55
56
|
this.data = {};
|
|
56
57
|
}
|
|
57
58
|
isMatching(characteristics) {
|
|
@@ -295,8 +296,23 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
295
296
|
setSlope(slope) {
|
|
296
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
298
|
this.logEvent({ message: 'setSlope', slope });
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
if (this.prevSlope !== undefined && slope === this.prevSlope)
|
|
300
|
+
return;
|
|
301
|
+
try {
|
|
302
|
+
const hasControl = yield this.requestControl();
|
|
303
|
+
if (!hasControl) {
|
|
304
|
+
this.logEvent({ message: 'setTargetPower failed', reason: 'control is disabled' });
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
const res = yield this.setSimGrade(slope);
|
|
308
|
+
this.logEvent({ message: 'setSlope result', res });
|
|
309
|
+
this.prevSlope = slope;
|
|
310
|
+
return res;
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
this.logEvent({ message: 'setSlope failed', reason: err.message || err });
|
|
314
|
+
this.prevSlope = undefined;
|
|
315
|
+
}
|
|
300
316
|
});
|
|
301
317
|
}
|
|
302
318
|
reset() {
|
|
@@ -304,7 +320,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
304
320
|
}
|
|
305
321
|
}
|
|
306
322
|
exports.default = WahooAdvancedFitnessMachineDevice;
|
|
307
|
-
WahooAdvancedFitnessMachineDevice.services = ['
|
|
323
|
+
WahooAdvancedFitnessMachineDevice.services = ['1818'];
|
|
308
324
|
WahooAdvancedFitnessMachineDevice.characteristics = ['2acc', '2ad2', '2ad6', '2ad8', '2ad9', '2ada', WAHOO_ADVANCED_TRAINER_CP];
|
|
309
325
|
ble_interface_1.default.register('WahooAdvancedFitnessMachineDevice', 'wahoo-fm', WahooAdvancedFitnessMachineDevice, WahooAdvancedFitnessMachineDevice.services);
|
|
310
326
|
class WahooAdvancedFmAdapter extends fm_1.FmAdapter {
|