From 74b9298a6bd69bf891b25735dfa926d979ca9506 Mon Sep 17 00:00:00 2001 From: Me7c7 Date: Fri, 30 Aug 2024 21:40:31 +0300 Subject: [PATCH] Huawei: added measurement units for altitude #4044 --- .../devices/huawei/HuaweiWorkoutGbParser.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiWorkoutGbParser.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiWorkoutGbParser.java index 4ae76f4d7..776c923da 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiWorkoutGbParser.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiWorkoutGbParser.java @@ -709,28 +709,28 @@ public class HuaweiWorkoutGbParser { if (altitudeCount > 0) { JSONObject avgAltitudeJson = new JSONObject(); - avgAltitudeJson.put("value", avgAltitude); - avgAltitudeJson.put("unit", ""); + avgAltitudeJson.put("value", avgAltitude / 10.0); + avgAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS); jsonObject.put(ActivitySummaryEntries.ALTITUDE_AVG, avgAltitudeJson); JSONObject minAltitudeJson = new JSONObject(); - minAltitudeJson.put("value", minAltitude); - minAltitudeJson.put("unit", ""); + minAltitudeJson.put("value", minAltitude / 10.0); + minAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS); jsonObject.put(ActivitySummaryEntries.ALTITUDE_MIN, minAltitudeJson); JSONObject maxAltitudeJson = new JSONObject(); - maxAltitudeJson.put("value", maxAltitude); - maxAltitudeJson.put("unit", ""); + maxAltitudeJson.put("value", maxAltitude / 10.0); + maxAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS); jsonObject.put(ActivitySummaryEntries.ALTITUDE_MAX, maxAltitudeJson); JSONObject sumUpAltitudeJson = new JSONObject(); - sumUpAltitudeJson.put("value", sumAltitudeUp); - sumUpAltitudeJson.put("unit", ""); + sumUpAltitudeJson.put("value", sumAltitudeUp / 10.0); + sumUpAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS); jsonObject.put(ActivitySummaryEntries.ELEVATION_GAIN, sumUpAltitudeJson); JSONObject sumDownAltitudeJson = new JSONObject(); - sumDownAltitudeJson.put("value", sumAltitudeDown); - sumDownAltitudeJson.put("unit", ""); + sumDownAltitudeJson.put("value", sumAltitudeDown / 10.0); + sumDownAltitudeJson.put("unit", ActivitySummaryEntries.UNIT_METERS); jsonObject.put(ActivitySummaryEntries.ELEVATION_LOSS, sumDownAltitudeJson); } }