1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-29 19:20:36 +02:00

Ignore 17th byte of the message in the Excelvan scales; some variants include an optional 'physiological age'.

This allows supporting (at least) the Excelvan CF366BLE using the existing driver with no other changes needed.
This commit is contained in:
Paul Cowan
2018-07-02 09:53:12 +10:00
parent c346e30ae3
commit 9caacddb79

View File

@@ -117,8 +117,10 @@ public class BluetoothExcelvanCF369BLE extends BluetoothCommunication {
if (data != null && data.length > 0) { if (data != null && data.length > 0) {
// if data is body scale type // if data is body scale type. At least some variants (e.g. CF366BLE) of this scale
if (data.length == 16 && data[0] == (byte)0xcf) { // return a 17th byte representing "physiological age". Allow (but ignore) that byte
// to support those variants.
if ((data.length >= 16 && data.length <= 17) && data[0] == (byte)0xcf) {
if (!Arrays.equals(data, receivedData)) { // accepts only one data of the same content if (!Arrays.equals(data, receivedData)) { // accepts only one data of the same content
receivedData = data; receivedData = data;
parseBytes(data); parseBytes(data);
@@ -135,6 +137,7 @@ public class BluetoothExcelvanCF369BLE extends BluetoothCommunication {
float visceralFat = weightBytes[11] & 0xFF; float visceralFat = weightBytes[11] & 0xFF;
float water = Converters.fromUnsignedInt16Be(weightBytes, 12) / 10.0f; float water = Converters.fromUnsignedInt16Be(weightBytes, 12) / 10.0f;
float bmr = Converters.fromUnsignedInt16Be(weightBytes, 14); float bmr = Converters.fromUnsignedInt16Be(weightBytes, 14);
// weightBytes[16] is an (optional, ignored) "physiological age" in some scale variants.
ScaleMeasurement scaleBtData = new ScaleMeasurement(); ScaleMeasurement scaleBtData = new ScaleMeasurement();