Skip to content

Workout detail in two tabs; jring workouts stream heart rate the whole session - #86

Merged
gabrielbr merged 1 commit into
mainfrom
ccr-67ccb970-dqwwqd
Nov 16, 2026
Merged

gabrielbr merged 1 commit into
mainfrom
ccr-67ccb970-dqwwqd

Conversation

@gabrielbr

Copy link
Copy Markdown
Owner

Why

The owner compared one gym session (12 Nov) with a Huawei watch:

Watch PulseLoop
Average HR 116 76
Max HR 149 97
Calories 315 active / 379 total 297

Cause (from the vendor app, JRing 2.0.8 decompiled locally)

0x14 is the vendor's setHeartRateMode(on, seconds, mode): bytes 1–4 are a duration in seconds, little-endian, and byte 5 is a sport mode. PulseLoop started workouts with 14 b4…. That is 180 seconds, the vendor's spot check (FragmentMain.startTestHeart). So each workout streamed only its warm-up. The vendor's run screen (RunRecordActivity.startHeartrateMode) instead sends duration 0 (until stopped) and the sport mode, when the ring's 0x20 reply sets bit 56 (FUNCTION_SPORT_FROM_APP). The owner's ring sets it. Notes are in docs/jring-56ff-plan.md and AGENTS.md; the decompile stays out of git.

Changes

  • Ring:
    • JringSyncEngine starts and stops workout heart rate in the vendor's sport mode.
    • Without bit 56 it falls back to the old start.
    • A 0x20 reply after a mid-workout reconnect moves the stream across.
    • SpO₂ is no longer polled while a workout stream runs, because the ring has one optical sensor.
  • Figures:
    • WorkoutHeart weights heart rate by time. Each reading stands for at most 2 minutes, so a 1 Hz stream can't outvote the ring's log.
    • Adds active/resting calories (Mifflin-St Jeor).
    • Adds a training load estimate (Banister TRIMP). It lands near the watch's 34 for that session's numbers.
    • The stored summary uses the time-weighted average and max.
  • Screen: two tabs.
    • Summary: total kcal, active and resting, duration, average HR, training load (marked as an estimate). GPS workouts also keep distance with pace or speed, the map and the splits.
    • Heart rate: curve with a labelled average, maximum, minutes per zone with bpm ranges, a coverage note, and an empty state.
    • Follows whichever look is on.
  • Tests: JringWorkoutHeartRateTest, WorkoutHeartTest. pt-BR for every new string.

Checks

  • Full unit suite run locally: 2065 tests, 3 failures. The same 3 fail on unchanged main in this container: MealJournalTest ×2 (timezone) and ResponsesHttpTest (DNS proxy).
  • Both tabs were rendered on the JVM with Robolectric (both looks, 1.3× font). That harness was local only.
  • Audit: audits/2026-11-16-workout-detail-tabs.md.
  • The design canvas wasn't reachable from this session; the Workout board is still owed.
  • Owed on hardware: that a session's stream lasts the whole workout.

Generated by Claude Code

…e session

A 46-minute gym session read 76/97 bpm against a watch's 116/149. The jring
workout started the vendor's 180-second spot check (14 b4…), so only the
warm-up streamed. The vendor's run screen sends duration 0 and the sport
mode when 0x20 bit 56 is set (RunRecordActivity, setHeartRateMode); do the
same, and stop in the same mode. SpO2 is no longer polled while a workout
stream runs.

The summary now weights heart rate by time (WorkoutHeart), so a 1 Hz
stream can't outvote the ring's log, and adds active/resting calories and
a training load estimate (Banister TRIMP).

The workout screen becomes two tabs: Summary (total kcal, active and
resting, duration, average HR, training load) and Heart rate (curve with
average, maximum, minutes per zone). Audit in
audits/2026-11-16-workout-detail-tabs.md.

Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w
@gabrielbr
gabrielbr merged commit a4b0606 into main Nov 16, 2026
1 check passed
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.

2 participants