incyclist-devices 1.5.8 → 1.5.10

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/antv2/fe.js CHANGED
@@ -225,9 +225,11 @@ class AntFEAdapter extends ant_device_1.default {
225
225
  const userWeight = args.userWeight || user.weight || DEFAULT_USER_WEIGHT;
226
226
  const bikeWeight = args.bikeWeight || defaultBikeWeight;
227
227
  let i = 0;
228
- while (i < 3 && !status.userSent && !status.slopeSent) {
229
- status.userSent = status.userSent || (yield fe.sendUserConfiguration(userWeight, bikeWeight, args.wheelDiameter, args.gearRatio));
230
- status.slopeSent = status.slopeSent || (yield fe.sendTrackResistance(0.0));
228
+ while (i < 3 && (!status.userSent || !status.slopeSent)) {
229
+ if (!timeout || iv)
230
+ status.userSent = status.userSent || (yield fe.sendUserConfiguration(userWeight, bikeWeight, args.wheelDiameter, args.gearRatio));
231
+ if (!timeout || iv)
232
+ status.slopeSent = status.slopeSent || (yield fe.sendTrackResistance(0.0));
231
233
  i++;
232
234
  }
233
235
  stopInterval();
@@ -7,6 +7,8 @@ export default class DaumPremiumDevice extends DaumAdapter {
7
7
  getInterface(): any;
8
8
  getSupportedCyclingModes(): Array<any>;
9
9
  check(): Promise<unknown>;
10
+ relaunch(props: any): Promise<unknown>;
10
11
  start(props: any): Promise<unknown>;
12
+ launch(props: any, isRelaunch?: boolean): Promise<unknown>;
11
13
  getCurrentBikeData(): Promise<any>;
12
14
  }
@@ -62,11 +62,20 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
62
62
  }
63
63
  }));
64
64
  }
65
+ relaunch(props) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ this.logger.logEvent({ message: 'relaunch()' });
68
+ return yield this.launch(props, true);
69
+ });
70
+ }
65
71
  start(props) {
66
72
  return __awaiter(this, void 0, void 0, function* () {
67
73
  this.logger.logEvent({ message: 'start()' });
68
- console.log('~~~setPersonSupport:', this.getCyclingMode().getModeProperty('setPersonSupport'));
69
- console.log('~~~eppSupport:', this.getCyclingMode().getModeProperty('eppSupport'));
74
+ return yield this.launch(props, false);
75
+ });
76
+ }
77
+ launch(props, isRelaunch = false) {
78
+ return __awaiter(this, void 0, void 0, function* () {
70
79
  const opts = props || {};
71
80
  if (opts.user && opts.user.weight)
72
81
  this.userSettings.weight = opts.user.weight;
@@ -77,16 +86,14 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
77
86
  var info = {};
78
87
  this.initData();
79
88
  return (0, utils_1.runWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
80
- if (this.isStopped())
81
- return;
82
89
  try {
83
- if (!this.bike.isConnected()) {
90
+ if (!isRelaunch && !this.bike.isConnected()) {
84
91
  yield this.bike.saveConnect();
85
92
  }
86
- if (!info.deviceType) {
93
+ if (!isRelaunch && !info.deviceType) {
87
94
  info.deviceType = yield this.bike.getDeviceType();
88
95
  }
89
- if (!info.version) {
96
+ if (!isRelaunch && !info.version) {
90
97
  info.version = yield this.bike.getProtocolVersion();
91
98
  }
92
99
  if (this.getCyclingMode().getModeProperty('eppSupport')) {
@@ -113,7 +120,8 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
113
120
  }
114
121
  }), 5, 1500)
115
122
  .then(data => {
116
- this.startUpdatePull();
123
+ if (!isRelaunch || this.isStopped())
124
+ this.startUpdatePull();
117
125
  return data;
118
126
  });
119
127
  });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",
7
7
  "@types/serialport": "^8.0.1",
8
8
  "gd-ant-plus": "^0.0.33",
9
- "incyclist-ant-plus": "^0.1.5",
9
+ "incyclist-ant-plus": "^0.1.7",
10
10
  "win32filetime": "^1.0.2"
11
11
  },
12
12
  "peerDependencies": {