Ride state machine: idle / running / paused / stopped #11

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

Explicit ride lifecycle driving what is recorded and what is displayed.

Acceptance criteria

  • States: idle -> running -> paused -> running -> stopped
  • Select starts and pauses; long Select stops with confirmation
  • Moving time accumulates only while running
  • State changes sent to the phone via CMD
  • Vibration feedback distinguishes start, pause and stop

Files

  • watchapp/src/c/state.c
  • watchapp/src/c/state.h

Update — 2026-09-02: commands survive a dropout, and the watch never auto-pauses

The phone is authoritative on RIDE_STATE once connected; the rider can pause from the wrist; the
watch runs on its own through a dropout; and dropouts of tens of seconds are ordinary (D31). Put
together, the rider pauses at a café mid-dropout, the phone reconnects asserting running, and the
pause is silently undone (D43).

  • Every CMD is stamped with CMD_TIME and held in a watch-side queue until the phone
    acknowledges it via STATE_ACK
  • On reconnect the queue drains oldest-first, before any incoming RIDE_STATE is applied
  • An unacknowledged command is never overwritten by a RIDE_STATE push
  • The watch never auto-pauses. Auto-pause is a phone function (#69); the watch has no speed
    source when disconnected and cannot implement it even in principle
  • While disconnected the watch counts wall-clock elapsed time and displays it as wall-clock,
    not as moving time; on reconnect the phone's moving time replaces it
  • Test: pause on the watch during a simulated dropout, reconnect, and confirm the ride is still
    paused
## Goal Explicit ride lifecycle driving what is recorded and what is displayed. ## Acceptance criteria - [ ] States: idle -> running -> paused -> running -> stopped - [ ] Select starts and pauses; long Select stops with confirmation - [ ] Moving time accumulates only while running - [ ] State changes sent to the phone via `CMD` - [ ] Vibration feedback distinguishes start, pause and stop ## Files - `watchapp/src/c/state.c` - `watchapp/src/c/state.h` ## Update — 2026-09-02: commands survive a dropout, and the watch never auto-pauses The phone is authoritative on `RIDE_STATE` once connected; the rider can pause from the wrist; the watch runs on its own through a dropout; and dropouts of tens of seconds are ordinary (D31). Put together, the rider pauses at a café mid-dropout, the phone reconnects asserting `running`, and the pause is silently undone (D43). - [ ] Every `CMD` is stamped with `CMD_TIME` and held in a watch-side queue until the phone acknowledges it via `STATE_ACK` - [ ] On reconnect the queue drains **oldest-first, before** any incoming `RIDE_STATE` is applied - [ ] An unacknowledged command is **never** overwritten by a `RIDE_STATE` push - [ ] **The watch never auto-pauses.** Auto-pause is a phone function (#69); the watch has no speed source when disconnected and cannot implement it even in principle - [ ] While disconnected the watch counts **wall-clock** elapsed time and displays it as wall-clock, not as moving time; on reconnect the phone's moving time replaces it - [ ] Test: pause on the watch during a simulated dropout, reconnect, and confirm the ride is still paused
Sign in to join this conversation.
No description provided.