Help with FitContributor

I'm trying to record data to the .fit activity file.  What I hoped would be simple has been surprisingly challenging.  First I was unable to get anywhere using the samples posted online using the simulator & fitfileviewer.com/Monkey Graph to view the output.  Then I tried side loading and running it on my device and suddenly I had data in my Fit files!  Is there anything specific I need to do in the simulator to get the FitContributor data to be output.  In the CIQ Simulator I'm using Simulation | Activity Data => Start, then wait for a while, Stop, then 'Save Fit Data'.  (There are no warnings or error messages.)

When I view the data recorded by the side loaded program on my physical device in Monkey Graph, it's showing data from another developers CIQ field?  My initial suspicion is that this is due to an overlap/clash in the fieldId values used in createField().  I used 0 and 1 for my two fields and am wondering if the other developer did the same leading to this behavior.  The documentation for fieldId simply states 'The unique Field Identifier for the Field'.  My assumption was that this is unique within the app, but if that is not the case then how can one ensure it is globally unique? Or is there perhaps some magic that happens when it gets uploaded to the CIQ store?

I'm using VScode... any thoughts or suggestions to help me figure this out, and/or get my simulation working would be much appreciated!

  • Data fields have have a lower limit for fitconftib fields and the data than a device app.  How many fields are you trying to use and how much data?  These limits apply to the activity and not a single DF so someone else's DF can impact what you can do.

  • What I do to check fit-contributions - and it works:

    once your code is ready for testing:
    -build the datafield
    -load a fit file (I take one from my real done activities)
    -run the fitfile and start the activity on simulator
    -let it run for a while
    -stop the activity, „save“ and „save to fitfile“.
    -a fitfile „session.fit“ is saved

    -close the simulator
    -export your project to an *.iq file

    Now you have the *.iq file and a session.fit file

    -open Monkey Graph 
    -load the *.iq file
    -load the session.fit file

    Now I can see all contributions in the Monkey Graph window.

  • I'm writing two fields to the fit file, both float values that are updating once every 4 seconds - this is just for testing, they'll be updated less frequently when deployed.  I would have thought this amount of data would be easily manageable.  

    The other CIQ field running on my Edge 830 is 'My Bike Radar Traffic'. It outputs information on passing vehicles and their speeds - I don't know the exact detail of what is recorded though. 

  • Thanks for the suggestion.  I gave that a try and recorded a session as suggested - the output file once again seemed to have no data recorded by my field as verified using Monkey Graph and fitfileviewer.com.  It's looking like there must be something weird with my simulator environment/setup, I'll try re-installing to see if that helps.

  • After you create a field, you use setData() to set the data.  This doesn't cause the fit file to be written, but sets the data for the next time the firmware writes to the fit file.  In something like a simple DF, that's something you probably want to do in compute(),.  

    What type of field are you using? MESG_TYPE_SESSION (only writes at the end of a session), MESG_TYPE_LAP (only writes at the end of a lap) or MESG_TYPE_RECORD (written on an on-going basis),  And where are you calling setField?

  • I've made some progress, the simulator seems to be quite temperamental but I've managed to get it to log my data to fit file and then view the output. For anyone experiencing issues simulating FitContributor data here are some things to look out for:

    - After stopping the activity, be sure to click 'Save' before clicking 'Save Fit Data'.

    - If there are no signs of any of your FitContributor data in the .fit file, try switching SDK versions to 'reset' the simulator

    - If new simulation runs result in the same .fit data (as can be confirmed by the .fit timestamp & a binary file compare) you need to close & re-launch the simulator.  It can get into a state where it just gives the same (outdated) data every time even if you start and record a new activity.

    - Monkey Graph should be re-launched each time you load a different .fit file

    - Make sure the fieldId for your fields in createField match the values specified in fitcontributions.xml.  (I think the maximum allowed fieldId value is 1023)