Skip to content

fix: write course points between the records, at their place on the course - #45

Open
haraldh wants to merge 1 commit into
masterfrom
haraldh/fit-course-points-inline
Open

haraldh wants to merge 1 commit into
masterfrom
haraldh/fit-course-points-inline

Conversation

@haraldh

@haraldh haraldh commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Course points used to be written all at once, before the first record. Now each one is written right after the record at its distance along the course, the way Garmin's EncodeCourse.java example does it.

  • This covers the injected course points (Start, End, every cp_min_dist) and the GPX waypoints from writeWayPoints. The way course points are picked is unchanged.
  • All course points are gathered, sorted by distance (ties by timestamp), and each one is written before the first record that lies further along the course. A course point at a track point that pt_min_dist skipped goes after the last record written. Any left over go after the last record, before the stop event.
  • The check compares against the record's own getDistance(), so both values get the SDK's centimetre rounding. Comparing against the raw double failed both ways.
  • On a one-point track, "End" now gets its own message. Before, it reused the "Start" object.
  • New test TestCourseFit.coursePointsFollowTheirRecord decodes the file and checks that every course point comes right after a record with the same distance and timestamp. It fails on master.

This changes what devices receive. It needs testing on a real Garmin device before merging (course points in "Up Ahead", Start/End, waypoint alerts).

🤖 Generated with Claude Code

…ourse

Course points (the injected Start/End/interval points and the GPX
waypoints) were all written before the first record. They are now
written right after the record at their distance along the course, as
Garmin's EncodeCourse example does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant