Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined function in binary.js inside the published npm package #28

Open
thomaschampagne opened this issue Sep 14, 2021 · 15 comments
Open

Comments

@thomaschampagne
Copy link

thomaschampagne commented Sep 14, 2021

Hey @jimmykane,

I'm looking to understand why every cycling dynamics stats like avg_left_power_phase, avg_left_power_phase_peak are returning NaN values inside this library (file used: 7386755164.zip).

1 - I noticed that in the npm distributed package (v1.9.0) the following file node_modules\fit-file-parser\dist\binary.js has an error. Indeed inside function readData the following line:

return dataView.getUnt8(0, fDef.littleEndian);

Should be

return dataView.getUint8(0, fDef.littleEndian);

getUnt8 function doesn't exists, the getUint8 yes !

2 - Aside this, the readData (dist folder) from repository is not the same than the npm package. Why? I was unable to find tag 1.9.0 on this repository.

Thanks for your help !

Thomas

@thomaschampagne thomaschampagne changed the title Undefined function in binary.js located in publish npm package Undefined function in binary.js from the published npm package Sep 14, 2021
@thomaschampagne thomaschampagne changed the title Undefined function in binary.js from the published npm package Undefined function in binary.js inside the published npm package Sep 14, 2021
@jimmykane
Copy link
Owner

jimmykane commented Sep 16, 2021 via email

@thomaschampagne
Copy link
Author

thomaschampagne commented Sep 16, 2021

It's perfect :) Thanks !

By the way, I switched from npm package to current repository fit-parser state . I now have the correct code :) But i still have NaN issues on cycling dynamics stats (avg_left_power_phase=NaN, avg_left_power_phase_peak=NaN, ...).

The activity used to fetch cycling dynamics stats is https://connect.garmin.com/modern/activity/7386755164 (https://github.com/jimmykane/fit-parser/files/7163804/7386755164.zip)

Thanks !

@thomaschampagne
Copy link
Author

You will also find below the CSV export of this fit file using the java FitCSVTool.jar provided in latest FIT SDK from garmin

java -jar FitCSVTool.jar 7386755164.fit

Gives: 7386755164_FitCSVTool_export.csv.zip

Power phase like data is returned as is for instance: left_power_phase=28.12500043945313|202.50000316406255. This format could explain the NaN results.

Once this npm publish et field fixed I will provide new fields I identified through a PR. And also in a sports-lib PR with a lot of improvements I'm preparing for you for many weeks ;)

Thanks again!

Thomas

@thomaschampagne
Copy link
Author

Hey @jimmykane . Have you been able to take a look at this? Thanks to you !

@jimmykane
Copy link
Owner

jimmykane commented Sep 24, 2021 via email

@thomaschampagne
Copy link
Author

Ouch ! Hope you're fine and can walk by the way? It can wait. Have a good recovery !!!

@jimmykane
Copy link
Owner

I took a look and strangle this part of issue is not in the code of this repo. :-O

@jimmykane
Copy link
Owner

@thomaschampagne I tested your file after some fixes here and there and works ok.

I also released sports-alliance/sports-lib v5.4.24 that should have this fixed

Screenshot 2021-09-27 at 13 45 51

@thomaschampagne
Copy link
Author

thomaschampagne commented Sep 28, 2021

Hi @jimmykane.

(1) About the power I was probably unclear :D I was talking about the L/R power phase which is a angle between 0 to 360 degrees. This is what you can see there (https://connect.garmin.com/modern/activity/7386755164):

image
image

This angle/phase L/R data is parsed as NaN by the fit-parser (1.9.2):
image

I think the issue comes from how the data is formatted inside the FIT protocol (see #28 (comment))

(2) Just to mention it, I updated to "fit-file-parser": "^1.9.2", and I still have the wrong code (with the getUnt8 function undefined) in the generated dist folder.

image

I hope your toe goes better?

Thanks again,

Thomas

@jimmykane
Copy link
Owner

Undefined was fixed. It was the issue in src , strange I had not spotted it. Can you try if this by any way fixes the l_power_phase etc?

If else I think those fields are not implemented for decoding. This will take a few

@jimmykane
Copy link
Owner

@thomaschampagne version 1.9.3 with fix to the unknown function is out

@thomaschampagne
Copy link
Author

Undefined was fixed. It was the issue in src , strange I had not spotted it. Can you try if this by any way fixes the l_power_phase etc?

If else I think those fields are not implemented for decoding. This will take a few

I try this this evening! I let you know

@thomaschampagne
Copy link
Author

I updated to 1.9.3. Unknown function is fixed. However it doesn't fix the NaN values on power phases

image

@nenes82
Copy link

nenes82 commented Mar 14, 2022

Hello,
The data of left/right power phase get with a python script are like : (347.3437554272462, 201.0937531420899, 212.34375331787115, 94.218751472168).
The problem it is may be its type ? (uint8)

@nenes82
Copy link

nenes82 commented May 17, 2022

Hello,
my problem was that the scale value is 0,711111. I replaced comma by a dot and it's ok !
May be there is a better solution to convert value during the execution ?

REgards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants