diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiActivitySummaryParser.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiActivitySummaryParser.java index 26c3f4878..4e4b346d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiActivitySummaryParser.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiActivitySummaryParser.java @@ -93,6 +93,9 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser { float caloriesBurnt; float distanceMeters; float distanceMeters2 = 0; + float ascentDistance = 0; + float descentDistance = 0; + float flatDistance = 0; float ascentMeters = 0; float descentMeters = 0; float maxAltitude = 0; @@ -183,11 +186,11 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser { // for cycling it seems to work... hmm... // 28 bytes buffer.getInt(); // unknown - buffer.getInt(); // unknown + ascentDistance = buffer.getFloat(); ascentSeconds = buffer.getInt() / 1000; //ms? - buffer.getInt(); // unknown; + descentDistance = buffer.getFloat(); descentSeconds = buffer.getInt() / 1000; //ms? - buffer.getInt(); // unknown; + flatDistance = buffer.getFloat(); flatSeconds = buffer.getInt() / 1000; // ms? } else if (activityKind == ActivityKind.TYPE_SWIMMING || activityKind == ActivityKind.TYPE_SWIMMING_OPENWATER) { // offset 0x8c @@ -253,11 +256,11 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser { } else { // 28 bytes buffer.getInt(); // unknown - buffer.getInt(); // unknown + buffer.getInt(); // unknown probably ascentDistance = buffer.getFloat(); ascentSeconds = buffer.getInt() / 1000; //ms? - buffer.getInt(); // unknown; + buffer.getInt(); // unknown probably descentDistance = buffer.getFloat(); descentSeconds = buffer.getInt() / 1000; //ms? - buffer.getInt(); // unknown; + buffer.getInt(); // unknown probably flatDistance = buffer.getFloat(); flatSeconds = buffer.getInt() / 1000; // ms? addSummaryData("ascentSeconds", ascentSeconds, "seconds"); @@ -298,6 +301,9 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser { addSummaryData("ascentSeconds", ascentSeconds, "seconds"); addSummaryData("descentSeconds", descentSeconds, "seconds"); addSummaryData("flatSeconds", flatSeconds, "seconds"); + addSummaryData("ascentDistance", ascentDistance, "meters"); + addSummaryData("descentDistance", descentDistance, "meters"); + addSummaryData("flatDistance", flatDistance, "meters"); addSummaryData("distanceMeters", distanceMeters, "meters"); // addSummaryData("distanceMeters2", distanceMeters2, "meters"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySummaryJsonSummary.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySummaryJsonSummary.java index b9cd6e552..cd10334e9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySummaryJsonSummary.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySummaryJsonSummary.java @@ -145,7 +145,7 @@ public class ActivitySummaryJsonSummary { private JSONObject createActivitySummaryGroups(){ String groupDefinitions = "{'Strokes':['averageStrokeDistance','averageStrokesPerSecond','strokes'], " + "'Swimming':['swolfIndex','swimStyle'], " + - "'Elevation':['ascentMeters','descentMeters','maxAltitude','minAltitude','averageAltitude','ascentSeconds','descentSeconds','flatSeconds', 'baseAltitude'], " + + "'Elevation':['ascentMeters','descentMeters','maxAltitude','minAltitude','averageAltitude', 'baseAltitude','ascentSeconds','descentSeconds','flatSeconds','ascentDistance','descentDistance','flatDistance'], " + "'Speed':['averageSpeed','maxSpeed','minSpeed','averageKMPaceSeconds','minPace','maxPace','averageSpeed2','averageCadence','maxCadence','minCadence'], " + "'Activity':['distanceMeters','steps','activeSeconds','caloriesBurnt','totalStride'," + "'averageHR','maxHR','minHR','averageStride','maxStride','minStride'], " + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 771648978..53662dfce 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1120,6 +1120,8 @@ Distance Uphill Downhill + Uphill distance + Downhill distance Maximum Minimum Average