Datafield - OnTimerLap with workout file

Dear all,
I'm developing a datafield for Edge 520. I would like to compute the average of a info quantity over a lap.
I'm using the funcion onTimerLap() to identity the time when a lap is created. I could manage to make the callback work (both on simulator and edge).
But It looks to me onTimerLap() does not work when using a workout file.

Below you find small datafiled for laps counting.
When I use it without workout file, it work correctly.
When I use a workout file, it give a value of 3 laps when I start the activity and then it doesn't count neither of laps nor autolap.
Has anybody succesfully used ontimerlap() with a workout file?

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;
}
}
  • Former Member
    Former Member over 8 years ago
    I'm not sure I completely understand your issue, but are you expecting the laps recorded in the file to trigger?

    Simulating data with a file does not simulate the timing or timing events from that file, it is only used to update the data source for the simulator as the file plays back. To get onTimerLap events you will need to select the "Lap Timer" option from the menu, or press the lap key on the device.
  • Hi Brian,

    I'm not sure I completely understand your issue, but are you expecting the laps recorded in the file to trigger?

    Sorry for my bad explanation!

    Simulating data with a file does not simulate the timing or timing events from that file, it is only used to update the data source for the simulator as the file plays back. To get onTimerLap events you will need to select the "Lap Timer" option from the menu, or press the lap key on the device.

    Yes, I got that (it took a while to me!)

    The issue is simple: when i use the simulator (i.e. through eclipse), both using "simulate data" or "playback file", the lap counter i provided before works. When I press "lap timer" button the onTimerLap event works and +1 is added to the variable lap.
    Then I have side loaded the datafield on my edge 520: without using a workout file, onTimerLap work as in the simulator, but with the workout file it doesn't! it does not work neither by pressing the lap button neither with the autolap.

    I hope I've better explained the issue.

    Paolo
  • Just to be clear, the workout system automatically inserts laps (lap button presses) at the end of each workout step. The problem is that onTimerLap() is not being called for these automatic laps.
  • Former Member
    Former Member over 8 years ago
    That makes sense now. I will talk to the Edge team about this.
  • Looking forward further info!
  • That makes sense now. I will talk to the Edge team about this.


    I have tried on a Garmin Edge 1000... same problem.
  • This is disappointing, I was hoping to use the same mechanism of onTimerLap() firing on automatic workout laps...
  • That makes sense now. I will talk to the Edge team about this.


    It should be noted that this applies to all devices that support workouts (edge, forerunner, fenix, ...).
  • Updates?

    That makes sense now. I will talk to the Edge team about this.


    Is there any update from the Edge team?
  • Former Member
    Former Member over 8 years ago
    I've been able to determine that this is an issue on all devices, and not just Edge units. Other than that, I haven't seen much traction on this issue.