mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
ExerciseRoute requires strictly increasing timestamps; duplicate-second points from device GPS parsers (e.g. Xiaomi Smart Band 9 Pro outdoor cycling) caused IllegalArgumentException at construction time, aborting the workout sync entirely. Extract route construction into buildSanitisedRoute, which: - drops points outside the workout time window - drops points with non-finite or out-of-range lat/lng (HC's Location constructor enforces lat in [-90, 90], lng in [-180, 180]) - drops points with non-finite or negative hdop/vdop accuracy (HC rejects negative accuracy) - deduplicates points by Instant - returns null if fewer than two usable points remain - catches IllegalArgumentException as a safety net so future HC invariants degrade gracefully (workout saves without route rather than the whole sync aborting) Logs dropped points with the [HC_SYNC] prefix so users can grep.