diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java index 1694765c..827742f6 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java @@ -187,6 +187,7 @@ public class BluetoothMiScale2 extends BluetoothCommunication { scaleBtData.setVisceralFat(miScaleLib.getVisceralFat(weight)); scaleBtData.setFat(miScaleLib.getBodyFat(weight, impedance)); scaleBtData.setMuscle((100.0f / weight) * miScaleLib.getMuscle(weight, impedance)); // convert muscle in kg to percent + scaleBtData.setLbm(miScaleLib.getLBM(weight, impedance)); scaleBtData.setBone(miScaleLib.getBoneMass(weight, impedance)); } else { Timber.d("Impedance value is zero"); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/lib/MiScaleLib.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/lib/MiScaleLib.java index 47537b9d..1ae5effd 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/lib/MiScaleLib.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/lib/MiScaleLib.java @@ -44,17 +44,21 @@ public class MiScaleLib { return weight / (((height * height) / 100.0f) / 100.0f); } + public float getLBM(float weight, float impedance) { + float leanBodyMass = weight - ((getBodyFat(weight, impedance) * 0.01f) * weight) - getBoneMass(weight, impedance); + + if (sex == 0 && leanBodyMass >= 84.0f) { + leanBodyMass = 120.0f; + } + else if (sex == 1 && leanBodyMass >= 93.5f) { + leanBodyMass = 120.0f; + } + + return leanBodyMass; + } + public float getMuscle(float weight, float impedance) { - float muscleMass = weight - ((getBodyFat(weight, impedance) * 0.01f) * weight) - getBoneMass(weight, impedance); - - if (sex == 0 && muscleMass >= 84.0f) { - muscleMass = 120.0f; - } - else if (sex == 1 && muscleMass >= 93.5f) { - muscleMass = 120.0f; - } - - return muscleMass; + return this.getLBM(weight,impedance); // this is wrong but coherent with MiFit app behaviour } public float getWater(float weight, float impedance) { diff --git a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java index f92b9bf6..b02286a7 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java +++ b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationSheet.java @@ -39,6 +39,9 @@ public class EvaluationSheet { private List bmiEvaluateSheet_Man; private List bmiEvaluateSheet_Woman; + private List lbmEvaluateSheet_Man; + private List lbmEvaluateSheet_Woman; + private List waistEvaluateSheet_Man; private List waistEvaluateSheet_Woman; @@ -91,6 +94,9 @@ public class EvaluationSheet { visceralFatEvaluateSheet = new ArrayList<>(); + lbmEvaluateSheet_Man = new ArrayList<>(); + lbmEvaluateSheet_Woman = new ArrayList<>(); + initEvaluationSheets(); } @@ -163,6 +169,22 @@ public class EvaluationSheet { whrEvaluateSheet_Woman.add(new sheetEntry(18, 90, 0.7f, 0.8f)); visceralFatEvaluateSheet.add(new sheetEntry(18, 90, -1, 12)); + // Lean body mass reference: "Lean body mass: reference values for Italian population between 18 to 88 years old" DOI: 10.26355/eurrev_201811_16415 + // assuming low limits as P25 and upper limit as P75 + lbmEvaluateSheet_Man.add(new sheetEntry(18, 24, 52.90f, 62.70f)); + lbmEvaluateSheet_Man.add(new sheetEntry(25, 34, 53.10f, 64.80f)); + lbmEvaluateSheet_Man.add(new sheetEntry(35, 44, 53.83f, 65.60f)); + lbmEvaluateSheet_Man.add(new sheetEntry(45, 54, 53.60f, 65.20f)); + lbmEvaluateSheet_Man.add(new sheetEntry(55, 64, 51.63f, 61.10f)); + lbmEvaluateSheet_Man.add(new sheetEntry(65, 74, 48.48f, 58.20f)); + lbmEvaluateSheet_Man.add(new sheetEntry(75, 88, 43.35f, 60.23f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(18, 24, 34.30f, 41.90f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(25, 34, 35.20f, 43.70f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(35, 44, 35.60f, 47.10f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(45, 54, 36.10f, 44.90f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(55, 64, 35.15f, 43.95f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(65, 74, 34.10f, 42.05f)); + lbmEvaluateSheet_Woman.add(new sheetEntry(75, 88, 33.80f, 40.40f)); } @@ -239,6 +261,18 @@ public class EvaluationSheet { return evaluateSheet(bmi, bodyEvaluateSheet); } + public EvaluationResult evaluateLBM(float lbm) { + List bodyEvaluateSheet; + + if (evalUser.getGender().isMale()) { + bodyEvaluateSheet = lbmEvaluateSheet_Man; + } else { + bodyEvaluateSheet = lbmEvaluateSheet_Woman; + } + + return evaluateSheet(lbm, bodyEvaluateSheet); + } + public EvaluationResult evaluateWaist(float waist) { List bodyEvaluateSheet; diff --git a/android_app/app/src/main/java/com/health/openscale/gui/measurement/LBMMeasurementView.java b/android_app/app/src/main/java/com/health/openscale/gui/measurement/LBMMeasurementView.java index 4928adaf..c1d39729 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/measurement/LBMMeasurementView.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/measurement/LBMMeasurementView.java @@ -86,6 +86,6 @@ public class LBMMeasurementView extends FloatMeasurementView { @Override protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) { - return null; + return evalSheet.evaluateLBM(value); } }