Skip to content

Log raw PPG wire values during blood pressure calibration - #51

Open
FacuM wants to merge 2 commits into
mainfrom
diag/bp-ppg-logging
Open

FacuM wants to merge 2 commits into
mainfrom
diag/bp-ppg-logging

Conversation

@FacuM

@FacuM FacuM commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On the Galaxy Watch8 Classic, blood pressure calibration fails at 99% with a signal quality error. The green channel status is -1 on every sample and the values stay around +-60, so the adapter needs to see what the Health Tracking service actually sends.

While a BP measurement runs, the watch now logs (tag PpgWire) the decoded int/float/long fields of every value position for the first 300 data points, and the class of any element it skips. The periodic stats line also gains green/red/IR status counts, red/IR ranges and the mean absolute green step. Logging only; the parse result is unchanged.

The same code went out to the reporter as the 0.11.7-diag42 test build; this ships it in normal releases so the log can come from a regular update.

Tests

watch-mod/test/run-tests.sh passes (BpAdapterTest and ServiceProtocolPpgTest cover the new formatting and the dump budget).

Version

0.11.9 (0.11.8 is taken by PR #49).

Refs #42

Summary by CodeRabbit

  • New Features
    • Added detailed blood pressure and PPG diagnostic logs, including signal statistics, status summaries, and decoded data for a limited number of points. These logs do not change the samples used by the app.
    • Tracker logs now include the tracker type and requested signal.
  • Documentation
    • Added guidance on the diagnostic logs and the information they contain.
  • Other
    • Updated the app version to 0.11.9.

Diagnostics for #42: the Watch8 Classic delivers PPG_ON_DEMAND green samples that are all flagged abnormal and much smaller than on other watches. BpAdapter now dumps the decoded int, float and long fields of the first 300 PPG data points (tag PpgWire), logs the armed tracker type, and adds the green/red/IR status counts, red/IR ranges and the mean absolute green step to its stats line. What is fed to Samsung Health Monitor does not change.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T04:56:09.013008Z 420b1f5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds bounded PPG wire logging and periodic BP sample diagnostics. It adds host-side tests and documentation for these diagnostics. The configured app version changes from 0.11.7 to 0.11.9.

Changes: PPG Diagnostics

Layer / File(s) Summary
Capture PPG wire diagnostics
watch-mod/src/shminterop/hsdk/PpgWireDump.java, watch-mod/src/shminterop/hsdk/ServiceProtocol.java, watch-mod/test/src/shminterop/hsdk/ServiceProtocolPpgTest.java, watch-mod/test/run-tests.sh
PpgWireDump logs decoded point details within an armed point budget. ServiceProtocol supplies the decoded values and skipped class names. Tests check the output, budget, and unchanged parsed samples.
Integrate BP diagnostics
watch-mod/src/shminterop/bp/BpAdapter.java, watch-mod/test/src/shminterop/bp/BpAdapterTest.java, docs/bp-calibration.md
BpAdapter tracks status counts, red/IR ADC ranges, and mean absolute green-sample differences. It reports these values with periodic statistics and arms or disarms wire logging at BP start or stop. Tests verify the statistics format, and documentation describes the logged diagnostics.

App Version Update

Layer / File(s) Summary
Update configured app version
patcher-app/app/build.gradle.kts
The configured versionName changes from 0.11.7 to 0.11.9.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant BpAdapter
  participant PpgWireDump
  participant ServiceProtocol
  participant AndroidLog
  BpAdapter->>PpgWireDump: Arm a 300-point dump at BP start
  ServiceProtocol->>PpgWireDump: Consume budget and record parsed point details
  PpgWireDump->>AndroidLog: Emit batch and point details
Loading

Possibly related issues

  • LibreStatic/LibreWrist#42: The diagnostics log PPG wire values and channel status counts related to the reported BP calibration failure. The changes add investigation data but do not fix the failure.
Merge Risk: Minimal · up to 420b1

This change adds bounded diagnostic logging for PPG data during blood pressure calibration and bumps the version to 0.11.9. It does not alter the samples sent to the health monitor. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Log raw PPG wire values during blood pressure calibration" matches the main change. The PR adds PpgWireDump, which logs decoded int, float, and long fields for the first 300 PPG data points…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Log raw PPG wire values during blood pressure calibration" matches the main change. The PR adds PpgWireDump, which logs decoded int, float, and long fields for the first 300 PPG data points during blood pressure measurement. The title is specific and concise. The title does not mention the expanded stats line, but that is a secondary part of the change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51e42a7e-f659-46bc-ac02-54e2b549d67a
Commits

Reviewing files that changed from the base of the PR and between 11fad5f and 420b1f5.

Files selected for processing: 8

  • docs/bp-calibration.md
  • patcher-app/app/build.gradle.kts
  • watch-mod/src/shminterop/bp/BpAdapter.java
  • watch-mod/src/shminterop/hsdk/PpgWireDump.java
  • watch-mod/src/shminterop/hsdk/ServiceProtocol.java
  • watch-mod/test/run-tests.sh
  • watch-mod/test/src/shminterop/bp/BpAdapterTest.java
  • watch-mod/test/src/shminterop/hsdk/ServiceProtocolPpgTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 420b1f59ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread patcher-app/app/build.gradle.kts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant