Closed jsliacan closed 1 year ago
The error message should be improved, but I think you're missing the output directory
argument.
Could your try
$ fitgen ~/Downloads/FitSDKRelease_21.94.00/Profile.xlsx .
?
I did indeed miss the output dir, thanks for pointing it out. However, it doesn't seem to help.
$ fitgen -sdk ~/Downloads/FitSDKRelease_21.94.00/Profile.xlsx .
usage: fitgen [flags] [path to sdk zip, xls or xlsx file] [output directory]
-hrst
handle quirk where needed 'heart rate source type' field not set as active in official profile spreadsheet
-sdk string
provide or override SDK version printed in generated code
-test
run all tests in output directory after code has been generated
-timestamp
add generation timestamp to generated code
-verbose
print verbose debugging output for profile parsing and code generation
And if I don't provide the -sdk
flag, I get a complaint about it.
$ fitgen ~/Downloads/FitSDKRelease_21.94.00/Profile.xlsx .
fitgen: fit source output directory: .
2023/01/22 17:06:11 -sdk flag required if input is .xls(x)
Try
$ fitgen -sdk 21.94 ~/Downloads/FitSDKRelease_21.94.00/Profile.xlsx .
-sdk
is not the inuput file, but a ("manual") string for the version. The version is normally extracted from the ZIP filename.
Ah, I see, it's SDK version, not SDK. OK. That "worked" in that the code generation started. I got the following error though (it's unrelated to the title of this issue, not sure if I can keep asking here...).
fitgen: transforming message: ExdDataFieldConfiguration
fitgen: parsing components for field: ConceptField
fitgen: transforming message: ExdDataConceptConfiguration
fitgen: parsing components for field: ConceptField
fitgen: transforming message: DiveSummary
fitgen: transforming message: Hrv
fitgen: generating code
panic: genMsgs: could not find type for ref field name "HeartRateSourceType" for message "DiveSettings"
goroutine 1 [running]:
github.com/tormoder/fit/cmd/fitgen/internal/profile.(*codeGenerator).genDynamicGetter(0xc000ccf8b0?, 0xc000d62b40, 0x1?)
/home/jsliacan/Github/fit/cmd/fitgen/internal/profile/codegen.go:295 +0x1305
github.com/tormoder/fit/cmd/fitgen/internal/profile.(*codeGenerator).genMsgs(0xc000ccf8b0?, {0xc000e5e400, 0x58, 0xc0002a8cc0?})
/home/jsliacan/Github/fit/cmd/fitgen/internal/profile/codegen.go:164 +0x46c
github.com/tormoder/fit/cmd/fitgen/internal/profile.(*codeGenerator).generateMsgs(0xc000ccf8b0, {0xc000e5e400, 0x58, 0x80})
/home/jsliacan/Github/fit/cmd/fitgen/internal/profile/codegen.go:51 +0x73
github.com/tormoder/fit/cmd/fitgen/internal/profile.(*Generator).genCode(0xc000128300)
/home/jsliacan/Github/fit/cmd/fitgen/internal/profile/generator.go:179 +0xd5
github.com/tormoder/fit/cmd/fitgen/internal/profile.(*Generator).GenerateProfile(0xc000128300)
/home/jsliacan/Github/fit/cmd/fitgen/internal/profile/generator.go:102 +0xcf
main.main()
/home/jsliacan/Github/fit/cmd/fitgen/main.go:124 +0x9fd
Do you have a guess what I can try next? Just for clarity, I did not touch "HeartRateSourceType" or "DiveSettings" in the Profile.xlsx (or anywhere else). Thanks for the help so far!
That's a "bug" in the offical profile spreadsheet. Try adding this flag:
-hrst
handle quirk where needed 'heart rate source type' field not set as active in official profile spreadsheet
Oh no, I even read the help for that flag some time in the process but didn't pair it with the error. Now it worked seemingly without any failures. I'll close this issue, and thanks for all your quick help! Much appreciated.
PC info
Go version
I need to read file where
record
section looks as in the printscreen, i.e. it has extra radar fields that I need to access.From what I read it seems that the best way would be to use fitgen to regenerate the code in
messages.go
to include the fields I want. So I downloaded latest FIT SDK (FitSDKRelease_21.94.00.zip
) unzipped, added rows inProfile.xlsx
spreadsheet underrecord
section and went to usefitgen
. No matter what arguments I provide, or what flags I specify, I always get help docstring back:I made
fitgen
withmake build
andmake fitgen
. When I run tests, they fail as follows:It's possible that I misunderstood something, so any help is appreciated. Thanks in advance!