fit files corrupted

Former Member
Former Member

hi all,

i have a fit file corrupted.

i try with all programs i found to repair but i failed...

someone can help me?

thanks,

Jonathan

  • This is an ugly brute force method, but I have used the following excel macro to open a fit file in excel.  It puts all of the bytes in a column as a decimal number.  Then you can step through the fit specification byte by byte and see what's gone wrong or at least read the record data.  Then you can use a binary file editor to fix the problem.  You have to really want that fit file to go through all of this though.  It's challenging to get the CRC's correct after you make edits.  I don't recall how I did that.  If you just want to get the data out, it's pretty straight forward once you get down to the records.

    Sub Temp()
        Dim intFileNum%, bytTemp As Byte
        Dim intCellRow As Long
        intFileNum = FreeFile
        intCellRow = 0
        Open "C:\Users\rschm\Dropbox\MoxyTechAppData\Moxy5 3157-session6.fit" For Binary Access Read As intFileNum
        Do While Not EOF(intFileNum)
            intCellRow = intCellRow + 1
            Get intFileNum, , bytTemp
            Cells(intCellRow, 1) = bytTemp
        Loop
        Close intFileNum
    End Sub

  • Former Member
    Former Member over 6 years ago

    Jonathan, post the fit file here in the euh...forum

    so we can try and repair it with FitFileRepairTool

  • It's challenging to get the CRC's correct after you make edits.

    Although I wouldn't recommend editing the FIT file directly in this situation, it's not hard to calculate the CRC after you make  edits. Just download the FIT SDK, run java/FitTestTool.jar against the FIT file and look for "CRC".

    I made a couple of wrapper scripts for Windows (cmd) and Mac/Linux (bash). Copy the appropriate script to the SDK java/ folder, and drag your FIT file onto it or run it like this ./fitcrc.sh myfile.fit

    fitcrc.bat (Windows)

    @echo off
    
    setlocal EnableDelayedExpansion
    
    set APP_DIR=%~dp0
    set APP_NAME=FitTestTool.jar
    set APP_PATH="%APP_DIR%%APP_NAME%"
    
    set a=%*
    
    FOR %%b IN (!a!) DO (
       set c=%%b
       set c=!c:.fit=!
       call java -jar %APP_PATH% %%b -d | find "CRC"  
    )
    pause

    fitcrc.sh (Mac/Linux)

    #!/bin/sh
    java -jar FitTestTool.jar $1 -d | grep "CRC"

    You'll see output such as:

    Fit.Decode: Expecting next 2 bytes to be end of file CRC = 0xB258

  • Former Member
    Former Member over 6 years ago in reply to WillNorthYork

     &  might be interesting

    Whenever you have such a bad day you can try to connect your watch to your Windows PC and start my Foxrunner tool. This small program will try to read all geo locations from a FIT file and create a GPX file which could be used in most programs.

    In your case a 227km track is generated within few seconds...

    Here's the tool (activate the option "Auto Convert" to create the GPX files)
    Foxrunner 32-Bit
    Foxrunner 64-Bit

    this is a nice feature for when the fit file is missing "definition records" for a given set of "data records"

    I also asked to export the remaining data from those unknown "data records" but no reply yet Thinking