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.
@@ -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 });
@@ -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;
@@ -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
- const value = (slope / 100.0 + 1.0) * 32768;
344
- const slopeVal = Math.floor(value);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.89",
3
+ "version": "1.4.90",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",