ontimerlap() not called when using workout system

Detailed description:
The function onTimerLap() is called during an activity when lap button is pressed.
While using a workout file as guide, the onTimerLap() function is not called neither on automatic laps nor lap button is pressed.

Environment:
Windows 10
Eclipse Luna Service Release 2 (4.4.2), Build id: 20150219-0600
Edge 520/1000 with latests firmware

Steps to reproduce:
Build the app for the device
Copy the app to the device
Add the datafield in a data screen
Start a workout
Wait for an aoutlap or press lap button (the datafield doesn't work)
Press lap button until workout ends
Press start button (to restart the activity)
Press lap button (datafield now works)


Expected behaviour: the datafield should work (ontimerlap() should be called) also in workout mode


Code (for testing, just a lap counter):
using Toybox.WatchUi as Ui;

class Lap_counterView extends Ui.SimpleDataField {

var lap = 0;

// Set the label of the data field here.
function initialize() {
SimpleDataField.initialize();
label = "Lap counter";
}

function onTimerLap()
{
lap += 1;
}
// The given info object contains all the current workout
// information. Calculate a value and return it in this method.
function compute(info) {
// See Activity.Info in the documentation for available information.
return lap;
}
}



Related thread:
  • Thanks for reporting this,

    We've seen this before and, if I remember correctly, this is by design. However, I have still created a Bug ticket because it doesn't seem like this is how it should work. We will meet about open tickets within the week and hopefully have a decision as to what we can do about it. Unfortunately this function is handled by a different team so there is only so much that we can do, but it's definitely time to start that conversation with them again.

    Thanks,
    -Coleman
  • Hi Coleman,
    thanks for your reply.

    Yeas there has been a discussion about this topic already!
    I cannot figure out how this feature should be a wanted! Even the native datafields display some lap quantity,
    so why shouldn't I be able to do the same?
    It would be nice to have at least a workaround (like for example, have laptime in the class info).

    Thanks,
    Paolo
  • Hey,

    Wanted to give you a little update. As of right now this is the expected behavior. However, we are going to be having a discussion with device teams about whether or not this is something we can implement. We would like to be able to have a bit more control. My guess (and this is conjecture as I was not part of the decision making) is that there is a fear that something CIQ related could override the workout and detract from the actual experience. For example, exposing onTimerLap() and marking a lap in a workout with a pre-defined lap sequence may cause the laps to get out of sync or write the wrong info to the fit file. I'm just not sure, but that would be my guess. Either way, we would still like it and will check on it.

    Thank you!
    -Coleman
  • Hi Coleman,
    this makes sense.
    So the problem would be if i write a new lap into the fit file while doing a workout, but actually it should not be a problem just having the information when a lap i triggered. I'm just thinking "loud".

    Thank you!
    Paolo
  • Surely only Apps not Data Fields can write laps into a FIT file, and since the Garmin workouts use the native Run/Bike modes, Data Fields aren't able to corrupt laps in the way you outline.
    Hence it absolutely makes sense to me that Data Fields should see OnTimerLap() fired for workout-defined laps. Has there been any progress, did the mentioned discussion take place?
  • Are there any news?
    I totally agree with IMGrant...
    I think this topic is really of interest to those whom wish to seriously train...
  • Are there any plans to fix this issue?
    It shouldn't really matter whether new lap was initiated using lap button, auto-lap, workout step or interval - why isn't onTimerLap called on new workout step or interval?
    Please, please fix it!
  • We do have plans to fix this issue, but it hasn't been prioritized. I'll ask to see whether we can look into this sooner rather than later.
  • I'm developing a data field that could benefit a lot from this. Hopefully it'll be implemented soon.