mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-03 17:02:13 +01:00
Xiaomi: Fix steps and stress parsing for some devices
This commit is contained in:
parent
facf87fc59
commit
641eb1bee7
@ -88,7 +88,12 @@ public class DailyDetailsParser extends XiaomiActivityParser {
|
||||
final XiaomiActivitySample sample = new XiaomiActivitySample();
|
||||
sample.setTimestamp((int) (timestamp.getTimeInMillis() / 1000));
|
||||
|
||||
sample.setSteps(buf.getShort());
|
||||
// we only need the first 14 bits of the 2 bytes
|
||||
// FIXME we should parse the header
|
||||
final byte[] steps = new byte[2];
|
||||
buf.get(steps);
|
||||
final int stepsNum = (steps[0] & 0xff) | (((steps[1] >> 2) & 0xff) << 8);
|
||||
sample.setSteps(stepsNum);
|
||||
|
||||
final int calories = buf.get() & 0xff;
|
||||
final int unk2 = buf.get() & 0xff;
|
||||
@ -105,9 +110,12 @@ public class DailyDetailsParser extends XiaomiActivityParser {
|
||||
if (version == 3) {
|
||||
// TODO gadgets with versions 2 also should have stress, but the values don't make sense
|
||||
sample.setSpo2(buf.get() & 0xff);
|
||||
int stress = buf.get() & 0xff;
|
||||
if (stress != 0xff) {
|
||||
sample.setStress(buf.get() & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
samples.add(sample);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user