1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 02:25:50 +01:00

Huami activity summary fields for ascent, descent and flat distances

This commit is contained in:
Sebastian Krey 2021-12-25 17:24:09 +01:00 committed by Gitea
parent 504b552f0c
commit 241bc02cc0
3 changed files with 15 additions and 7 deletions

View File

@ -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");

View File

@ -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'], " +

View File

@ -1120,6 +1120,8 @@
<string name="distanceMeters">Distance</string>
<string name="ascentMeters">Uphill</string>
<string name="descentMeters">Downhill</string>
<string name="ascentDistance">Uphill distance</string>
<string name="descentDistance">Downhill distance</string>
<string name="maxAltitude">Maximum</string>
<string name="minAltitude">Minimum</string>
<string name="averageAltitude">Average</string>