Add a setting
The settings model is one table in crates/orpheus-apps/src/settings.rs:
every group and item with its store key, kind, range and default. The
Settings screens are generated from it; the firmware keeps the values in
the NOR settings store (orpheus-settings, at 0x7DA000).
-
Pick a key. Keys are
u16, the group in the high byte (0x0101..=0x0CFF; System is0x0C..). Take the next free one in the group and never reuse a key, even of a removed setting: old stores on players still hold it. -
Add the item to the group's list, for example a choice:
c(0x0C07, Str::Performance, ch![S(Str::PerfNormal), S(Str::PerfMaximum)], 0),Kinds:
Toggle,Choice,Range(with a unit),Action,Info, plus the specialLanguageandHomeApps. Every stored value is ani16; decoding validates it against the kind and falls back to the default, so a corrupt record never reaches the UI. -
Name it with
pub const NAME: SettingId = SettingId(0x0C07);in theidmodule, so code refers to it by name. -
Strings: append the label and choice names to
strings.rs, with translations insim/src/packs.rs. -
Use it. In the firmware, read it with
settings.get(id::NAME)where the behaviour lives (for example the governor readsid::PERFORMANCE). If the setting must act at once, handle its change in the service that applies settings. The simulator stores it the same way. -
Factory reset sets every item back to its default with no extra code.
-
Goldens: a new row moves the lists below it; re-bless and look at the changed images (
cargo xtask test golden --bless). If the setting is visible to users, describe it indocs/user/settings.md(or the app's page).
Raise STORED (the number of stored settings; a unit test checks it).
The firmware's boot-time key buffer is sized from it.