Value in FIT file not viewed in GC

I have calculate one value of virtual power and after i have write it in the FIT file.

The power is regulary in FIT file, but when i upload file FIT in Garmin Connect the value is not present in the graphs of GC.

In Delegate module i have create session and createField:

powerFF = session.createField("Watt", 1, Fit.DATA_TYPE_UINT8, {:mesgType => Fit.MESG_TYPE_RECORD, :units => "watt"});

i the View module i have calculated value of power and after setData the value:

powerFF.setData(power.format("%0.0f"));

why not display the value of power in the graph of GC ?

thanks much

  • Was your app downloaded from the store or is it a size load?  It's got to be in the sore for GC to understand with to do with your extra data.  You can put it in the store and mark it as "beta" if you're doing testing, so only you can download it

  • hi Jim

    thanks for answer.

    I dont download from store. I have create my first app.

    excuse me...i dont undestand why i must put it in the store if dont works fine...

  • one question:

    i must create "Fitcontributions.xml' file in a 'fitcontributions' subfolder of the resources folder ??

    becouse i dont create nothing of this until now..

  • Yes you need that, as it defines how your data is used by GC.  And it's also why it needs to be in the app store - so GC can get the info to display the data.

    You can upload your app as a "beta app" so only you can download it.  See https://developer.garmin.com/index.php/blog/post/connect-iq-beta-apps

    Marking it "beta" is also how you can test app settings on a real device.

  • yes i must understand also as works upload beta apps in Connect IQ

  • i try to proceed in this way:

    in Resources.xml i have pute this code:

    <resources>
    <strings>
    <string id="power_label">Power</string>
    <string id="power_graph_label">Graph Power</string>
    <string id="power_units">W</string>
    </strings>
    <fitContributions>
    <fitField id="0" displayInChart="true" sortOrder = "0" precision="2"
    chartTitle="@Strings.power_graph_label" dataLabel="@Strings.power_label"
    unitLabel="@Strings.power_units" fillColor="#FF0000" />
    </fitContributions>
    <fonts>
    <font id="idfnt_Bold124" filename="fonts/BebasNeueBold124.fnt"
    filter="0123456789.-"/>
    </fonts>
    </resources>

    in the app view module i have crete session and after this code:

    powerFF = session.createField("Watt", 0, FitContributor.DATA_TYPE_FLOAT, {:mesgType => FitContributor.MESG_TYPE_RECORD, :units => "W"});

    but until now i dont see graph on GC...

  • You're not seeing a graph because of this code:

    powerFF.setData(power.format("%0.0f"));

    Couple of problems here:

    1) You declared the field as a float, but you're writing a string. (The format() function returns a string)

    2) You can only graph floats or integers, not strings

    The simple fix is to do this instead (assuming "power" is a float):

    powerFF.setData(power);

    You may also wish to check whether power is null (if that's possibility), since setData(null) will crash.

  • Thanks Flowstate, but i have calculate virtual power and the final value is not integer (for example) = 150,12345 and i want obtain integer value and record it.

  • i have tried the same to put powerFF.setData(power); but not works

  • update of code.

    in Delegate module:

    using Toybox.FitContributor as Fit;

    if (key == KEY_START) {
    //if (last_key == KEY_START) {

    if( Toybox has :ActivityRecording ) {
    if( ( session == null ) || ( session.isRecording() == false ) ) {
    session = ActivityRecording.createSession({:name=>"Generic", :sport=>ActivityRecording.SPORT_CYCLING});

    powerFF = session.createField("Watt", 0, Fit.DATA_TYPE_FLOAT, {:mesgType => Fit.MESG_TYPE_RECORD, :units => "W"});
    heartRateFF = session.createField("Heart Rate", 1, Fit.DATA_TYPE_UINT8, {:mesgType => Fit.MESG_TYPE_RECORD, :units => "bpm"});

    session.start();
    WatchUi.requestUpdate();


    }


    else if( ( session != null ) && session.isRecording() ) {
    session.stop();
    session.save();
    session = null;
    WatchUi.requestUpdate();
    }
    }
    return true;

    }

    in View module:

    if( ( session != null ) && session.isRecording() ) {

    heartRateFF.setData(hrrate);
    powerFF.setData(power);
    }