Open jsliacan opened 1 year ago
I'll need to take a closer look, but you're sure field def numbers are correct? (190, 191 and 192.)
but you're sure field def numbers are correct? (190, 191 and 192.)
I chose them at will from between 0 and 255, paying attention to having them unique (within the Profile.xlsx file). I can't find any information on this, are they pre-defined somewhere? I'm not having much luck finding anything about radar_current
, for instance. Either online, in SDK files, or in the repo. Thanks
They'll need to match the field def numer they're encoded with in the file. It looks like these are undocumented/"hidden", and not present in the SDK specification.
What did you use to generate the file overview in your issue?
You can try to decode the file with debug logging, and then look at the different field defintions to get at hint about field def numbers. See this decode option: https://github.com/tormoder/fit/blob/a5da86ae366de3f250376a7997542c96d54ede53/opts.go#L27
Thanks for your time and all the info! I'll probably just transform the file to CSV and read it that way, seems easier at this point. I can see all the fields and correct values in a csv.
What did you use to generate the file overview in your issue?
I just loaded my file over here: https://www.fitfileviewer.com/. Seems to work OK, not sure what they do behind the scenes.
You can try to decode the file with debug logging, and then look at the different field defintions to get at hint about field def numbers.
Many thanks for the tip! The project is actually about the data in the fit files, so I'll move onto that now. I didn't know the radar fields are so non-standard, I expected it to work out of the box... And thanks for the fit
module btw.
Feel free to close the issue any time.
Hi again,
So I looked at it a bit more and it seems that there is something called "Developer Data Fields", which you probably know, described here.. I can't work out how to access those using your fit
module, e.g. developer field # 2 (with value 20 in the entry below, obtained in python).
{'timestamp': datetime.datetime(2023, 1, 12, 19, 49, 41, tzinfo=datetime.timezone.utc), 'position_lat': 696972206, 'position_long': 185899572, 'distance': 30808.85, 'altitude': 60.200000000000045, 'speed': 0.0, 88: 100, 'heart_rate': 114, 'temperature': 21, 'enhanced_speed': 0.0, 'enhanced_altitude': 60.200000000000045, 'developer_fields': {0: [0, 0, 0, 0, 0, 0, 0, 0], 1: [0, 0, 0, 0, 0, 0, 0, 0], 2: 20, 3: 0, 4: 0}}
They seem to have definition numbers which are "local" in the sense that if I use them in the Profile.xlsx
file, then run fitgen
to generate code, there is a duplicate index in the slice in profile.go
. That makes sense (EDIT: esp since these dev fields are supposed to eliminate the need for going through editing Profile.xlsx, running fitgen, etc.), but I can't think of a way to access these developer fields with your fit module. I'm assuming this is possible, but I might be wrong. Could you please give me a few more pointers here? As usual, any help is much appreciated! Thanks
PS: when I decode the fit file with java -jar FitDecodeExample.jar file_from_Forerunner645.fit
I get a very readable output (including all records and fields in it), and towards the top I see these Dev Field Descriptions:
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 0
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 1
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 2
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 5
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 6
Also, towards the end of the file, there's another one (an extra, which does not correspond to any of my radar fields):
New Developer Field Description
App Id: c5d949c3-9acb-4e00-bb2d-c3b871e9e733
App Version: 51
Field Num: 3
Data Developer Fields are not supported fully be this libary yet.
It supports parsing files containing them (i.e. parse files containing them without crashing), but they're not parsed/available yet.
I'm want and plan to support them, but have not had the time to work on the feature. There is a fork that supports them (I think), https://github.com/hammerheadnav/fit, and I hope I may integrate some of that work.
That being said, I'm not clear to me if the radar
field you mention is a Data Developer Field or just an "undocumented" SDK profile field.
@tormoder thanks for the info and your work around here! Feel free to close this issue as you prefer.
I'm not sure if this is an issue, but I need help figuring out why all values from
radar_current
,radar_speeds
, etc. fields that I added withfitgen
default to maxuint8
oruint16
as I define them. The values from other fields are parsed correctly (e.g. HR or distance). I apologize in advance if this is a user error!Let's focus on
radar_current
(which is the current count of cars coming up from behind registered by Garmin radar). See the file displayed below. The last entry is20
.I defined
radar_current
asuint8
. See SDK'sProfile.xlxs
screenshot:Once I regenerate a few files with
fitgen
and I tellgo
about it withreplace github.com/tormoder/fit => /home/jsliacan/Github/fit
ingo.mod
, I run a modified example code from here: https://github.com/tormoder/fit/blob/14e5de2989b78f0219d390251791047b1ad629a9/example_test.go#L45 where I extract the last entry in theradar_current
field in therecord
(snippet below). I expected to see20
but I get255
. However, forhr
field (which I didn't generate withfitgen
) I get the correct value of114
.Any help appreciated.