Closed Oupsman closed 2 months ago
Hi @Oupsman,
A message may contains only few fields and the rest of the fields will be set to its corresponding invalid value. It's up to the creator of the FIT file what's to include in the message. When the field is invalid, in this case AvgSpeed, AvgSpeedScaled() will return NaN value to indicate that the field AvgSpeed is invalid. The best practice is to check the validity of the value first before processing the field:
if activity.Sessions[0].AvgSpeed != basetype.Uint16Invalid {}
// or
if !math.IsNaN(activity.Sessions[0].AvgSpeedScaled()) {}
For AvgSpeed and MaxSpeed, some manufactures may prefer using EnhancedAvgSpeed and EnhancedMaxSpeed fields. We need to check those value as well.
Thanks, I did not thought of checking if Enhanced values were available.
The worst part is that I already check in my code if I have to use SpeedScaled() or EnhancedSpeedScaled() to get the speed in a record. My bad.
Hi guys,
I'm working on an activity tracker and I have an issue with this module. I've tried with files coming from differents bikes computers and from a Fenix 7X and I have the issue every time.
Here is my code :
and the result :
what am I doing wrong ?
thanks for you answer.