mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: fix scaling for FitSession's TotalDistance, TotalTimerTime and getStandTime
This commit is contained in:
+3
-9
@@ -398,12 +398,8 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
|
||||
summary.setEndTime(new Date(summary.getStartTime().getTime() + session.getTotalElapsedTime().intValue()));
|
||||
}
|
||||
|
||||
if (session.getTotalTimerTime() != null) {
|
||||
summaryData.add(ACTIVE_SECONDS, session.getTotalTimerTime() / 1000.0f, UNIT_SECONDS);
|
||||
}
|
||||
if (session.getTotalDistance() != null) {
|
||||
summaryData.add(DISTANCE_METERS, session.getTotalDistance() / 100.0f, UNIT_METERS);
|
||||
}
|
||||
summaryData.add(ACTIVE_SECONDS, session.getTotalTimerTime(), UNIT_SECONDS);
|
||||
summaryData.add(DISTANCE_METERS, session.getTotalDistance(), UNIT_METERS);
|
||||
summaryData.add(POOL_LENGTH, session.getPoolLength(), UNIT_METERS);
|
||||
summaryData.add(SWOLF_AVG, session.getAvgSwolf(), UNIT_NONE);
|
||||
if (cycleUnit != ActivityKind.CycleUnit.NONE) {
|
||||
@@ -537,9 +533,7 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
|
||||
summaryData.add(NORMALIZED_POWER, session.getNormalizedPower(), UNIT_WATT);
|
||||
summaryData.add(TOTAL_WORK, session.getTotalWork(), UNIT_JOULE);
|
||||
|
||||
if (session.getStandTime() != null) {
|
||||
summaryData.add(STANDING_TIME, session.getStandTime() / 1000, UNIT_SECONDS);
|
||||
}
|
||||
summaryData.add(STANDING_TIME, session.getStandTime(), UNIT_SECONDS);
|
||||
summaryData.add(STANDING_COUNT, session.getStandCount(), UNIT_NONE);
|
||||
summaryData.add(AVG_LEFT_PCO, session.getAvgLeftPco(), UNIT_MM);
|
||||
summaryData.add(AVG_RIGHT_PCO, session.getAvgRightPco(), UNIT_MM);
|
||||
|
||||
+4
-4
@@ -296,9 +296,9 @@ public class NativeFITMessage {
|
||||
new FieldDefinitionPrimitive(4, BaseType.SINT32, "start_longitude", FieldDefinitionFactory.FIELD.COORDINATE),
|
||||
new FieldDefinitionPrimitive(5, BaseType.ENUM, "sport"),
|
||||
new FieldDefinitionPrimitive(6, BaseType.ENUM, "sub_sport"),
|
||||
new FieldDefinitionPrimitive(7, BaseType.UINT32, "total_elapsed_time"), // with pauses
|
||||
new FieldDefinitionPrimitive(8, BaseType.UINT32, "total_timer_time"), // no pauses
|
||||
new FieldDefinitionPrimitive(9, BaseType.UINT32, "total_distance"), // cm
|
||||
new FieldDefinitionPrimitive(7, BaseType.UINT32, "total_elapsed_time"), // ms - with pauses - keep it in ms to avoid rounding issue for DB calculations
|
||||
new FieldDefinitionPrimitive(8, BaseType.UINT32, "total_timer_time", 1000, 0), // s - no pauses
|
||||
new FieldDefinitionPrimitive(9, BaseType.UINT32, "total_distance", 100, 0), // m
|
||||
new FieldDefinitionPrimitive(10, BaseType.UINT32, "total_cycles"),
|
||||
new FieldDefinitionPrimitive(11, BaseType.UINT16, "total_calories"),
|
||||
new FieldDefinitionPrimitive(13, BaseType.UINT16, "total_fat_calories"), // kcal
|
||||
@@ -390,7 +390,7 @@ public class NativeFITMessage {
|
||||
new FieldDefinitionPrimitive(108, BaseType.UINT16, "rear_shifts"),
|
||||
new FieldDefinitionPrimitive(110, BaseType.STRING, 64, "sport_profile_name"),
|
||||
new FieldDefinitionPrimitive(111, BaseType.UINT8, "sport_index"),
|
||||
new FieldDefinitionPrimitive(112, BaseType.UINT32, "stand_time"), // s
|
||||
new FieldDefinitionPrimitive(112, BaseType.UINT32, "stand_time", 1000, 0), // s
|
||||
new FieldDefinitionPrimitive(113, BaseType.UINT16, "stand_count"),
|
||||
new FieldDefinitionPrimitive(114, BaseType.SINT8, "avg_left_pco"), // mm
|
||||
new FieldDefinitionPrimitive(115, BaseType.SINT8, "avg_right_pco"), // mm
|
||||
|
||||
+9
-9
@@ -86,13 +86,13 @@ public class FitSession extends RecordData {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getTotalTimerTime() {
|
||||
return getFieldByNumber(8, Long.class);
|
||||
public Double getTotalTimerTime() {
|
||||
return getFieldByNumber(8, Double.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getTotalDistance() {
|
||||
return getFieldByNumber(9, Long.class);
|
||||
public Double getTotalDistance() {
|
||||
return getFieldByNumber(9, Double.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -551,8 +551,8 @@ public class FitSession extends RecordData {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getStandTime() {
|
||||
return getFieldByNumber(112, Long.class);
|
||||
public Double getStandTime() {
|
||||
return getFieldByNumber(112, Double.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1018,12 +1018,12 @@ public class FitSession extends RecordData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTotalTimerTime(final Long value) {
|
||||
public Builder setTotalTimerTime(final Double value) {
|
||||
setFieldByNumber(8, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTotalDistance(final Long value) {
|
||||
public Builder setTotalDistance(final Double value) {
|
||||
setFieldByNumber(9, value);
|
||||
return this;
|
||||
}
|
||||
@@ -1483,7 +1483,7 @@ public class FitSession extends RecordData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setStandTime(final Long value) {
|
||||
public Builder setStandTime(final Double value) {
|
||||
setFieldByNumber(112, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user