Add in blood oxygen support into the mobile app.#267
Open
32bitx64bit wants to merge 13 commits into
Open
Conversation
Introduce a dedicated spo2_readings table for per-minute blood oxygen samples parsed from the watch's health stream, with an auto-migration from schema 38 to 39 and the exported schema. SpO2 is stored separately from HealthDataEntity because real readings are sparse (one per measurement interval) and keyed/deduped by minute timestamp.
ActivityMinuteData record version 14 appends spo2_percent and spo2_quality to each minute sample. parseStepsData now returns ParsedHealthData carrying both the step/HR entities and any SpO2 readings (only samples where spo2_percent > 0 are emitted). Adds a v14 parsing test plus a v13 backward-compatibility test.
Wire the new ParsedHealthData through processStepsData: insert step/HR records and SpO2 readings independently so a payload carrying only one of the two is still handled, and surface the SpO2 count in the debug summary.
Add SpO2 query methods (range readings, readings-after cursor, average, latest) and a LatestSpo2 model to HealthDataApi, implement them in Health against the new spo2Dao, and stub them in FakeLibPebble. Also threads the bloodOxygenEnabled flag into the HealthSettings model.
Add a bloodOxygenPreferences health setting (single enabled byte, defaults off) that the watch gates SpO2 measurement on. Encodes/decodes the blob, routes the key from the WatchPrefs BlobDB to HealthParams, and adds a Blood Oxygen toggle under Health settings (shown only when tracking + HRM are enabled).
health-kmp 1.4.0 doesn't model OxygenSaturation, so add expect/actual seams for blood-oxygen platform writing: Android writes via androidx.health.connect with a dedicated translucent permission activity, iOS is a no-op for now. PlatformHealthSync requests the extra permission and syncs SpO2 records using its own last-synced cursor.
Show a Blood Oxygen card (latest/average plus a daily SpO2 line chart scaled to the 85-100 band with scrub support) on the Health screen for HRM-capable watches, backed by a new Spo2UiState bucketed at 5-minute resolution in the view model.
This was referenced Jun 24, 2026
Contributor
|
that's awesome! We're relatively busy, but I'll try to schedule this over the next couple weeks to merge. |
Author
Awesome to hear ❤️ Love the work y'all put into Pebble! |
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.

Adds in blood oxygen support and settings into the mobile app.
Related commits :
coredevices/PebbleOS#1607
coredevices/pebbleos-nonfree#4