incyclist-devices 1.4.83 → 1.4.84
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/ble/wahoo-kickr.js +3 -4
- package/package.json +1 -1
package/lib/ble/wahoo-kickr.js
CHANGED
|
@@ -189,17 +189,18 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
189
189
|
writeWahooFtmsMessage(requestedOpCode, data) {
|
|
190
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
191
|
try {
|
|
192
|
+
this.logEvent({ message: 'wahoo cp:write', data: data.toString('hex') });
|
|
192
193
|
const opcode = Buffer.alloc(1);
|
|
193
194
|
opcode.writeUInt8(requestedOpCode, 0);
|
|
194
195
|
const message = Buffer.concat([opcode, data]);
|
|
195
196
|
const res = yield this.write(this.wahooCP, message);
|
|
196
197
|
const responseData = Buffer.from(res);
|
|
197
198
|
const result = responseData.readUInt8(0);
|
|
198
|
-
this.logEvent({ message: 'response', opCode: requestedOpCode, response: responseData.toString('hex') });
|
|
199
|
+
this.logEvent({ message: 'wahoo cp:response', opCode: requestedOpCode, response: responseData.toString('hex') });
|
|
199
200
|
return result === 1;
|
|
200
201
|
}
|
|
201
202
|
catch (err) {
|
|
202
|
-
this.logEvent({ message: '
|
|
203
|
+
this.logEvent({ message: 'wahoo cp:write failed', opCode: requestedOpCode, reason: err.message });
|
|
203
204
|
return false;
|
|
204
205
|
}
|
|
205
206
|
});
|
|
@@ -209,8 +210,6 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
|
|
|
209
210
|
if (this.hasControl)
|
|
210
211
|
return true;
|
|
211
212
|
this.logEvent({ message: 'requestControl' });
|
|
212
|
-
this.hasControl = true;
|
|
213
|
-
return;
|
|
214
213
|
const data = Buffer.alloc(2);
|
|
215
214
|
data.writeUInt8(0xEE, 0);
|
|
216
215
|
data.writeUInt8(0xFC, 1);
|