Watchapp skeleton: window stack, view switching, button handling #8

Closed
opened 2026-08-31 17:14:36 +02:00 by robert · 1 comment
robert commented 2026-08-31 17:14:36 +02:00 (Migrated from git.butzei.de)

Goal

Set up the app shell that the three views plug into.

Acceptance criteria

  • main.c handles app lifecycle and owns the AppMessage inbox
  • Window stack with three views: ride, navigation, map
  • Up/Down cycle views; Back leaves the app with a confirmation while a ride is running
  • AppMessage opened with app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum())
  • heap_bytes_free() logged at each view transition
  • Builds and runs on emery, and degrades to a usable layout on basalt (144x168)

Files

  • watchapp/src/c/main.c
  • watchapp/src/c/view_ride.c
  • watchapp/src/c/view_nav.c
  • watchapp/src/c/view_map.c

Notes

Max-size AppMessage buffers cost roughly 16 KB of heap - measure before assuming it fits.

The three-view stack is replaced by a flat page ring — data pages, navigation and map all as pages of
the same carousel. Button handling moved to its own issue; see docs/DESIGN.md section 5.

This issue keeps app lifecycle, the AppMessage inbox, heap_bytes_free() logging at page transitions,
and the basalt degradation check.

## Goal Set up the app shell that the three views plug into. ## Acceptance criteria - [ ] `main.c` handles app lifecycle and owns the AppMessage inbox - [ ] Window stack with three views: ride, navigation, map - [ ] Up/Down cycle views; Back leaves the app with a confirmation while a ride is running - [ ] AppMessage opened with `app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum())` - [ ] `heap_bytes_free()` logged at each view transition - [ ] Builds and runs on `emery`, and degrades to a usable layout on `basalt` (144x168) ## Files - `watchapp/src/c/main.c` - `watchapp/src/c/view_ride.c` - `watchapp/src/c/view_nav.c` - `watchapp/src/c/view_map.c` ## Notes Max-size AppMessage buffers cost roughly 16 KB of heap - measure before assuming it fits. ## Update — 2026-08-31: view stack becomes a page carousel The three-view stack is replaced by a flat page ring — data pages, navigation and map all as pages of the same carousel. Button handling moved to its own issue; see `docs/DESIGN.md` section 5. This issue keeps app lifecycle, the AppMessage inbox, `heap_bytes_free()` logging at page transitions, and the `basalt` degradation check.
Owner

Closed by PR #83 (merged): main.c app lifecycle, AppMessage inbox opened at max buffer size, and a minimal page_view.c placeholder (Select cycles the three #58 default pages, heap logged at each transition) so the heap-logging criterion has something to transition between — full carousel behaviour (Up/Down, skip-empty-page, long-press jumps) stays #60's job, not built here. Verified live in the emulator on all three targets (screenshots, real button presses), not just compiled.\n\nWorth flagging for whoever picks up #59/#60/#62 next: measured AppMessage-open heap cost is a flat 16500 bytes on every platform (8200 inbox + 8200 outbox + ~100 bookkeeping) since inbox/outbox size maximum() is platform-independent here. On basalt that leaves 44952 bytes free out of 61452 before opening (a ~27% cut, not the ~73% the PR description misstated) — still the tightest of the three targets by a wide margin, and every future feature (map polylines, sensor buffers, more AppMessage decoding) draws from that same shrunken basalt pool. Not blocking this issue, but a real number worth checking against DESIGN.md/REQUIREMENTS.md's basalt heap assumptions before #59/#62's round/template work leans on it.

Closed by PR #83 (merged): main.c app lifecycle, AppMessage inbox opened at max buffer size, and a minimal page_view.c placeholder (Select cycles the three #58 default pages, heap logged at each transition) so the heap-logging criterion has something to transition between — full carousel behaviour (Up/Down, skip-empty-page, long-press jumps) stays #60's job, not built here. Verified live in the emulator on all three targets (screenshots, real button presses), not just compiled.\n\n**Worth flagging for whoever picks up #59/#60/#62 next**: measured AppMessage-open heap cost is a flat 16500 bytes on every platform (8200 inbox + 8200 outbox + ~100 bookkeeping) since inbox/outbox size maximum() is platform-independent here. On `basalt` that leaves **44952 bytes free** out of 61452 before opening (a ~27% cut, not the ~73% the PR description misstated) — still the tightest of the three targets by a wide margin, and every future feature (map polylines, sensor buffers, more AppMessage decoding) draws from that same shrunken basalt pool. Not blocking this issue, but a real number worth checking against DESIGN.md/REQUIREMENTS.md's basalt heap assumptions before #59/#62's round/template work leans on it.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
robert/PedalPebble#8
No description provided.