|
|
static int32_t | steps_now (void) |
| | The day's step count so far, or -1 when the watch cannot say.
|
| static int | steps_through (void) |
| | The steps taken since the hold started.
|
|
static HrvState | burst_state (void) |
| | What the wearer is doing through the burst so far, from its steps and its movement.
|
| static bool | cannot_count (void) |
| | Whether the burst being held can no longer count for the main reading.
|
| static void | note_burst (int ms, uint32_t now_sec, bool counted) |
| | Keeps a finished or dropped burst in the tuning ring.
|
| static void | show (int ms, uint32_t now_sec) |
| | Puts a new reading up, or takes one down with -1, and redraws only when it moved.
|
| static void | save_log (void) |
| | Saves the log to flash, when the face gave it a slot.
|
| static void | local_day (uint32_t now_sec, int32_t *day, int *minute_of_day) |
| | The day and the minute of the day on the watch's own clock.
|
| static void | record (int ms, uint32_t now_sec) |
| | Files a finished reading and shows it, when it counts.
|
| static void | request (uint16_t period_sec, uint32_t now_sec) |
| | Asks the watch for beat gaps at a period, or tells it to stop with a period of 0.
|
| static void | on_accel (AccelData *data, uint32_t num_samples) |
| | Adds each accelerometer sample to the burst's movement, leaving out ones taken while the watch was vibrating, since the motor shakes it as hard as a step.
|
| static void | accel_start (void) |
| | Starts reading the accelerometer for a burst.
|
|
static void | accel_stop (void) |
| | Stops reading the accelerometer once a burst is over.
|
|
static void | hold_drop (void) |
| | Drops a hold without asking the watch for anything, for a caller about to ask for a period of its own.
|
| static void | hold_start (uint32_t now_sec) |
| | Holds the sensor on for the burst that just started, so its run can fill.
|
| static void | hold_end (uint32_t now_sec) |
| | Lets the sensor go back to the face's period once a burst is measured.
|
| static void | end_quiet_burst (uint32_t now_sec) |
| | Ends a burst whose beats went quiet: files what it measured, or notes it as dropped for a readout that shows each burst, and lets the sensor go.
|
|
void | health_hrv_on_gap (void) |
| | Reads one beat gap from the watch. The health store calls it for each HRV event.
|
|
void | health_hrv_poll (void) |
| | The HRV turn on the face's cadence, which the health store passes on while it is live.
|
| static void | show_latest_logged (uint32_t now_sec) |
| | Puts the log's newest reading that counted back up, when it is not stale yet.
|
| void | health_hrv_start (const HealthHrvConfig *cfg, int seed_ms, const HrvLog *seed_log, void(*changed)(void)) |
| | Starts HRV with the health store's rules, or starts it again with new ones.
|
| void | health_hrv_set_period (uint16_t period_sec) |
| | Changes how often the watch takes a burst. A period of 0 stops the sampling and puts the reading back to none on a live store, and a seeded store keeps its seed.
|
| void | health_hrv_set_rules (uint16_t still_mg, uint16_t walk_steps, uint16_t settle_gaps, HrvCount count, bool keep_all, bool live_redraw) |
| | Changes the rules for which bursts count and how they are measured, such as when the wearer changes a setting or places a panel.
|
|
void | health_hrv_stop (void) |
| | Stops the sampling, since the watch keeps an app's request going for an hour after it closes.
|
|
int | health_hrv_ms (void) |
| | The latest reading as RMSSD in ms, or -1 if there is none or it went stale.
|
|
bool | health_hrv_sampling (void) |
| | Whether the watch took the last request for beat gaps.
|
|
bool | health_hrv_measuring (void) |
| | Whether a burst is being measured right now, with the sensor held on.
|
|
const HrvLog * | health_hrv_log (void) |
| | The readings kept for the face's panels. Never NULL.
|
| bool | health_hrv_recent (int back, HrvBurst *out) |
| | One of the latest bursts, dropped ones included, newest first.
|
| bool | health_hrv_live (int *score, int *steps, int *held_sec) |
| | The burst being held right now.
|
|
uint16_t | health_hrv_still_mg (void) |
| | The still limit in use, in milli-g a sample.
|
|
uint16_t | health_hrv_walk_steps (void) |
| | The steps through a burst that make it a walk.
|
|
uint16_t | health_hrv_settle_gaps (void) |
| | The gaps left out at the start of each burst.
|
|
|
static HrvRun | s_run |
| | The run of beats being added up. It is kept apart from the reading, since a gap lands about once a beat and only a finished run changes what the face shows.
|
|
static int | s_ms = -1 |
| | The reading shown, or -1 for none.
|
|
static uint32_t | s_measured_at |
| | When the reading shown was taken, in seconds.
|
|
static uint16_t | s_period_sec |
| | How often the watch takes a burst, or 0 for not at all.
|
|
static bool | s_live |
| | True once HRV asks the watch, so seed mode never does.
|
|
static bool | s_sampling |
| | Whether the watch took the last request.
|
|
static uint32_t | s_asked_at |
| | When the watch was last asked, in seconds.
|
|
static uint32_t | s_gap_at |
| | When the last gap arrived, or the watch took a request, in seconds.
|
|
static bool | s_holding |
| | True while a burst is held on with HRV_HOLD_PERIOD_SEC.
|
|
static uint8_t | s_settle |
| | Gaps still to leave out at the start of this burst.
|
|
static uint16_t | s_still_mg |
| | The most the wrist may move for a burst to be still.
|
|
static uint16_t | s_walk_steps |
| | The steps through a burst that make it a walk.
|
|
static uint8_t | s_settle_gaps |
| | The gaps a burst leaves out as it starts.
|
|
static HrvCount | s_count |
| | Which bursts count for the main reading.
|
|
static bool | s_accel_on |
| | Whether the accelerometer is being read for the burst.
|
|
static HrvMotion | s_motion |
| | The movement seen through the burst being held.
|
|
static uint32_t | s_held_since |
| | When the hold started, in seconds.
|
|
static void(*) | s_changed (void) |
| | Called whenever the reading changes, so the face can redraw.
|
|
static bool | s_keep_all |
| | Whether a burst that cannot count is measured anyway, for a panel that shows it.
|
|
static bool | s_live_redraw |
| | Whether the face is redrawn once a second while a burst is held, for a readout that shows each burst.
|
|
static int32_t | s_steps_start = -1 |
| | The day's step count when the hold started, or -1 when not known.
|
|
static uint8_t | s_hold_gaps |
| | Gaps added to the run since the hold started.
|
|
static HrvBurst | s_recent [HRV_RECENT] |
| | The latest bursts, for a readout that shows each burst, kept in memory only.
|
|
static uint8_t | s_recent_head |
| | The slot the next burst goes in.
|
|
static uint32_t | s_persist_key |
| | The persist slot the log is saved in, or 0 for none.
|
|
static HrvLog | s_log |
| | The readings kept for the face's panels.
|
The heart rate variability half of the health store.
The watch reports one gap between two heartbeats at a time, as a health event. The health store holds the app's one health subscription, so it hands each of those events here, along with its turn on the face's cadence. The arithmetic, which beats count and how a run adds up to RMSSD, is in core/health/hrv_run.c, and the movement score is in core/health/hrv_motion.c.