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

change log level from fatal to warning #36

Closed
wants to merge 2 commits into from

Conversation

masneyb
Copy link
Contributor

@masneyb masneyb commented Aug 22, 2024

I have a new Garmin 540 bike computer, and this fatal error consistently shows up on my mountain bike when I try to import a FIT file.

I have a new Garmin 540 bike computer, and this fatal error consistently
shows up on my mountain bike when I try to import a FIT file.
@scrapper
Copy link
Owner

This will probably lead to wrongly reported data. I'm not sure why the Garmin 540 causes this test to fail, but I can take a look if you are willing to email me the fit file.
Also, please don't submit version number changes.

@masneyb
Copy link
Contributor Author

masneyb commented Aug 28, 2024

I'll email you a FIT file the next time that this happens. I went out on my mountain bike yesterday, and oddly the FIT file from that ride imported just fine without my change.

@masneyb masneyb closed this Aug 28, 2024
@pvdb
Copy link
Contributor

pvdb commented Sep 2, 2024

Not exactly the same issue as the one reported by @masneyb but definitely related as far as I can tell: I exported a FIT file from my Garmin Connect account, and I couldn't read it into Fit4Ruby due to the lack of @first_lap_index and @num_laps, both of which result in fatal errors in the following method:

    # Perform some basic consistency and logical checks on the object. Errors
    # are reported via the Log object.
    def check(activity)
      unless @first_lap_index
        Log.fatal 'first_lap_index is not set'
      end
      unless @num_laps
        Log.fatal 'num_laps is not set'
      end
      @first_lap_index.upto(@first_lap_index - @num_laps) do |i|
        if (lap = activity.lap[i])
          @laps << lap
        else
          Log.fatal "Session references lap #{i} which is not contained in "
                    "the FIT file."
        end
      end
    end

Bypassing the check() method altogether makes it work, and I can process the entire FIT file just fine.

Not sure it's relevant, but the original activity was recorded on an Oregon® 750t, which - I appreciate - is not one of the supported devices, but I've used Fit4Ruby successfully for processing its FIT files for months now.

Also, I cannot ascertain if the FIT file I downloaded from Garmin Connect is identical to the FIT file originally recorded on the device ... it's possible I guess the FIT data in the file was munged "in transit" somewhere, either when uploading it from the device to Connect, or else when downloading it from Connect to my laptop.

Either way, I think the assumptions Fit4Ruby makes about the "make-up" of a FIT file are a tad too strict or a tad too device-specific ... I'll do some testing with other FIT libraries, starting with the "official" Garmin SDK, to see if I can find out more.

Also, @scrapper, much like @masneyb I'm more than happy to email you the FIT file in question, if you'd have time to investigate from your end.


UPDATE: it's not an exhaustive test, but I was able to successfully convert the FIT file I downloaded from Garmin Connect to CSV using Garmin's FitCSVTool.jar:

$ java -jar FitSDKRelease_21.141.00/java/FitCSVTool.jar -tdis <my_activity>.fit
FIT CSV Tool - Protocol 2.0 Profile 21.141 Release

Decoding FIT binary file <my_activity>.fit to <my_activity>*.csv files.

$ _

... which leads me to believe there's nothing wrong per se with the FIT file, which seems to be confirmed by some of the online FIT converter tools I've also tested the file with.

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

Successfully merging this pull request may close these issues.

3 participants