incyclist-devices 1.4.7 → 1.4.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.
@@ -178,7 +178,7 @@ class AntFEAdapter extends AntAdapter_1.default {
178
178
  yield _super.start.call(this, props);
179
179
  this.logger.logEvent({ message: 'start()', props });
180
180
  const opts = props || {};
181
- const { args } = opts;
181
+ const { args = {} } = opts;
182
182
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
183
183
  if (this.ignoreHrm && this.ignoreBike && this.ignorePower) {
184
184
  this.logger.logEvent({ message: 'start() not done: bike disabled' });
@@ -147,13 +147,17 @@ class DaumAdapterBase extends Device_1.default {
147
147
  return;
148
148
  if (this.ignoreBike && this.ignoreHrm && this.ignorePower)
149
149
  return;
150
- this.iv = setInterval(() => {
150
+ const ivSync = setInterval(() => {
151
151
  this.bikeSync();
152
152
  }, 1000);
153
- this.iv = setInterval(() => {
153
+ const ivUpdate = setInterval(() => {
154
154
  this.sendData();
155
155
  this.refreshRequests();
156
156
  }, 1000);
157
+ this.iv = {
158
+ sync: ivSync,
159
+ update: ivUpdate
160
+ };
157
161
  }
158
162
  connect() {
159
163
  if (!this.bike.isConnected())
@@ -173,7 +177,10 @@ class DaumAdapterBase extends Device_1.default {
173
177
  return new Promise((resolve, reject) => {
174
178
  try {
175
179
  if (this.iv) {
176
- clearInterval(this.iv);
180
+ if (this.iv.sync)
181
+ clearInterval(this.iv.sync);
182
+ if (this.iv.update)
183
+ clearInterval(this.iv.update);
177
184
  this.iv = undefined;
178
185
  }
179
186
  this.logEvent({ message: 'stop request completed' });
@@ -131,7 +131,8 @@ class ERGCyclingMode extends CyclingMode_1.CyclingModeBase {
131
131
  const prevSpeed = prevData.speed;
132
132
  const prevRequest = this.prevRequest || {};
133
133
  const data = this.data || {};
134
- const bikeType = this.getSetting('bikeType');
134
+ const bikeType = this.getSetting('bikeType').toLowerCase();
135
+ console.log('~~~ bikeType', bikeType);
135
136
  delete this.event.gearUpdated;
136
137
  delete this.event.rpmUpdated;
137
138
  if (prevData === {} || prevData.speed === undefined || prevData.speed === 0) {
@@ -26,6 +26,8 @@ const OPEN_TIMEOUT = 1000;
26
26
  const DAUM_PREMIUM_DEFAULT_PORT = 51955;
27
27
  const DAUM_PREMIUM_DEFAULT_HOST = '127.0.0.1';
28
28
  const MAX_DATA_BLOCK_SIZE = 512;
29
+ const DS_BITS_OFF = 0;
30
+ const DS_BITS_ENDLESS_RACE = 2;
29
31
  var __SerialPort = undefined;
30
32
  var net = undefined;
31
33
  const DEBUG_LOGGER = {
@@ -739,6 +741,7 @@ class Daum8i {
739
741
  const epp = route ? (0, utils_1.routeToEpp)(route) : undefined;
740
742
  const eppLength = epp ? epp.length : 0;
741
743
  const bikeTypeVal = (0, utils_1.getBikeType)(bikeType);
744
+ const wBits = route.lapMode ? DS_BITS_ENDLESS_RACE : DS_BITS_OFF;
742
745
  payload.writeInt32LE(0, 0);
743
746
  payload.writeInt8(bikeTypeVal, 4);
744
747
  payload.writeInt8(0, 5);
@@ -750,7 +753,7 @@ class Daum8i {
750
753
  payload.writeInt16LE(0, 24);
751
754
  payload.writeInt16LE(0, 26);
752
755
  payload.writeInt16LE(0, 28);
753
- payload.writeInt16LE(0, 30);
756
+ payload.writeInt16LE(wBits, 30);
754
757
  payload.writeInt32LE(7, 32);
755
758
  payload.writeInt32LE(eppLength, 36);
756
759
  this.logger.logEvent({ message: 'programUploadStart() request', bikeType, length: eppLength });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.7",
3
+ "version": "1.4.10",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",