From 71f7cae682e9594660730730b78bc832e71917de Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Thu, 31 May 2018 21:18:05 +0200 Subject: [PATCH] Ignore the first measurement that only contains weight As reported in #282 --- .../health/openscale/core/bluetooth/BluetoothExingtechY1.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java index 78035e80..ebd71faf 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java @@ -84,7 +84,9 @@ public class BluetoothExingtechY1 extends BluetoothCommunication { public void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) { final byte[] data = gattCharacteristic.getValue(); - if (data != null && data.length == 20) { + // The first notification only includes weight and all other fields are + // either 0x00 (user info) or 0xff (fat, water, etc.) + if (data != null && data.length == 20 && data[6] != 0xff) { parseBytes(data); } }