From 6792ca77c1fe10806ea3695384b8565d28246fcc Mon Sep 17 00:00:00 2001 From: Lars Berning <151194+laberning@users.noreply.github.com> Date: Mon, 31 Jan 2022 19:47:18 +0100 Subject: [PATCH] fixes #57 where diagram would show spikes --- app/ble/ftms/RowerDataCharacteristic.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/ble/ftms/RowerDataCharacteristic.js b/app/ble/ftms/RowerDataCharacteristic.js index 2c03ca7..6f9c63a 100644 --- a/app/ble/ftms/RowerDataCharacteristic.js +++ b/app/ble/ftms/RowerDataCharacteristic.js @@ -68,8 +68,11 @@ export default class RowerDataCharacteristic extends bleno.Characteristic { // Total Distance in meters bufferBuilder.writeUInt24LE(Math.round(data.distanceTotal)) // Instantaneous Pace in seconds/500m - // if split is infinite (i.e. while pausing), use the highest possible number - bufferBuilder.writeUInt16LE(data.split !== Infinity ? Math.round(data.split) : 0xFFFF) + // if split is infinite (i.e. while pausing), should use the highest possible number (0xFFFF) + // todo: eventhough mathematically correct, setting 0xFFFF (65535s) causes some ugly spikes + // in some applications which could shift the axis (i.e. workout diagrams in MyHomeFit) + // so instead for now we use 0 here + bufferBuilder.writeUInt16LE(data.split !== Infinity ? Math.round(data.split) : 0) // Instantaneous Power in watts bufferBuilder.writeUInt16LE(Math.round(data.power)) // Energy in kcal