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

The shared dev harness. It seeds the stores from a fixed fixture, or from the unit's paf.dev.config.json for a store the config seeds, and drives the theme walk or a walk the config lays out. 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 seed_shot_weather (const DevShot *shot)
 Seed the weather store from one shot.
static void seed_rest_store (DevStore store)
 Seed one of the location, stock, calendar, phone battery, and now playing stores, from the config where it gives the screen on show readings, and from the fixture or empty otherwise.
static void seed_rest (bool all)
 Seed the location, stock, calendar, phone battery, and now playing stores.
static void repaint (void)
 Run the face's hook and repaint everything, once the settings and the stores are in place.
static void show_theme (void)
 Show the theme the theme walk is on, with the shot of the same number and its Quiet Time mark.
static void show_step (void)
 Show the screen a walk the config lays out is on.
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. The stock and calendar stores start empty with live false for a face that declares STOCK_STRIP or CALENDAR_STRIP, so a settings save cannot start them fetching. The phone battery and now playing stores start empty with live false for a face that declares their keys, since the seeded system store tells them nothing about the link. Call it after settings_init, so the weather seed takes the wearer's temperature unit, in place of those stores' live inits, and before any store init of the face's own, then seed the face's own data after it.
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, and a walk the config lays out shows its first screen and subscribes it. Every 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 uint16_t s_step
 The step a walk the config lays out 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.
static const DevStore s_rest [] = {DEV_STORE_LOCATION, DEV_STORE_STOCKS, DEV_STORE_CALENDAR, DEV_STORE_PHONE, DEV_STORE_MUSIC}
 The stores seeded once at launch, and again only when a screen picks another seed for one.
static uint8_t s_rest_picks [ARRAY_LENGTH(s_rest)]
 The seed each store in s_rest last took, by the same place, or DEV_NONE for the fixture.

Detailed Description

The shared dev harness. It seeds the stores from a fixed fixture, or from the unit's paf.dev.config.json for a store the config seeds, and drives the theme walk or a walk the config lays out. 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

◆ seed_rest()

void seed_rest ( bool all)
static

Seed the location, stock, calendar, phone battery, and now playing stores.

Starting the phone battery or now playing store not live tells the phone the face no longer wants the reading, and each start arms its timers again, so after launch a store is only seeded again when the screen on show picks another seed for it.

Parameters
allTrue at launch, to seed every one of them.

◆ seed_rest_store()

void seed_rest_store ( DevStore store)
static

Seed one of the location, stock, calendar, phone battery, and now playing stores, from the config where it gives the screen on show readings, and from the fixture or empty otherwise.

The stock and calendar stores start empty and pinned, so a settings save that reconfigures them live leaves them alone rather than fetching real quotes and agendas. A face without their keys skips them here, so the harness never drags their buffers into its dev build. The phone battery and now playing stores start empty and pinned too, since the seeded system store hears no link change and a live one would hold its reading through a drop.

Parameters
storeThe store.

◆ 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.

Every store here starts with live off, which lets go of any channel, service, or link listener a live start took and takes none of its own, so seeding again on a tap re-seeds rather than stacking handlers. The weather seed is in the wearer's unit as the settings hold it at the time.

A store the unit's paf.dev.config.json seeds takes the config's readings rather than the shot's, on every shot, so the theme walk only moves the stores the config leaves to the fixture. The clock takes the clock and date of the screen on show, from the config.

Parameters
shotThe shot to seed from.

◆ seed_shot_weather()

void seed_shot_weather ( const DevShot * shot)
static

Seed the weather store from one shot.

Parameters
shotThe shot to seed from.

◆ show_step()

void show_step ( void )
static

Show the screen a walk the config lays out is on.

The settings go first, since the weather seed takes the temperature unit they may set. Then the clock and the weather, health, and system stores are seeded again, from the screen's readings or the fixture's first shot, along with any other store whose seed the screen changes. So nothing an earlier screen seeded is left behind. Last the face's hook runs and the face repaints.

◆ show_theme()

void show_theme ( void )
static

Show the theme the theme walk is on, with the shot of the same number and its Quiet Time mark.

The data moves with the theme, so a sheet of every palette is also a sheet of every battery level, both bluetooth states, and a range of weather.

◆ 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.