incyclist-devices 2.3.16 → 2.3.17

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.
@@ -1,7 +1,7 @@
1
1
  import { IncyclistDeviceAdapter } from "../base/adpater";
2
2
  import { DeviceProperties, DeviceSettings } from "../types/device";
3
3
  export default class AdapterFactory {
4
- static adapters: IncyclistDeviceAdapter[];
4
+ protected static adapters: IncyclistDeviceAdapter[];
5
5
  static reset(): void;
6
6
  static create(settings: DeviceSettings, props?: DeviceProperties): any;
7
7
  }
@@ -40,10 +40,7 @@ class AdapterFactory {
40
40
  adapter = ble_1.BleAdapterFactory.getInstance('ble').createInstance(settings, props);
41
41
  break;
42
42
  case device_1.INTERFACE.DC:
43
- {
44
- const factory = ble_1.BleAdapterFactory.getInstance('wifi');
45
- adapter = ble_1.BleAdapterFactory.getInstance('wifi').createInstance(settings, props);
46
- }
43
+ adapter = ble_1.BleAdapterFactory.getInstance('wifi').createInstance(settings, props);
47
44
  break;
48
45
  case device_1.INTERFACE.SIMULATOR:
49
46
  adapter = new Simulator_1.Simulator(settings, props);
@@ -25,10 +25,10 @@ class SmartTrainerCyclingMode extends power_base_1.default {
25
25
  }
26
26
  checkSlope(request, newRequest = {}) {
27
27
  if (request.slope !== undefined) {
28
- newRequest.slope = parseFloat(request.slope.toFixed(1));
28
+ const targetSlope = newRequest.slope = parseFloat(request.slope.toFixed(1));
29
29
  this.data.slope = newRequest.slope;
30
30
  try {
31
- const slopeAdj = this.getSetting('slopeAdj');
31
+ const slopeAdj = targetSlope >= 0 ? this.getSetting('slopeAdj') : this.getSetting('slopeAdjDown');
32
32
  if (slopeAdj !== undefined)
33
33
  newRequest.slope = newRequest.slope * slopeAdj / 100;
34
34
  }
@@ -59,6 +59,7 @@ class SmartTrainerCyclingMode extends power_base_1.default {
59
59
  catch (err) {
60
60
  this.logger.logEvent({ message: "error", fn: 'sendBikeUpdate()', error: err.message, stack: err.stack });
61
61
  }
62
+ console.log('#sendBikeUpdate', newRequest);
62
63
  return newRequest;
63
64
  }
64
65
  }
@@ -68,7 +69,8 @@ SmartTrainerCyclingMode.config = {
68
69
  description: "Calculates speed based on power and slope. Slope is set to the device",
69
70
  properties: [
70
71
  { key: 'bikeType', name: 'Bike Type', description: '', type: types_1.CyclingModeProperyType.SingleSelect, options: ['Race', 'Mountain', 'Triathlon'], default: 'Race' },
71
- { key: 'slopeAdj', name: 'Slope Adjustment', description: 'Percentage of slope that should be sent to the SmartTrainer. Should be used in case the slopes are feeling too hard', type: types_1.CyclingModeProperyType.Integer, default: 100, min: 0, max: 200 }
72
+ { key: 'slopeAdj', name: 'Bike Reality Factor', description: 'Percentage of slope that should be sent to the SmartTrainer. Should be used in case the slopes are feeling too hard', type: types_1.CyclingModeProperyType.Integer, default: 100, min: 0, max: 200 },
73
+ { key: 'slopeAdjDown', name: 'Bike Reality Factor downhill', description: 'Percentage of slope that should be sent during downhill sections. Should be used to avoid spinning out', type: types_1.CyclingModeProperyType.Integer, default: 50, min: 0, max: 100 }
72
74
  ]
73
75
  };
74
76
  exports.default = SmartTrainerCyclingMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.3.16",
3
+ "version": "2.3.17",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",