Set elevation or incline data

Goal:

To be able to manually set the elevation or incline of an activity (treadmill run).

Initial thoughts were to have a editable data field of "incline" and then the activity uses that to calculate total elevation during the activity.

If "editable" is not possible, I'd use a fixed value (my treadmill goes to 25%) and use basic math to calculate total activity elevation.

Why?

When running on a treadmill I currently have no way to have the activity to record elevation gain.

I can edit the subsequent activity in Garmin Connect but this edited data doesn't flow back to the watch (Fenix 7) and therefore the Hill Score etc data isn't updated on the watch.

I manually manipulated an activities .fit file to add in the elevation but turns out it's impossible (afaik) to write a file back to the "Activity" folder on the watch's internal storage.

How?

I figure it must be possible as apps like Runn receive incline data from an Ant device and display that on the watch and use the data to populate total elevation in the activity file.

So my plan was to manipulate the same data just with either on screen incline entry or hardcoded figures, instead of getting it from the Ant accessory.

But

https://developer.garmin.com/connect-iq/api-docs/

I can't find any reference at all to the data fields I would want to manipulate, either elevation, ascent or incline.

Can anyone point me in the right direction?

Thanks!

Rob

  • I manually manipulated an activities .fit file to add in the elevation but turns out it's impossible (afaik) to write a file back to the "Activity" folder on the watch's internal storage.

    You can but it won't update any of the calculated metrics on the watch. All that will happen is your history will be updated. Should be enough to replace the original file with the edited file in the Activity folder.

    I can't find any reference at all to the data fields I would want to manipulate, either elevation, ascent or incline.

    You could try using DataField.createField() with a nativeNum corresponding to a FIT field you want to record [*]. Note that there's a long-standing issue of Garmin Connect (and your device) ignoring most or all nativeNum fields, but based on other discussions and what you said about Runn, it's possible that nativeNum works for *some* fields.

    See: [https://developer.garmin.com/connect-iq/api-docs/Toybox/WatchUi/DataField.html#createField-instance_function]

    [*] See Profile.xlsx in the FIT SDK:

    - Open the Messages sheet

    - Scroll to ACTIVITY FILE MESSAGES

    - Refer to the session, lap or record sections for the appropriate field IDs (as well as data type, units and other info)

    - e.g. "Instant" altitude is record > altitude (2)

    - e.g. "Instant" grade is record > grade (9)

    - e.g. Lap average altitude is lap > avg_altitude (42)

  • I manually manipulated an activities .fit file to add in the elevation but turns out it's impossible (afaik) to write a file back to the "Activity" folder on the watch's internal storage.
  • If I edit the original file and replace it in the Activity folder, would this update the calculated metrics on the watch, or again just history changes?

    No, unfortunately just history changes. But you'll find that there's a few things you can hack / backup + restore just by messing with the filesystem. (Most edited/backed up files need to be copied to their original locations, but some need to be copied to Newfiles/ instead.) Anyway, that's another topic... (One example is that certain settings which are unavailable in the UI can be hacked by editing a Sport/ FIT file (which is the settings file for a native activity.)

    I can mount and view the storage as MTP drive but get a variety of permission denied errors when trying to write back to the Activity folder; it mounds as read only and I can't see to change that

    Strange. What watch do you have? I was able to copy files to Activity/ on my 955 with both Windows and macOS (Android Filte Transfer). Note that with MTP you typically can't open/save files "in place". You have to copy them to the device from another location or vice versa. (In Windows you sometimes get the illusion of opening files in place, but you're actually opening a copy.)

    I see that there's an Android File Transfer clone for Linux: https://github.com/whoozle/android-file-transfer-linux

    Anyway, that's not going to help you with your goal. Your only bet is to write your own CIQ data field or device app, save elevation and/or grade as a nativeNum FIT field and hope that Garmin Connect / your watch respects the data. I'm not sure if it will, though. Based on the thread I linked above, *some* metrics actually work with nativeNum, but distance doesn't. I didn't see any mention of grade or elevation though.