From e2492368732ab14e47050f1989bf6fabddbc18a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 13 Dec 2024 13:52:30 +0200 Subject: [PATCH] Xiaomi: Parse more fields in freestyle activity parser for v8/9/10 Specifically: workout type, configured time/calories goal, workout load and vitality gain. --- .../xiaomi/activity/impl/WorkoutSummaryParser.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/activity/impl/WorkoutSummaryParser.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/activity/impl/WorkoutSummaryParser.java index e7f3dc7d5..2607957f2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/activity/impl/WorkoutSummaryParser.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/activity/impl/WorkoutSummaryParser.java @@ -289,16 +289,23 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi builder.addInt(HR_ZONE_WARM_UP, UNIT_SECONDS); if (version == 5) { builder.addUnknown(10); - builder.addShort(XIAOMI_WORKOUT_TYPE, UNIT_NONE); + builder.addShort(XIAOMI_WORKOUT_TYPE, XIAOMI_WORKOUT_TYPE); builder.addUnknown(2); builder.addUnknown(2); // configuredTimeGoal, UNIT_SECONDS builder.addUnknown(2); builder.addUnknown(2); // configuredCaloriesGoal, UNIT_KCAL } else { builder.addUnknown(2); - builder.addUnknown(4); + builder.addUnknown(4); // activeSeconds again?, UNIT_SECONDS builder.addFloat(TRAINING_EFFECT_ANAEROBIC, UNIT_NONE); - builder.addUnknown(3); + builder.addUnknown(1); + builder.addShort(XIAOMI_WORKOUT_TYPE, XIAOMI_WORKOUT_TYPE); + builder.addUnknown(2); + builder.addInt("configuredTimeGoal", UNIT_SECONDS); + builder.addShort("configuredCaloriesGoal", UNIT_KCAL); + builder.addShort(WORKOUT_LOAD, UNIT_NONE); + builder.addUnknown(1); + builder.addByte("vitality_gain", UNIT_NONE); } return builder.build(); }