From f287c04ad9395070a23d681d872cc702597bb492 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 24 Oct 2015 11:12:40 +0900 Subject: [PATCH] Pebble: simplify Misfit data parsing, since all assumptions seem to be wrong :/ --- .../service/devices/pebble/AppMessageHandlerMisfit.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMisfit.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMisfit.java index 1a835b04..c44070f3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMisfit.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMisfit.java @@ -74,14 +74,13 @@ public class AppMessageHandlerMisfit extends AppMessageHandler { GBActivitySample[] activitySamples = new GBActivitySample[samples]; for (int i = 0; i < samples; i++) { short sample = buf.getShort(); - if ((sample & 0x0001) == 0 || (sample & 0xff00) == 0) { // 16-??? steps encoded in bits 1-7 + if ((sample & 0x0001) == 0) { // 16-??? steps encoded in bits 1-7 steps = (sample & 0x00fe); - } else if ((sample & 0x0001) == 0x0001) { // 0-14 steps encoded in bits 1-3, most of the time fc71 bits are set in that case + } else { // 0-14 steps encoded in bits 1-3, most of the time fc71 bits are set in that case // 0040 also set always? steps = (sample & 0x000e); - } else { - steps = 0; } + totalSteps += steps; LOG.info("got steps for sample " + i + " : " + steps + "(" + Integer.toHexString(sample & 0xffff) + ")"); byte activityKind = ActivityKind.TYPE_UNKNOWN;