HRM integration with sample-period lifecycle #10

Open
opened 2026-08-31 17:14:37 +02:00 by robert · 0 comments
robert commented 2026-08-31 17:14:37 +02:00 (Migrated from git.butzei.de)

Goal

Read heart rate from the watch's own optical sensor, so HR keeps working even if the phone dies.

Acceptance criteria

  • health_service_metric_accessible checked before subscribing, with a graceful message if unavailable
  • Sample period set to the value chosen in Spike B on ride start
  • Subscribed to HealthEventHeartRateUpdate, display updated on each event
  • Sample period reset to 0 in deinit and on ride stop - otherwise the HRM keeps sampling fast after exit and drains the battery
  • Sample age tracked; the reading is greyed once it is older than a threshold

Files

  • watchapp/src/c/hrm.c
  • watchapp/src/c/hrm.h

Update — 2026-08-31: the Round 2 has no HRM

gabbro has no optical heart rate sensor. This must be handled by the ordinary rules, not by special
cases:

  • health_service_metric_accessible() returning false leads to the HR field having no source,
    so it renders -- and the Effort page auto-hides — no error dialog, no empty page
  • The HRM code compiles and links cleanly on gabbro without #ifdef scattering
  • Verified in the gabbro emulator: no crash, no stray HR UI

A BLE chest strap would restore HR on the Round 2 and improve accuracy on the Time 2, but was
deliberately left out of scope. See docs/DECISIONS.md D24.

## Goal Read heart rate from the watch's own optical sensor, so HR keeps working even if the phone dies. ## Acceptance criteria - [ ] `health_service_metric_accessible` checked before subscribing, with a graceful message if unavailable - [ ] Sample period set to the value chosen in Spike B on ride start - [ ] Subscribed to `HealthEventHeartRateUpdate`, display updated on each event - [ ] **Sample period reset to 0 in `deinit` and on ride stop** - otherwise the HRM keeps sampling fast after exit and drains the battery - [ ] Sample age tracked; the reading is greyed once it is older than a threshold ## Files - `watchapp/src/c/hrm.c` - `watchapp/src/c/hrm.h` ## Update — 2026-08-31: the Round 2 has no HRM `gabbro` has no optical heart rate sensor. This must be handled by the ordinary rules, not by special cases: - [ ] `health_service_metric_accessible()` returning false leads to the `HR` field having **no source**, so it renders `--` and the Effort page auto-hides — no error dialog, no empty page - [ ] The HRM code compiles and links cleanly on `gabbro` without `#ifdef` scattering - [ ] Verified in the `gabbro` emulator: no crash, no stray HR UI A BLE chest strap would restore HR on the Round 2 and improve accuracy on the Time 2, but was deliberately left out of scope. See docs/DECISIONS.md D24.
Sign in to join this conversation.
No description provided.