Loading...
Searching...
No Matches
dev_walk.c File Reference

The shared dev harness. It seeds the stores from a fixed fixture and drives the theme walk. Compiled for any face that lists the dev plugin, and the linker drops it from any face that never calls it, which is every release build. More...

Data Structures

struct  DevShot
 One screenshot's worth of state, so a walk of eight themes is not eight shots of the same numbers. More...
struct  [struct].s_fixed

Functions

static void seed_shot (const DevShot *shot)
 Seed the clock, weather, health, and system stores from one shot. A face without weather gets an empty weather store, so it never boots the harness with a reading it cannot show.
static void apply_shot (uint8_t index)
 Move the walk onto one shot, Quiet Time mark included.
static void tap_handler (AccelAxisType axis, int32_t direction)
 Accelerometer tap: advance the active walk by one.
void dev_walk_seed_stores (int hour, int min)
 Inits the clock, weather, health, system, and location stores from the default fixture, with live set to false and a pinned clock, so the face shows fixed data that no live reading can stomp. Weather and location are only filled for a face that declares their keys, and left empty otherwise. Call in place of those stores' live inits.
void dev_walk_init (DevWalkMode mode, void(*apply_theme)(void))
 Starts the walk. A theme walk forces the first theme and subscribes the accelerometer tap. Either mode then paints. Call after engine_init.
void dev_walk_deinit (void)
 Drop the tap subscription. Call from deinit.

Variables

static const struct  s_fixed
 The readings no shot varies, and where the watch is.
static const DevShot s_shots []
 The shots a theme walk steps through. The first is also what a face shows with no walk.
static DevWalkMode s_mode
 Which walk is running.
static void(*) s_apply_theme (void)
 The face's theme-apply hook, run before the engine rebuilds.
static uint8_t s_theme
 The theme the walk is on.
static int s_hour
 The hour the face pinned the clock to.
static int s_minute
 The minute the face pinned the clock to.

Detailed Description

The shared dev harness. It seeds the stores from a fixed fixture and drives the theme walk. Compiled for any face that lists the dev plugin, and the linker drops it from any face that never calls it, which is every release build.

Function Documentation

◆ apply_shot()

void apply_shot ( uint8_t index)
static

Move the walk onto one shot, Quiet Time mark included.

Parameters
indexWhich shot, wrapped to the table.

◆ seed_shot()

void seed_shot ( const DevShot * shot)
static

Seed the clock, weather, health, and system stores from one shot. A face without weather gets an empty weather store, so it never boots the harness with a reading it cannot show.

The stores are only ever seeded here with live off, and none of them takes a subscription on that path, so seeding again on a tap re-seeds rather than stacking handlers.

Parameters
shotThe shot to seed from.

◆ tap_handler()

void tap_handler ( AccelAxisType axis,
int32_t direction )
static

Accelerometer tap: advance the active walk by one.

Parameters
axisThe tap axis (unused).
directionThe tap direction (unused).

Variable Documentation

◆ s_fixed

const struct [struct].s_fixed s_fixed
Initial value:
= {
.calories = 420, .sleep_min = 431, .active_min = 52, .distance_m = 5300,
.lat = "33-44", .lon = "-112-07",
}

The readings no shot varies, and where the watch is.

◆ s_shots

const DevShot s_shots[]
static
Initial value:
= {
{.temp = 21, .cond = "PCLDY", .hr = 72, .steps = 8431, .battery = 64, .bluetooth = true, .quiet_icon = false},
{.temp = 3, .cond = "SNOW", .hr = 58, .steps = 12045, .battery = 92, .bluetooth = true, .quiet_icon = true},
{.temp = -8, .cond = "CLEAR", .hr = 61, .steps = 3120, .battery = 41, .bluetooth = false, .quiet_icon = false},
{.temp = 31, .cond = "CLEAR", .hr = 88, .steps = 15680, .battery = 17, .bluetooth = true, .quiet_icon = true},
{.temp = 14, .cond = "DRZL", .hr = 66, .steps = 6402, .battery = 78, .bluetooth = true, .quiet_icon = false},
{.temp = 27, .cond = "CLDY", .hr = 74, .steps = 9310, .battery = 8, .bluetooth = false, .quiet_icon = true},
{.temp = 9, .cond = "FOGGY", .hr = 55, .steps = 4870, .battery = 100, .bluetooth = true, .quiet_icon = false},
{.temp = 35, .cond = "PCLDY", .hr = 91, .steps = 11250, .battery = 53, .bluetooth = true, .quiet_icon = true},
}

The shots a theme walk steps through. The first is also what a face shows with no walk.

They cover the range rather than falling at random, with a flat battery and a full one, a dropped phone, the Quiet Time mark up and down, and a range of weather so the scene is not drawing the same sky eight times.