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...
#include "dev/dev_walk.h"#include "dev/dev_config.h"#include <time.h>#include "io/stores/time_store.h"#include "io/stores/weather_store.h"#include "io/stores/health_store.h"#include "io/stores/system_store.h"#include "io/stores/location_store.h"#include "io/stores/stock_store.h"#include "io/stores/calendar_store.h"#include "io/stores/phone_store.h"#include "io/stores/music_store.h"#include "io/appmessage/appmessage_features.h"#include "system/settings/settings.h"#include "ui/engine/engine.h"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. | |
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.
|
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.
| all | True at launch, to seed every one of them. |
|
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.
| store | The store. |
|
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.
| shot | The shot to seed from. |
|
static |
Seed the weather store from one shot.
| shot | The shot to seed from. |
|
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.
|
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.
|
static |
Accelerometer tap: advance the active walk by one.
| axis | The tap axis (unused). |
| direction | The tap direction (unused). |
| const struct [struct].s_fixed s_fixed |
The readings no shot varies, and where the watch is.
|
static |
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.