incyclist-devices 1.4.54 → 1.4.55

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.
@@ -25,7 +25,8 @@ const TIMEOUT_ACK = 5000;
25
25
  const TIMEOUT_START = 10000;
26
26
  const TIMEOUT_ATTACH = 3000;
27
27
  const DEFAULT_USER_WEIGHT = 75;
28
- const DEFAULT_BIKE_WEIGHT = 12.75;
28
+ const DEFAULT_BIKE_WEIGHT = 10;
29
+ const DEFAULT_BIKE_WEIGHT_MOUNTAIN = 14.5;
29
30
  class AntFEAdapter extends AntAdapter_1.default {
30
31
  constructor(DeviceID, port, stick, protocol) {
31
32
  super(protocol);
@@ -214,7 +215,7 @@ class AntFEAdapter extends AntAdapter_1.default {
214
215
  yield _super.start.call(this, props);
215
216
  this.logger.logEvent({ message: 'start()', props });
216
217
  const opts = props || {};
217
- const { args = {} } = opts;
218
+ const { args = {}, user = {} } = opts;
218
219
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
219
220
  if (this.ignoreHrm && this.ignoreBike && this.ignorePower) {
220
221
  this.logger.logEvent({ message: 'start() not done: bike disabled' });
@@ -269,8 +270,13 @@ class AntFEAdapter extends AntAdapter_1.default {
269
270
  yield this.sendTrackResistance(0.0);
270
271
  status.trackResistanceSent = true;
271
272
  }
273
+ const mode = this.getCyclingMode();
274
+ const bikeType = mode ? mode.getSetting('bikeType').toLowerCase() : 'race';
275
+ const defaultBikeWeight = bikeType === 'mountain' ? DEFAULT_BIKE_WEIGHT_MOUNTAIN : DEFAULT_BIKE_WEIGHT;
272
276
  if (!status.userSent) {
273
- yield this.sendUserConfiguration(args.userWeight || DEFAULT_USER_WEIGHT, args.bikeWeight || DEFAULT_BIKE_WEIGHT, args.wheelDiameter, args.gearRatio);
277
+ const userWeight = args.userWeight || user.weight || DEFAULT_USER_WEIGHT;
278
+ const bikeWeight = args.bikeWeight || defaultBikeWeight;
279
+ yield this.sendUserConfiguration(userWeight, bikeWeight, args.wheelDiameter, args.gearRatio);
274
280
  status.userSent = true;
275
281
  }
276
282
  this.started = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.54",
3
+ "version": "1.4.55",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",