Carta Operum

Journal ◆ Sync

Heart rate, from the sensor to the screen

Live vitals on the workout screen: one stream, many readers, and a state for 'lost'.

During a live workout Cadence shows heart rate, calories and the training zone, updating as you move. The numbers come from a sensor, and they arrive in their own time, sometimes in a burst and sometimes not at all.

The screen does not read the sensor. It reads a stream that the rest of the app owns: values come in, are smoothed over a few beats, and go out as a single reading with a state, live, stale or lost. The ring, the zone colour and the calories all listen to that one stream, so they cannot show different truths. A reading older than a few seconds turns grey instead of claiming to be current.

Zones are computed from the person's maximum and drawn as five bands with the current one lit. The run screen reuses the same stream, so a heart rate shown in the middle of a kilometre is the same value the workout summary stores. One source, many readers: it is the pattern I trust most in a real-time app.