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.
@@ -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 = (Math.min(1, Math.max(-1, slope)) + 1.0) * 65535 / 2.0;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.87",
3
+ "version": "1.4.88",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",