feat(vitals): Measure HR/SpO₂ countdown redesign + robust measurement#66
Merged
Merged
Conversation
saksham2001
force-pushed
the
feat/measure-hr-redesign
branch
from
July 12, 2026 09:03
f9b955e to
1bd05e4
Compare
saksham2001
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks the manual Heart Rate / SpO₂ measurement sheet into a determinate countdown, and hardens the underlying measurement so it reports a trustworthy value.
UI (
MeasurementModal)TimelineView(.animation)off wall-clock time, so it animates/updates even under Reduce Motion (fixes a prior freeze where the ring stuck at a hardcoded 50% arc).Measurement robustness (
RingSyncCoordinator.measureHR)0x69command fires, so the old flow completed in ~2s on a stale value. Now: discard the first ~5s (warm-up echo), sample the full window, and report the median of the samples that cluster within a few bpm (stableHR()).Known limitation — vigorous finger motion is not reliably flagged
The ring exposes no motion / accelerometer / signal-quality data to the app. The accelerometer hardware exists (STK8321 / LIS2DOC) but the firmware never streams it — the app only receives the bpm value plus a worn-incorrectly error code. The firmware also smooths HR internally, so the reported bpm barely scatters even under motion, and a resting HR naturally varies ±5–10 bpm with breathing. As a result, deliberate finger movement (e.g. typing during a measurement) is not reliably detected: the bpm-variance gate cannot separate it from normal breathing variation without false-failing legitimate still readings, so the gate is kept lenient and the 30s median carries minor motion. Future avenue: probe the currently-unparsed
0x69 v[1]HR-frame byte on-device to see if it encodes a quality/motion signal we could hook into.Tested on-device with a physical ring.