You can now create custom activity and interval fields that process fit file messages with scripts. Tick the “Processes fit file messages” box:
Your script will be run when the file is first processed or re-processed. Here is an example script that extracts heart rate monitor details from the device_info messages:
{
let hrm
for (let di of icu.fit.device_info) {
if (di.device_type?.value !== 120 /* HEART_RATE */) continue
console.log("di " + di)
let manufacturer = di.manufacturer?.valueName
if (!manufacturer) continue
let product = di.product?.value
if (product) {
if (manufacturer === "GARMIN") product = icu.fitSdk.enumValueName('GARMIN_PRODUCT', product)
else if (manufacturer === "FAVERO") product = icu.fitSdk.enumValueName('FAVERO_PRODUCT', product)
}
let serial = di.serial_number?.value
hrm = manufacturer + (product ? " " + product : "") + (serial ? " " + serial : "")
}
hrm
}
You need to poke around on fitfileviewer.com and in the FIT SDK to figure out what to look for.
There is documentation for the fit and fitSdk objects here.
I am going to be adding heart rate monitor related fields soon but its still a nice example of what can be done with this feature.