1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Huawei: added measurement units for altitude #4044

This commit is contained in:
Me7c7 2024-08-30 21:40:31 +03:00
parent f983060cb2
commit 74b9298a6b

View File

@ -709,28 +709,28 @@ public class HuaweiWorkoutGbParser {
if (altitudeCount > 0) { if (altitudeCount > 0) {
JSONObject avgAltitudeJson = new JSONObject(); JSONObject avgAltitudeJson = new JSONObject();
avgAltitudeJson.put("value", avgAltitude); avgAltitudeJson.put("value", avgAltitude / 10.0);
avgAltitudeJson.put("unit", ""); avgAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS);
jsonObject.put(ActivitySummaryEntries.ALTITUDE_AVG, avgAltitudeJson); jsonObject.put(ActivitySummaryEntries.ALTITUDE_AVG, avgAltitudeJson);
JSONObject minAltitudeJson = new JSONObject(); JSONObject minAltitudeJson = new JSONObject();
minAltitudeJson.put("value", minAltitude); minAltitudeJson.put("value", minAltitude / 10.0);
minAltitudeJson.put("unit", ""); minAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS);
jsonObject.put(ActivitySummaryEntries.ALTITUDE_MIN, minAltitudeJson); jsonObject.put(ActivitySummaryEntries.ALTITUDE_MIN, minAltitudeJson);
JSONObject maxAltitudeJson = new JSONObject(); JSONObject maxAltitudeJson = new JSONObject();
maxAltitudeJson.put("value", maxAltitude); maxAltitudeJson.put("value", maxAltitude / 10.0);
maxAltitudeJson.put("unit", ""); maxAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS);
jsonObject.put(ActivitySummaryEntries.ALTITUDE_MAX, maxAltitudeJson); jsonObject.put(ActivitySummaryEntries.ALTITUDE_MAX, maxAltitudeJson);
JSONObject sumUpAltitudeJson = new JSONObject(); JSONObject sumUpAltitudeJson = new JSONObject();
sumUpAltitudeJson.put("value", sumAltitudeUp); sumUpAltitudeJson.put("value", sumAltitudeUp / 10.0);
sumUpAltitudeJson.put("unit", ""); sumUpAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS);
jsonObject.put(ActivitySummaryEntries.ELEVATION_GAIN, sumUpAltitudeJson); jsonObject.put(ActivitySummaryEntries.ELEVATION_GAIN, sumUpAltitudeJson);
JSONObject sumDownAltitudeJson = new JSONObject(); JSONObject sumDownAltitudeJson = new JSONObject();
sumDownAltitudeJson.put("value", sumAltitudeDown); sumDownAltitudeJson.put("value", sumAltitudeDown / 10.0);
sumDownAltitudeJson.put("unit", ""); sumDownAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS);
jsonObject.put(ActivitySummaryEntries.ELEVATION_LOSS, sumDownAltitudeJson); jsonObject.put(ActivitySummaryEntries.ELEVATION_LOSS, sumDownAltitudeJson);
} }
} }