1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Fossil/Skagen Hybrids: Increase accuracy of workout distance calculation

This commit is contained in:
Arjan Schrijver 2023-06-19 15:57:09 +02:00
parent a5868f8f00
commit 7c5cd4c032

View File

@ -53,7 +53,7 @@ public class WorkoutRequestHandler {
addStateResponse(workoutResponse, "success", ""); addStateResponse(workoutResponse, "success", "");
OpenTracksController.startRecording(context, activityKind); OpenTracksController.startRecording(context, activityKind);
} else if (workoutRequest.optString("type").equals("req_distance")) { } else if (workoutRequest.optString("type").equals("req_distance")) {
long timeSecs = GBApplication.app().getOpenTracksObserver().getTimeMillisChange() / 1000; long timeSecs = Math.round(GBApplication.app().getOpenTracksObserver().getTimeMillisChange() / 1000f);
float distanceCM = GBApplication.app().getOpenTracksObserver().getDistanceMeterChange() * 100; float distanceCM = GBApplication.app().getOpenTracksObserver().getDistanceMeterChange() * 100;
LOG.info("Workout distance requested, returning " + distanceCM + " cm, " + timeSecs + " sec"); LOG.info("Workout distance requested, returning " + distanceCM + " cm, " + timeSecs + " sec");
workoutResponse.put("workoutApp._.config.gps", new JSONObject() workoutResponse.put("workoutApp._.config.gps", new JSONObject()