Fit Contributor

Hi,

just a question to the FitContributor: If I calculate the average values of an high-intensity period of an interval and write those values to the Fit file, does Garmin connect web make those values somehow visible or is it just a value in the Fit file?
  • OK, thanks for the screenshot. I now can see what you mean with "zoom in", it's different from my understanding. What I mean with zoom in is to click on the zwo diagonal arrows on the upper right hand side of the graph. Does clicking on that works on your graphs?

    BTW: What a brillant idea regarding: "setData((TOT_TIME2/60)%60+TOT_TIME2%60/100.0);" May I copy that?
  • Ah, right. You are correct, the graph is empty when I use the arrows to make the graph full size. Although when I add an overlay then it works. Something is definitely messed up. Mine works, I would try FitContributor.DATA_TYPE_FLOAT for the graph and see if that helps. That's my only suggestion.

    Oh yeah use that code if it helps :)
  • bwd1, you were the only one who pointed me in a direction. Thanks for that. I will try that using float and respond if it works. I can't see that I am making things different to your code except using other types.
  • Hi,

    I got it partly running:
    1. In my first app I wrote some information to each lap (changed the format from string to float). This information is now shown in GC web as well as GCM. Hurra. Nevertheless, the headline of these value is still the old text (note that I also changed the headline text in the resources file for the new lap column).

    2. In my second app I create a graph and changed the format from uint8 to float. But the graph on GC web is still black. Furthermore the graph in GCM is still red although I changed the color in the resource file to FFFF00.

    Both failures seems to have a problem in updating how the information shall be presented to user. Therefore I tried bwd1's installation routine he mentioned on page 3: deinstalling the datafield, rebooting the watch and then reinstalling the datafield. But this also did not help.

    Has someone an idea how I can get the things running? May it be that the json file which resides in the .iq file is not correctly updated anywhere on Garmin's servers?
  • By the way: I put this code in the onTimerLap() method, nevertheless, it seems that the fit file is written __before__ this code is executed which means that the data is written to the next lap :-( Is this a bug or a feature and is there a workaround for this?


    Maybe you've figure this out in the meantime, but thought I would add, in the API docs for onTimerLap(), it states:
    This notification is fired after the lap record has been written to the FIT file

    Therefore, this behaviour is expected. The workaround is to (repeatedly) call setData() on your field during the current lap (e.g. in compute()) – see the MoxyField example, this does the same. Since your field is MESG_TYPE_LAP, the message is only written to the FIT once. You could think of it as being continually overwritten with the latest, so that when the lap ends, the data is up-to-date.
  • Hi IMGrant,

    I already thought about this, but there is one reason I don't want to do this: performance. It's a really complex calculation I have to do. IMO it makes no sense from a datafield perspective to write to the Fit file before a user can do some calculations.
  • Former Member
    Former Member over 8 years ago
    Hi IMGrant,

    I already thought about this, but there is one reason I don't want to do this: performance. It's a really complex calculation I have to do. IMO it makes no sense from a datafield perspective to write to the Fit file before a user can do some calculations.


    The process described by IMGrant is the method that is expected by CIQ. There are no other options in the CIQ framework.

    The CIQ VM is not allowed to run during FIT file recording events.
  • Hi,

    I can't get the Fit contribution running properly. Although I have done it exactly in the same way as bwd1, my graph looks like that (it's black and if you enalrge the graph it vaishes at all although it seems that the values are there if you hover the mouse over it). Any ideas what I did wrong?

  • Hi,

    I can't get the Fit contribution running properly. Although I have done it exactly in the same way as bwd1, my graph looks like that (it's black and if you enalrge the graph it vaishes at all although it seems that the values are there if you hover the mouse over it). Any ideas what I did wrong?



    this is a FitContributor Garmin Connect Display Issue as described here:
    https://forums.garmin.com/showthread.php?364535-Known-Issues-Thread
  • Hello everyone,

    I´m also struggeling with the fitContributor. I´ve read lots of threads and everyone has different issues with it, so I´m hanging in this most general thread.

    My App is used for stretching. You can setup a duration and a resting time.
    Both of them and the number of repetitions should be stored via FitContributor:

    session = ARec.createSession({:name=>"Stretch", :sport=>ARec.SPORT_TRAINING , :subSport=>ARec.SUB_SPORT_FLEXIBILITY_TRAINING });
    var options = {
    :msgType => Fit.MESG_TYPE_SESSION,
    :count => 1,
    :units => "rep",
    :nativeNum => 1
    };
    repetitionField = session.createField("Repetition", 0, 2, options);

    repetitionField.setData(StretchTimer.repetition -1);


    <resources>
    <fitContributions>
    <fitField id="0"
    displayInActivitySummary="true"
    dataLabel="@Strings.menu_label_Rep"
    unitLabel="@Strings.unit_Rep"
    sortOrder = "0"/>
    </fitContributions>
    </resources>


    Fit-file:
    Data,9,field_description,field_name,"Wiederholungen",,units,"wdh",,native_mesg_num,"20",,developer_data_index,"0",,field_definition_number,"0",,fit_base_type_id,"2",,native_field_num,"1",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Data,10,record,timestamp,"860315264",s,distance,"0.0",m,Intervall Dehnen,"40",s,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

    "Wiederholungen" means "Repetition". "Intervall Dehnen" is the stretching duration in seconds. Both are there and have values.

    The app is published to the Connect Store. I test it with a Vivoactive. SDK 1.3.X

    How is it possible to see the data? Neither in Connect Web nor in Mobile I can see anything.
    Is it related to the SUB_Sport? I didn´t find any better fitting to stretching...
    Or related to a bug? My Vivoactive? :confused: