theallelectricsmartgrid

State Saver

The state saver (private/src/StateSaver.hpp) handles persistence of runtime control state to/from JSON.

Role

StateSaver bridges live in-memory values and serialized patch/project state:

In TheNonagonSquiggleBoyInternal, it is saved and loaded alongside Nonagon and SquiggleBoy state.

Internal model

StateSaverTemp<NumScenes> stores compact per-scene snapshots for registered values:

This design keeps serialization generic while preserving exact typed values.

Scene-aware persistence

StateSaver works with scene logic so scene-specific values are retained: