incyclist-devices 2.0.5 → 2.0.6

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.
@@ -194,8 +194,8 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
194
194
  const opts = props || {};
195
195
  const { args = {}, user = {} } = opts;
196
196
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
197
- const { timeout = 20000 } = props || {};
198
- const totalTimeout = timeout + 10000;
197
+ const { startupTimeout = 20000, reconnectTimeout = 2000 } = props || {};
198
+ const totalTimeout = Math.min(startupTimeout + 10000, startupTimeout * 2);
199
199
  let to;
200
200
  const stopTimeoutCheck = () => {
201
201
  if (to) {
@@ -224,7 +224,7 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
224
224
  }
225
225
  if (this.sensorConnected && !hasData) {
226
226
  try {
227
- yield this.waitForData(timeout);
227
+ yield this.waitForData(startupTimeout);
228
228
  hasData = true;
229
229
  }
230
230
  catch (err) {
@@ -235,12 +235,12 @@ class AntFEAdapter extends adapter_1.ControllableAntAdapter {
235
235
  }
236
236
  catch (_a) { }
237
237
  this.started = false;
238
- return reject(new Error('could not start device, reason: no data received'));
238
+ return reject(new Error('could not start device, reason:no data received'));
239
239
  }
240
240
  }
241
241
  status = { userSent: false, slopeSent: false };
242
242
  if (!hasData) {
243
- yield (0, utils_2.sleep)(2000);
243
+ yield (0, utils_2.sleep)(reconnectTimeout);
244
244
  continue;
245
245
  }
246
246
  if (!this.isReconnecting) {
@@ -65,8 +65,10 @@ class IncyclistDevice extends events_1.default {
65
65
  if (!this.logger || this.paused)
66
66
  return;
67
67
  this.logger.logEvent(event);
68
- const logText = '~~~' + this.getInterface().toUpperCase();
69
- console.log(logText, event);
68
+ if (process.env.BLE_DEBUG || process.env.ANT_DEBUG) {
69
+ const logText = '~~~' + this.getInterface().toUpperCase();
70
+ console.log(logText, event);
71
+ }
70
72
  }
71
73
  getMaxUpdateFrequency() {
72
74
  return this.updateFrequency;
@@ -88,7 +88,9 @@ class BleComms extends events_1.default {
88
88
  if (this.logger) {
89
89
  this.logger.logEvent(event);
90
90
  }
91
- console.log('~~~BLE:', event);
91
+ if (process.env.BLE_DEBUG) {
92
+ console.log('~~~BLE:', event);
93
+ }
92
94
  }
93
95
  setLogger(logger) {
94
96
  this.logger = logger;
@@ -80,7 +80,9 @@ class BleInterface extends events_1.default {
80
80
  if (this.logger) {
81
81
  this.logger.logEvent(event);
82
82
  }
83
- console.log('~~BLE:', event);
83
+ if (process.env.BLE_DEBUG) {
84
+ console.log('~~BLE:', event);
85
+ }
84
86
  }
85
87
  onStateChange(state) {
86
88
  if (state !== 'poweredOn') {
@@ -32,7 +32,9 @@ class BlePeripheralConnector {
32
32
  if (this.logger) {
33
33
  this.logger.logEvent(event);
34
34
  }
35
- console.log('~~~BLE:', event);
35
+ if (process.env.BLE_DEBUG) {
36
+ console.log('~~~BLE:', event);
37
+ }
36
38
  }
37
39
  connect() {
38
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -68,7 +68,7 @@ export declare class DaumClassicSimulator {
68
68
  simulateTimeout(ms: number): void;
69
69
  simulateNoResponse(cnt?: number): void;
70
70
  simulateIllegalResponse(cnt?: number): void;
71
- isPedalling(): 1 | 0;
71
+ isPedalling(): 0 | 1;
72
72
  }
73
73
  export declare class DaumClassicMockBinding extends MockPortBinding {
74
74
  prevCommand: Buffer;
@@ -2,7 +2,7 @@ export declare const DEFAULT_AGE = 30;
2
2
  export declare const DEFAULT_USER_WEIGHT = 75;
3
3
  export declare const DEFAULT_BIKE_WEIGHT = 10;
4
4
  export declare function getCockpit(c: any): "Cardio" | "Fitness" | "Vita De Luxe" | "8008" | "8008 TRS" | "8080" | "Therapie" | "8008 TRS Pro" | "8008 TRS3" | "ergo_lyps Cardio Pro" | "Unknown";
5
- export declare function getBikeType(type: any): 1 | 0;
5
+ export declare function getBikeType(type: any): 0 | 1;
6
6
  export declare function getGender(sex: any): 1 | 2;
7
7
  export declare function getLength(length: any): number;
8
8
  export declare function getWeight(weight?: any): number;
@@ -185,7 +185,6 @@ class DaumPremiumAdapter extends DaumAdapter_1.default {
185
185
  if (!info.version) {
186
186
  info.version = yield this.bike.getProtocolVersion();
187
187
  }
188
- console.log('~~~~ starting Daum8i', this.getCyclingMode().getName(), this.getCyclingMode().getModeProperty('eppSupport'));
189
188
  if (this.getCyclingMode().getModeProperty('eppSupport')) {
190
189
  const bikeType = this.getCyclingMode().getSetting('bikeType');
191
190
  if (!info.upload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",