mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-26 01:43:59 +02:00
Save body water as percentage instead of kg on BF105 (#778)
Co-authored-by: Gerald <git@cablelink.at>
This commit is contained in:
@@ -25,6 +25,7 @@ import static com.welie.blessed.BluetoothBytesParser.FORMAT_UINT8;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||||
import com.welie.blessed.BluetoothBytesParser;
|
import com.welie.blessed.BluetoothBytesParser;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -82,6 +83,20 @@ public class BluetoothBeurerBF105 extends BluetoothStandardWeightProfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ScaleMeasurement bodyCompositionMeasurementToScaleMeasurement(byte[] value) {
|
||||||
|
ScaleMeasurement measurement = super.bodyCompositionMeasurementToScaleMeasurement(value);
|
||||||
|
float weight = measurement.getWeight();
|
||||||
|
if (weight == 0.f && previousMeasurement != null) {
|
||||||
|
weight = previousMeasurement.getWeight();
|
||||||
|
}
|
||||||
|
if (weight != 0.f) {
|
||||||
|
float water = Math.round(((measurement.getWater() / weight) * 10000.f))/100.f;
|
||||||
|
measurement.setWater(water);
|
||||||
|
}
|
||||||
|
return measurement;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setNotifyVendorSpecificUserList() {
|
protected void setNotifyVendorSpecificUserList() {
|
||||||
if (setNotificationOn(SERVICE_BF105_CUSTOM, CHARACTERISTIC_USER_LIST)) {
|
if (setNotificationOn(SERVICE_BF105_CUSTOM, CHARACTERISTIC_USER_LIST)) {
|
||||||
|
Reference in New Issue
Block a user