I'm most of the way to a minimal version of my lap timing application but I've run into consistent "brokenness" with recording of laps and the Lap Swimming activity (I have not tested other activities at all). I shall note that while I'm using Lap Swimming, this is mostly because that seems to be the only way to record the distances and pool length etc. I could be wrong! I am also not actually swimming - I usually throw a few strokes in at start of a length but 90%+ is just "power walking in water". I do not know if that is significant here.
I have my app coded so that pressing the bottom button briefly records a new Lap. This call is only made if there's an active activity and the activity is in the Started state. SessionManager is my own object that includes some scaffolding around session and lap management.
In the Delegate for the main UI screen:
function onKey(keyEvent) {
var keyID = keyEvent.getKey();
switch ( keyID ) {
case ...
break;
case WatchUi.KEY_ESC:
if (thisApp.sessionManager.inSession() && !thisApp.sessionManager.isPaused()) {
thisApp.sessionManager.newLap();
}
break;
}
}
SessionManager's newLap() looks like this:
--
function newLap() as Void {
if (null != _Session) {
_lapNumber++;
_lapTimes.put(_lapNumber, lapTime());
_lapStartTime = Time.now();
(_Session as ActivityRecording.Session).addLap();
_lapPauseTime = new Time.Duration(0);
}
}
--
When I review the list of laps maintained by the app (_lapTimes), it's accurate (I have a second View that shows each lap time and all laps are shown with reasonable timings for each one). When I review the same session in the Connect app:
- Instead of (say) 20 laps I have 10-12
- Instead of laps being 100m (I have defined and set pool length to 50m) I see laps of 100, 150, 200m and they're random
- Instead of the total 2km I see anywhere from 1300-1500m recorded
Since I'm using an indoor pool there's no GPS reception, so I wouldn't normally expect such random data - and obviously there's no way to change it in the Connect app.
Does addLap() just ... not work?