Hi all.
I’ve run into an odd edge case with custom fields, and want to see if anyone knows how I can be more specific about my fit file references.
So, I am on a Garmin watch and have a Connect IQ app loaded on my watch during treadmill runs. It connects to a device via ANT+, and reports mainly an incline stream.
It also writes to the session message, however. Specifically, it writes total_ascent, total_descent, and total_distance.
I retrieve them like this:
for (let session of icu.fit.session) {
if (session[FIELD_NAME]?.value != null) {
val = session[FIELD_NAME].value;
break;
}
And that works fine.
However. Those specific fields are also sometimes written to natively, by Garmin. That would be fine, if the formats were the same.
In the fit file’s field_description message, the Connect IQ app reports that units are in ft. Garmin writes in m, the standard.
And, as far as I can tell, the field’s true “column name” isn’t simply total_descent, but x_total_descent_0_10. But session["x_total_descent_0_10"] in the loop above returns null every time.
As a workaround, I’ve tried do check field_description to see if the developer field is there, and if it reports in ft. But I’ve gotten some strange results there — Garmin seems to write out total_distance all the time. And when I pull it in JS, the value in m seems to take precedence over the Garmin IQ-written one.
This is despite the fact that the item in FIT file field list reports a different number, in ft.
So, to get to my ask: is there some way I’m missing to specifically reference, say, x_total_distance_0_12? Rather than generic total_distance, which is sometimes defined more than once?