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: