Correctly encoding a pause

Hi,

I'm trying to encode an activity file using the FIT SDK and C#. Everything works fine except for pauses and resumes (timer events). After uploading my fit file to other systems (like Strava) the pause is not recognized when displaying splits as the pause time is included in the splits. I've looked at fit files generated other systems and I can't seem to see what I'm missing.

my pause is encode like this:

var eventMesgPause = new EventMesg();
eventMesgPause.SetTimestamp(new Dynastream.Fit.DateTime(currentLog.ftTimestamp));
eventMesgPause.SetEventType(EventType.Stop);
eventMesgPause.SetEvent(Event.Timer);
eventMesgPause.SetTimerTrigger(0);
eventMesgPause.SetEventGroup(0);
messages.Add(eventMesgPause);

 and resume like this:

var eventMesgResume = new EventMesg();
eventMesgResume.SetTimestamp(new Dynastream.Fit.DateTime(currentLog.ftTimestamp));
eventMesgResume.SetEventType(EventType.Start);
eventMesgResume.SetEvent(Event.Timer);
eventMesgResume.SetTimerTrigger(0);
eventMesgResume.SetEventGroup(0);
messages.Add(eventMesgResume);

In the attached image you can see on line 1781 where the pause, and then resume occurs.

Any help would be appreciated.

  • Timestamp, event, and event type should be all that you need. Can you post an actual file to look at?

    Make sure when you are looking at the data in a graph that the x-axis is set to time and not distance. Presumably you are not moving when the timer is paused, so the distance is not incrementing. That will hide pauses in the data. Some platforms will even remove the gaps when plotting by time. So make sure to figure out the behavior of a known good file and then compare the behavior of your file.

    Also, in the session and lap messages, total timer time is the value with paused, and total elapsed time is the value without pauses. Some platforms will display the values in the session and lap messages versus calculating it from the record messages.

  • Thank you for the clarification.

    I am encoding:

    sessionMesg.SetTotalElapsedTime
    sessionMesg.SetTotalTimerTime: pause adjusted
    sessionMesg.SetTotalDistance: pause adjusted
    total activity time/distance/lap and session data is correct.
    it's just the Split breakdown is including the pause duration, not distance. It's like the upload platform is not recognizing the timer events.
    see comparison image ,left is the same activity recorded on a Garmin, right it my generated fit file from my app.
    the fit file from my app is also there, plus the fit->csv output.
    Hopefully you can see something I can't.
    Thanks again.
  • I think I've finally solved this. My records were at 4 seconds and I was filling the gaps by repeating the records between. But I left the distance static. I changed the logic to spread the distance over the 4s gap and it came good. No idea why or how this would affect it but it works now. Thanks for your input.