Garmin 935 FW 12.10
CIQ SDK 3.0.7
Detailed Description
A user reports that a CIQ data field which calculates lap metrics does not start a new lap, at the end of a structured workout. My independent testing confirms this issue. In contrast, the native lap metrics do indicate that a new lap has started, at the end of a structured workout.
The data field uses onTimerLap() and onWorkoutStepComplete() to count laps and calculate lap metrics.
Reproduction Procedure
- Build a data field from the sample code below, which return the lap count (0-based, just like the native field.)
- Place this data field in an activity next to the native Lap Count field.
- Start a structured workout with 3 steps
- Press the Lap key twice, to advance to steps 2 and 3. Note that the data field lap count and native Lap Count are both incremented each time
- Press the Lap key once more to end the workout. Note that the data field lap count does not increment, but the native Lap Count does increment
- Further presses of the Lap key will increment both the data field and native lap count.
using Toybox.WatchUi as Ui;
class LapTestView extends Ui.SimpleDataField {
var lapCount = 0;
function initialize() {
SimpleDataField.initialize();
}
function onTimerLap() {
lapCount++;
}
function onWorkoutStepComplete() {
onTimerLap(); // from the user's pov, a workout step is a lap.....
}
function compute(info) {
return lapCount;
}
}
Notes
Not that it matters, but I was very disappointed when the solution to the "CIQ apps cannot detect laps in a structured workout" was to add a new callback for "workout step complete" that's only available for CIQ 3, although I can imagine why it may have been necessary given the existing design. I sure hope the solution for this problem (*) is not to add a new callback for "workout ended"....
(*) Assuming I'm not missing something
I feel like all of this could've been avoided if CIQ simply received onTimerLap() notifications whenever something that looks like a new lap to the user is triggered. I mean, from the user's POV, a new lap is indistinguishable from a new workout step (as far as the lap alert screen, lap metrics and lap count are concerned).