Garmin Connect IQ custom data field time in zone

883 views Asked by At

A real noob question here but I am trying to write my first ever Custom data field for my Garmin Edge 520. All that I would like to do is add up the time in Zone 3 + Zone 4 + Zone 5 and display it in a simple data field.

I'm sure that there's a simple solution but I'm looking all over and I can't see it. From the API documentation at Connect IQ API Docs under Toybox::UserProfile I can getHeartRateZones and maybe use that info to try to calculate it?

Is there a simple API call to get the time in zone x?

1

There are 1 answers

1
Christoph F. Strnadl On BEST ANSWER

I also think that this functionality is not directly provided out of the box through the API.

However, you could write your own ActivityTracker based on the "ActivityTracker" sample in the Connect IQ API Docs. Unfortunately, that essentially means you would have to duplicate the logic of the display you currently see just to add the three fields.

You'd call Toybox.Activity.getActivityInfo() for obtaining the current heart rate at, say, a 1 second intervall (the ActivityTracker example shows you how to implement a 1 second callback), determine in which zone the heart rate is, and increment a counter for that zone. Then you add up the three zones and display that as well.

-cfs