addLap() calls don't match laps in Connect

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?

  • In my app, the sport and sub-sport are configurable. If I select Walking or Hiking as the sport, with no sub-sport, I create the activity like this:

    _Session = ActivityRecording.createSession({
        :name=>actName,
        :sport=>actSport
    });

    When I run the same lap-management code as always - I get laps showing in Connect (with no distances showing for this test - I was just sitting at the desk).

    When I initialise the sport with Swimming and the sub-sport as either Generic or Lap Swimming, the laps are not recorded while sitting at the desk.

    So far at least, it appears to be specifically Swimming that produces the different result. I'd be very interested to know which sport Nikeow records as.

  • I didn't actually got the time to do this experimentation so, thanks to you for doing this.

    I will say this "AHA!!" It's Crippled!

    I am creating the session as a Strength Training.

    session = Record.createSession({
    :name=>"Strength", 
    :sport=>Record.SPORT_TRAINING, 
    :subSport=>Record.SUB_SPORT_STRENGTH_TRAINING}
    );

     

    I also have a datafield that's called SwimPower (specifically for the VASA Trainer) and it's also crippled. (it's a datafield - not an app, so I'm not creating any session). None of the FIT developer fields gets recorded into the FIT file. I think I have a thread in here somewhere detailing the issues.