incyclist-devices 1.4.87 → 1.4.88
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/wahoo-kickr.js +5 -2
- package/package.json +1 -1
package/lib/ble/wahoo-kickr.js
CHANGED
|
@@ -330,7 +330,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
330
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
331
331
|
this.logger.logEvent({ message: 'setSimGrade', slope });
|
|
332
332
|
try {
|
|
333
|
-
const value = (
|
|
333
|
+
const value = (slope / 100.0 + 1.0) * 32768;
|
|
334
334
|
const slopeVal = Math.floor(value);
|
|
335
335
|
const data = Buffer.alloc(2);
|
|
336
336
|
data.writeInt16LE(slopeVal, 0);
|
|
@@ -380,7 +380,9 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
380
380
|
try {
|
|
381
381
|
if (!this.isSimMode) {
|
|
382
382
|
const { weight, crr, cw } = this;
|
|
383
|
-
yield this.setSimMode(weight, crr, cw);
|
|
383
|
+
const hasSimMode = yield this.setSimMode(weight, crr, cw);
|
|
384
|
+
if (!hasSimMode)
|
|
385
|
+
throw new Error('Sim Mode not enabled');
|
|
384
386
|
}
|
|
385
387
|
const res = yield this.setSimGrade(slope);
|
|
386
388
|
this.logEvent({ message: 'setSlope result', res });
|
|
@@ -390,6 +392,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
390
392
|
catch (err) {
|
|
391
393
|
this.logEvent({ message: 'setSlope failed', reason: err.message || err });
|
|
392
394
|
this.prevSlope = undefined;
|
|
395
|
+
return false;
|
|
393
396
|
}
|
|
394
397
|
});
|
|
395
398
|
}
|