mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 19:06:53 +01:00
Zepp OS: Display HR zones and Training Effect in Activity Details
This commit is contained in:
parent
7d516a9c96
commit
d655f434f8
@ -113,11 +113,24 @@ public class Huami2021ActivitySummaryParser extends HuamiActivitySummaryParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (summaryProto.hasHeartRateZones()) {
|
if (summaryProto.hasHeartRateZones()) {
|
||||||
// TODO HR zones
|
// TODO hr zones bpm?
|
||||||
|
if (summaryProto.getHeartRateZones().getZoneTimeCount() == 6) {
|
||||||
|
addSummaryData("hrZoneNa", summaryProto.getHeartRateZones().getZoneTime(0), "seconds");
|
||||||
|
addSummaryData("hrZoneWarmUp", summaryProto.getHeartRateZones().getZoneTime(1), "seconds");
|
||||||
|
addSummaryData("hrZoneFatBurn", summaryProto.getHeartRateZones().getZoneTime(2), "seconds");
|
||||||
|
addSummaryData("hrZoneAerobic", summaryProto.getHeartRateZones().getZoneTime(3), "seconds");
|
||||||
|
addSummaryData("hrZoneAnaerobic", summaryProto.getHeartRateZones().getZoneTime(4), "seconds");
|
||||||
|
addSummaryData("hrZoneExtreme", summaryProto.getHeartRateZones().getZoneTime(5), "seconds");
|
||||||
|
} else {
|
||||||
|
LOG.warn("Unexpected number of HR zones {}", summaryProto.getHeartRateZones().getZoneTimeCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (summaryProto.hasTrainingEffect()) {
|
if (summaryProto.hasTrainingEffect()) {
|
||||||
// TODO training effect
|
addSummaryData("aerobicTrainingEffect", summaryProto.getTrainingEffect().getAerobicTrainingEffect(), "");
|
||||||
|
addSummaryData("anaerobicTrainingEffect", summaryProto.getTrainingEffect().getAnaerobicTrainingEffect(), "");
|
||||||
|
addSummaryData("currentWorkoutLoad", summaryProto.getTrainingEffect().getCurrentWorkoutLoad(), "");
|
||||||
|
addSummaryData("maximumOxygenUptake", summaryProto.getTrainingEffect().getMaximumOxygenUptake(), "ml/kg/min");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,11 @@ import org.json.JSONObject;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiActivitySummaryParser;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiActivitySummaryParser;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.BaseActivitySummary;
|
import nodomain.freeyourgadget.gadgetbridge.entities.BaseActivitySummary;
|
||||||
@ -144,20 +148,39 @@ public class ActivitySummaryJsonSummary {
|
|||||||
return defaultGroup;
|
return defaultGroup;
|
||||||
}
|
}
|
||||||
private JSONObject createActivitySummaryGroups(){
|
private JSONObject createActivitySummaryGroups(){
|
||||||
String groupDefinitions = "{'Strokes':['averageStrokeDistance','averageStrokesPerSecond','strokes'], " +
|
final Map<String, List<String>> groupDefinitions = new HashMap<String, List<String>>() {{
|
||||||
"'Swimming':['swolfIndex','swimStyle'], " +
|
put("Strokes", Arrays.asList(
|
||||||
"'Elevation':['ascentMeters','descentMeters','maxAltitude','minAltitude','averageAltitude', 'baseAltitude','ascentSeconds','descentSeconds','flatSeconds','ascentDistance','descentDistance','flatDistance'], " +
|
"averageStrokeDistance", "averageStrokesPerSecond", "strokes"
|
||||||
"'Speed':['averageSpeed','maxSpeed','minSpeed','averageKMPaceSeconds','minPace','maxPace','averageSpeed2','averageCadence','maxCadence','minCadence'], " +
|
));
|
||||||
"'Activity':['distanceMeters','steps','activeSeconds','caloriesBurnt','totalStride'," +
|
put("Swimming", Arrays.asList(
|
||||||
"'averageHR','maxHR','minHR','averageStride','maxStride','minStride'], " +
|
"swolfIndex", "swimStyle"
|
||||||
"'Laps':['averageLapPace','laps']}";
|
));
|
||||||
JSONObject data = null;
|
put("Elevation", Arrays.asList(
|
||||||
try {
|
"ascentMeters", "descentMeters", "maxAltitude", "minAltitude", "averageAltitude",
|
||||||
data = new JSONObject(groupDefinitions);
|
"baseAltitude", "ascentSeconds", "descentSeconds", "flatSeconds", "ascentDistance",
|
||||||
} catch (JSONException e) {
|
"descentDistance", "flatDistance"
|
||||||
LOG.error("SportsActivity", e);
|
));
|
||||||
}
|
put("Speed", Arrays.asList(
|
||||||
return data;
|
"averageSpeed", "maxSpeed", "minSpeed", "averageKMPaceSeconds", "minPace",
|
||||||
}
|
"maxPace", "averageSpeed2", "averageCadence", "maxCadence", "minCadence"
|
||||||
|
));
|
||||||
|
put("Activity", Arrays.asList(
|
||||||
|
"distanceMeters", "steps", "activeSeconds", "caloriesBurnt", "totalStride",
|
||||||
|
"averageHR", "maxHR", "minHR", "averageStride", "maxStride", "minStride"
|
||||||
|
));
|
||||||
|
put("HeartRateZones", Arrays.asList(
|
||||||
|
"hrZoneNa", "hrZoneWarmUp", "hrZoneFatBurn", "hrZoneAerobic", "hrZoneAnaerobic",
|
||||||
|
"hrZoneExtreme"
|
||||||
|
));
|
||||||
|
put("TrainingEffect", Arrays.asList(
|
||||||
|
"aerobicTrainingEffect", "anaerobicTrainingEffect", "currentWorkoutLoad",
|
||||||
|
"maximumOxygenUptake"
|
||||||
|
));
|
||||||
|
put("Laps", Arrays.asList(
|
||||||
|
"averageLapPace", "laps"
|
||||||
|
));
|
||||||
|
}};
|
||||||
|
|
||||||
|
return new JSONObject(groupDefinitions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class DateTimeUtils {
|
|||||||
public static String formatDurationHoursMinutes(long duration, TimeUnit unit) {
|
public static String formatDurationHoursMinutes(long duration, TimeUnit unit) {
|
||||||
DurationFormatter df = DurationFormatter.Builder.SYMBOLS
|
DurationFormatter df = DurationFormatter.Builder.SYMBOLS
|
||||||
.maximum(TimeUnit.DAYS)
|
.maximum(TimeUnit.DAYS)
|
||||||
.minimum(TimeUnit.MINUTES)
|
.minimum(TimeUnit.SECONDS)
|
||||||
.suppressZeros(DurationFormatter.SuppressZeros.LEADING, DurationFormatter.SuppressZeros.TRAILING)
|
.suppressZeros(DurationFormatter.SuppressZeros.LEADING, DurationFormatter.SuppressZeros.TRAILING)
|
||||||
.maximumAmountOfUnitsToShow(2)
|
.maximumAmountOfUnitsToShow(2)
|
||||||
.build();
|
.build();
|
||||||
|
@ -1374,6 +1374,18 @@
|
|||||||
<string name="maxHR">Max Heartrate</string>
|
<string name="maxHR">Max Heartrate</string>
|
||||||
<string name="minHR">Min Heartrate</string>
|
<string name="minHR">Min Heartrate</string>
|
||||||
<string name="averageKMPaceSeconds">Pace</string>
|
<string name="averageKMPaceSeconds">Pace</string>
|
||||||
|
<string name="HeartRateZones">Heart Rate Zones</string>
|
||||||
|
<string name="hrZoneNa">N/A</string>
|
||||||
|
<string name="hrZoneWarmUp">Warm-Up</string>
|
||||||
|
<string name="hrZoneFatBurn">Fat Burn</string>
|
||||||
|
<string name="hrZoneAerobic">Aerobic</string>
|
||||||
|
<string name="hrZoneAnaerobic">Anaerobic</string>
|
||||||
|
<string name="hrZoneExtreme">Extreme</string>
|
||||||
|
<string name="TrainingEffect">Training Effect</string>
|
||||||
|
<string name="aerobicTrainingEffect">Aerobic Effect</string>
|
||||||
|
<string name="anaerobicTrainingEffect">Anaerobic Effect</string>
|
||||||
|
<string name="currentWorkoutLoad">Workout Load</string>
|
||||||
|
<string name="maximumOxygenUptake">Maximum Oxygen Uptake</string>
|
||||||
<string name="averageStride">Average Stride</string>
|
<string name="averageStride">Average Stride</string>
|
||||||
<string name="maxStride">Max Stride</string>
|
<string name="maxStride">Max Stride</string>
|
||||||
<string name="minStride">Min Stride</string>
|
<string name="minStride">Min Stride</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user