mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-22 16:23:09 +02:00
Miscale2 lean mass fix (#906)
* Add LBM data to MiScale2 * Add LBM evaluation sheet
This commit is contained in:
@@ -187,6 +187,7 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
|
|||||||
scaleBtData.setVisceralFat(miScaleLib.getVisceralFat(weight));
|
scaleBtData.setVisceralFat(miScaleLib.getVisceralFat(weight));
|
||||||
scaleBtData.setFat(miScaleLib.getBodyFat(weight, impedance));
|
scaleBtData.setFat(miScaleLib.getBodyFat(weight, impedance));
|
||||||
scaleBtData.setMuscle((100.0f / weight) * miScaleLib.getMuscle(weight, impedance)); // convert muscle in kg to percent
|
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));
|
scaleBtData.setBone(miScaleLib.getBoneMass(weight, impedance));
|
||||||
} else {
|
} else {
|
||||||
Timber.d("Impedance value is zero");
|
Timber.d("Impedance value is zero");
|
||||||
|
@@ -44,17 +44,21 @@ public class MiScaleLib {
|
|||||||
return weight / (((height * height) / 100.0f) / 100.0f);
|
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) {
|
public float getMuscle(float weight, float impedance) {
|
||||||
float muscleMass = weight - ((getBodyFat(weight, impedance) * 0.01f) * weight) - getBoneMass(weight, impedance);
|
return this.getLBM(weight,impedance); // this is wrong but coherent with MiFit app behaviour
|
||||||
|
|
||||||
if (sex == 0 && muscleMass >= 84.0f) {
|
|
||||||
muscleMass = 120.0f;
|
|
||||||
}
|
|
||||||
else if (sex == 1 && muscleMass >= 93.5f) {
|
|
||||||
muscleMass = 120.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
return muscleMass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getWater(float weight, float impedance) {
|
public float getWater(float weight, float impedance) {
|
||||||
|
@@ -39,6 +39,9 @@ public class EvaluationSheet {
|
|||||||
private List<sheetEntry> bmiEvaluateSheet_Man;
|
private List<sheetEntry> bmiEvaluateSheet_Man;
|
||||||
private List<sheetEntry> bmiEvaluateSheet_Woman;
|
private List<sheetEntry> bmiEvaluateSheet_Woman;
|
||||||
|
|
||||||
|
private List<sheetEntry> lbmEvaluateSheet_Man;
|
||||||
|
private List<sheetEntry> lbmEvaluateSheet_Woman;
|
||||||
|
|
||||||
private List<sheetEntry> waistEvaluateSheet_Man;
|
private List<sheetEntry> waistEvaluateSheet_Man;
|
||||||
private List<sheetEntry> waistEvaluateSheet_Woman;
|
private List<sheetEntry> waistEvaluateSheet_Woman;
|
||||||
|
|
||||||
@@ -91,6 +94,9 @@ public class EvaluationSheet {
|
|||||||
|
|
||||||
visceralFatEvaluateSheet = new ArrayList<>();
|
visceralFatEvaluateSheet = new ArrayList<>();
|
||||||
|
|
||||||
|
lbmEvaluateSheet_Man = new ArrayList<>();
|
||||||
|
lbmEvaluateSheet_Woman = new ArrayList<>();
|
||||||
|
|
||||||
initEvaluationSheets();
|
initEvaluationSheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +169,22 @@ public class EvaluationSheet {
|
|||||||
whrEvaluateSheet_Woman.add(new sheetEntry(18, 90, 0.7f, 0.8f));
|
whrEvaluateSheet_Woman.add(new sheetEntry(18, 90, 0.7f, 0.8f));
|
||||||
|
|
||||||
visceralFatEvaluateSheet.add(new sheetEntry(18, 90, -1, 12));
|
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);
|
return evaluateSheet(bmi, bodyEvaluateSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EvaluationResult evaluateLBM(float lbm) {
|
||||||
|
List<sheetEntry> bodyEvaluateSheet;
|
||||||
|
|
||||||
|
if (evalUser.getGender().isMale()) {
|
||||||
|
bodyEvaluateSheet = lbmEvaluateSheet_Man;
|
||||||
|
} else {
|
||||||
|
bodyEvaluateSheet = lbmEvaluateSheet_Woman;
|
||||||
|
}
|
||||||
|
|
||||||
|
return evaluateSheet(lbm, bodyEvaluateSheet);
|
||||||
|
}
|
||||||
|
|
||||||
public EvaluationResult evaluateWaist(float waist) {
|
public EvaluationResult evaluateWaist(float waist) {
|
||||||
List<sheetEntry> bodyEvaluateSheet;
|
List<sheetEntry> bodyEvaluateSheet;
|
||||||
|
|
||||||
|
@@ -86,6 +86,6 @@ public class LBMMeasurementView extends FloatMeasurementView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||||
return null;
|
return evalSheet.evaluateLBM(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user