Toybox.Activity.Info.offCourseDistance is always null when Off Course Warnings is off

According to the API documentation, the attribute offCourseDistance in class Toybox.Activity.Info contains the distance to the nearest point on the current course in meters. I have tested the value of this attribute with a simple data field with the following code in the compute method of the View class:

function compute(info) {
if (info != null and info has :offCourseDistance) {
if (info.offCourseDistance == null) {
return "null";
} else {
return info.offCourseDistance;
}
} else {
return "-";
}


Next, I have uploaded a course on my Garmin Edge 1030, and started riding it. The Off Course Warnings setting on the Edge is off.

While I am not riding off course, the simple data field shows null (which indicates that info.offCoursedistance is null).

When I am riding deliberately off course, the simple data field still shows null. At the same time the native data field Dist. to Next, however, shows the distance between my current location and the nearest point on the course. (This behavior of this native data field is not documented, but from experience I have learned that this is the case.) Therefore, the Edge has detected that I am indeed off course.

When I repeat this test with the Off Course Warnings setting switched on, info.offCoursedistance is still null when I am not riding off course, but some value is showing in my simple data field when I ride off course. This value, however, is sometimes null, and sometimes a numeric value, but never a value that is equal to the value in the native data field Dist. to Next.

This is not at all what I expected. I would expect info.offCoursedistance to have the following value:
  • null when I am not riding a course
  • 0 when I am riding a course, and I am not off course
  • The same value shown in native data field Dist. to Next when I am riding a course and I am off course

I would expect these values to be independent from the Off Course Warnings setting. Specifically, if Off Course Warnings is off, info.offCoursedistance should still have a value when I am riding off course. Switching on Off Course Warnings has undesired side effects (buzzes, pop-ups). And what is more, there is no way in Connect IQ to check the value of the Off Course Warnings setting.

Some additional information:
  • Garmin Edge 1030, firmware version 3.90
  • Code sample created with Eclipse IDE for Java Developers Version: Oxygen.3a Release (4.7.3a) and Connect IQ SDK 3.0.7
  • FlowState , dpawlyk , and any others who are interested,

    I've seen some agreement that a boolean API for isOffCourse could be useful. I've written up a request to add it and will send that through. I included that it would help devs to more easily create behaviors similar to that of the native apps, and that It would add consistency between devices and with any changes to firmware.
  • I can think of other things that have often been suggested to add to Activity.Info, with temperature probably being at the top of the list, that weren't added. I guess I see this as an uncommon one vs others.

    But what about something similar to the onTimer* callbacks? A callback for courses that could handle things like start, end, on course and off course (and maybe others). No change in Activity.Info, and you add the callback if your app needs them. It's actually easier to handle in apps that run on CIQ devices, as the callback are just never called (like with onTimer*).
  • I've also made another ticket to address apparent inconsistency with offCourseDistance between devices. Travis.ConnectIQ noticed inconsistency between Edge 1030 and Fenix5. I've noticed similar inconsistency with FR935 to e1030 which makes sense. We will have to explore what devices are affected and which are behaving correctly / incorrectly.
  • Hi,

    I need some advice

    I want to use locations of waypoints. Have you been able to get access to the Waypoints? They seams to be inaccessible.

    I would also like to manipulate the locations.fit file on the device (but from a PC application). Are there any libs and function that can encode and decode this file. The one in the SDK does not help me.

  • what to can do is very limited in CIQ.  You can save a way point.

    And you can get the way points and using an intent, start a naive app that uses them.

    You can not access the way points directly, get their location, or really use them in CIQ.

    That's why I use my own way points in my hiking apps.

    One thing I'll have to check is I "think" user locations may show on the map if you are using MapView or MapTrackView, so in an app, you can see them on the map, but your app doesn't even know they are being shown.