Interesting challenge.... Like most cyclists, I use Auto-Pause. This causes the Device to stop writing to the FIT file when Pause is triggered. This often means the last record written to the FIT file during the STOP time has non-zero values for some metrics like RPM (4rpm), SPEED (1mph), etc.
That has never been an issue before, but I'm playing with a really cool program called Telemetry Overlay. Creating action videos from my rides that sync FIT telemetry with GoPro timestamps. The issue is.... the developer retiains the last FIT telemetry values during the stop time. So the metrics show say 4rpm and 1mph for the footage while stopped.
One easy solution is to write User FIT values for these problematic metrics and assign the User Data to the metric overlays. And inside onTimerPause and onTimeStop, I write a FIT value of zero.
What I'm concerned about it a race condition. I think I've read that FIT writes are async. Meaning my "setValue" method in onTimePause won't actually get written, because the Device stops writing to the FIT file when Auto-Pause triggers, so my async setValue won't actually write my data value until possibly after I start riding again.
Any insight into how this works or a way to flush the write buffer to the file?