1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Pebble: simplify Misfit data parsing, since all assumptions seem to be wrong :/

This commit is contained in:
Andreas Shimokawa 2015-10-24 11:12:40 +09:00
parent 4b9304b897
commit f287c04ad9

View File

@ -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;