Description
While trying to connect zwifit (connected with Proform 995i via BLE) with a Garmin Fenix 5 got a crash on the zwifit app.
This would be useful to perform a Garmin Coach training plan workout.
Steps To Reproduce
Connect the treadmill with Zwifit via BLE
Activate the Run-Speed-Cadence profile
In the watch add zwifit as a sensor
Start a treadmill activity
Zwifit crash
Expected behavior
Should work as with zwift
Logs
0|app | Connected to Zwift (watch MAC address)
0|app | RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 3. Received 4
0|app | at boundsError (internal/buffer.js:77:9)
0|app | at Buffer.readUInt8 (internal/buffer.js:243:5)
0|app | at parseCommandHeader (/home/pi/zwifit/src/ble/ifit/_request.js:707:29)
0|app | at /home/pi/zwifit/src/ble/ifit/_request.js:166:18
0|app | at Characteristic.listener (/home/pi/zwifit/src/ble/ifit/_request.js:657:4)
0|app | at Characteristic.emit (events.js:327:22)
0|app | at Noble.onRead (/home/pi/zwifit/node_modules/noble/lib/noble.js:414:20)
0|app | at NobleBindings.emit (events.js:315:20)
0|app | at NobleBindings.onNotification (/home/pi/zwifit/node_modules/noble/lib/hci-socket/bindings.js:448:8)
0|app | at Gatt.emit (events.js:315:20) {
0|app | code: 'ERR_OUT_OF_RANGE'
0|app | }
Debug
Added printing to the buffer:
0|app | writeRequestAndGatherResponse: 4
0|app | writeRequestAndGatherResponse: <Buffer 01 00 00 00>
Description While trying to connect zwifit (connected with Proform 995i via BLE) with a Garmin Fenix 5 got a crash on the zwifit app. This would be useful to perform a Garmin Coach training plan workout.
Steps To Reproduce
Expected behavior Should work as with zwift
Logs 0|app | Connected to Zwift (watch MAC address) 0|app | RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 3. Received 4 0|app | at boundsError (internal/buffer.js:77:9) 0|app | at Buffer.readUInt8 (internal/buffer.js:243:5) 0|app | at parseCommandHeader (/home/pi/zwifit/src/ble/ifit/_request.js:707:29) 0|app | at /home/pi/zwifit/src/ble/ifit/_request.js:166:18 0|app | at Characteristic.listener (/home/pi/zwifit/src/ble/ifit/_request.js:657:4) 0|app | at Characteristic.emit (events.js:327:22) 0|app | at Noble.onRead (/home/pi/zwifit/node_modules/noble/lib/noble.js:414:20) 0|app | at NobleBindings.emit (events.js:315:20) 0|app | at NobleBindings.onNotification (/home/pi/zwifit/node_modules/noble/lib/hci-socket/bindings.js:448:8) 0|app | at Gatt.emit (events.js:315:20) { 0|app | code: 'ERR_OUT_OF_RANGE' 0|app | }
Debug Added printing to the buffer: 0|app | writeRequestAndGatherResponse: 4 0|app | writeRequestAndGatherResponse: <Buffer 01 00 00 00>
So tried to discard packets with size <= 4 (is set to <4 only) https://github.com/dawsontoth/zwifit/blob/master/src/ble/ifit/_request.js#L698
But started to get random disconnects from treadmill as soon as the activity on the watch starts