Has anyone used the Activity.WorkoutStep details available in 3.2?

I'm trying to develop a datafield that uses the new WorkoutStep, WorkoutIntervalStep and WorkoutStepInfo classes.  I can't find any information other than what is in the API documentation, but by playing around a bit I have found the following:

My environment is an F6 running 11.10 firmware, Eclipse with SDK 3.2.2 and I am using a running interval workout that was downloaded on my watch from TrainingPeaks via the Garmin Training API.  It has a couple warm up steps and then intervals repeating 4x with active and rest portions, followed by a cool down step.

1) There is no way to load a workout in the simulator.  This is a hassle since it means I have to do all of my debugging on my watch, but that's fine -- lots of System.println() and looking at the error log has gotten me pretty far.

2) Toybox.Activity.getCurrentWorkoutStep() works correctly and returns null when there is no workload loaded and returns an Activity.WorkoutStepInfo instance when one is loaded.

3) The information in the WorkoutStepInfo instance looks correct.  I mostly tested with the intensity attribute and it follows correctly as I progress through the workout.

4) Unless I am doing something wrong, the step attribute in the WorkoutStepInfo instance never has any information.  When I try to read it, has:activeStep and has:restStep always return false.  This may be due to the way that the workout file is constructed(?), but without having either of these attributes there is no way to get a WorkoutStep instance which has the detail information about the step including the target and duration information.

5) This may be user error on my part, but the WORKOUT_INTENSITY_xxxx enumerations aren't working.  It compiles when I use them but crashes runtime.  For my playing around I had to hardcode the values.

Thanks in advance for any guidance if anyone else has played with this new feature and been successful in getting it to work!

Top Replies

  • Hi,I am curious about the unit for targetValueLow/targetValueHigh when target type is speed.

    step: Obj: 143
    durationType: 0(time)

    durationValue: 10.000000
    targetType: 0(speed)
    targetValueLow…

  • I  found it is mm/s !!!

    That's what's in the FIT file, but how does the Connect IQ API report the same numbers? I would expect CIQ to use m/s for consistency, especially considering the numbers…

All Replies

  • I  found it is mm/s !!!

    View the fit file below at https://www.fitfileviewer.com/

  • This forums' implemtentation sucks.

    Only known URLs and the following file extensions are allowed: 123, aac, ai, aiff, art, asf, asx, avi, bmp, csd, db, dmg, doc, docx, drw, eml, flac, flv, gdb, gif, gz, ics, iq, jpeg, jpg, log, m4a, m4p, m4v, mdb, mdbx, mid, midi, mmv, mov, mp3, mp4, mpg, msg, ogg, pdf, png, pps, ppt, pptx, prg, ps, psd, qt, ram, rar, rm, rtf, sit, sitx, sql, tif, tiff, txt, vcf, vcs, wav, wma, wmv, wpd, wps, xls, xlsx, xml, zip. Please select a valid file or enter a valid URL.

  • I  found it is mm/s !!!

    That's what's in the FIT file, but how does the Connect IQ API report the same numbers? I would expect CIQ to use m/s for consistency, especially considering the numbers that you posted previously. (They wouldn't make much sense if they were interpreted as mm/s.)

    In the case of the FIT file, it could be using mm/s (or fixed point decimal, depending on how you want to look at it) so that it can store numbers as integers instead of floats.

    This forums' implemtentation sucks.

    Yeah, as I said many times, it's very on-brand of Garmin to use a forum which isn't modern, doesn't work well on mobile, and has several usability issues and bugs.

    I begged them to use NodeBB or Discourse a few years ago when they switched platforms, but that didn't happen. Of course they broke lots of content when they switched platforms, such as incoming and outgoing links, images, etc.

  • ...I go back to the original fit file above provided by the garmin employee. The unit mm/s for the value 447 in fit is different from that exposed by garmin ciq api 0.447, in which the unit is  m/s indeed

  • Bummed that we can only get current workout step and next workout step.

    I was thinking of making a data field that tells me when I'm half way (distance-wise) through a workout.  I do a lot of time-based workouts, that include different paced intervals, on out-and-back courses.  It would be nice to know when to turn around.

    Clearly the watch knows this info, so it should be possible to get a list of all steps.  Might it be possible to get the name or ID of the current workout, so we could load the workout from persistent memory?

  • I wrapped the function to return the workout step in another function that, depending if debug or release, returns a device or my own simulated workout step. The returned spoofed object quacks like a duck so all good either way. Saves messing around with Garmin's incompletely implemented simulator and speeds up development.

    (:release)

    function getCurrentWorkoutStep(){

    return Activity.getCurrentWorkoutStep();

    }

    (:debug)

    function getCurrentWorkoutStep(){

    return MySim.getDummyWorkoutStep();

    }

  • Agreed. The field can't know where it is within the workout. I also have to write code to count the active steps so I can at least display which iteration I am on and this only works for simple repeats.