docs: document per-signal calibration and config save/reload
Update Docs/StreamHub-API.md (new setCalibration/reloadConfig commands, calibration/configSaved/configReloaded events, §4 config file format), ARCHITECTURE.md §6 (updated command/event tables and Config File Format subsection), Docs/WebUI.md (Cal row in V-Scale Toolbar, Sources & Config sidebar section). Also corrects the spec's Validation sentence to match the shipped cal-invalid border behaviour instead of silent field revert. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
e37eec0276
commit
d26b78b7f6
+25
-1
@@ -380,7 +380,9 @@ binary frames carry data push payloads.
|
||||
| `ping` | — | Hub replies `{"type":"pong"}` |
|
||||
| `addSource` | `label`, `addr` (`"host:port"`), `multicastGroup?`, `dataPort?` | Connect to a new UDPS source; hub assigns id `s1, s2, …` |
|
||||
| `removeSource` | `id` | Disconnect and remove a source |
|
||||
| `saveSources` | — | Persist the current dynamic source list to `SourcesFile` (JSON) |
|
||||
| `saveSources` | — | Persist the dynamic source list **and** the calibration table to `SourcesFile`; replies `configSaved` |
|
||||
| `setCalibration` | `source` (label), `signal` (base name), `scale`, `offset`, `unit` | Record `value = raw × scale + offset` for one signal; metadata only, the hub never applies it. Identity entries are deleted. Replies with a `calibration` broadcast |
|
||||
| `reloadConfig` | — | Re-read `SourcesFile`: calibration replaced wholesale, missing sources added, live sources never touched; replies `configReloaded` |
|
||||
| `getSources` | — | Trigger `sources` broadcast |
|
||||
| `getConfig` | `sourceId` | Trigger `config` broadcast for one source |
|
||||
| `getStats` | — | Trigger `stats` broadcast |
|
||||
@@ -402,8 +404,30 @@ binary frames carry data push payloads.
|
||||
| `triggerState` | `state` (`"idle"`\|`"armed"`\|`"collecting"`\|`"triggered"`), `mode`, `stopped`, `trigTime?` | On any trigger FSM transition |
|
||||
| `zoom` | `reqId`, `signals:{"src:sig":{t:[…], v:[…]}}` (`t` printed `%.17g`, `v` `%.9g`) | Unicast reply to `zoom` |
|
||||
| `maxPointsUpdated` | `maxPoints` | After ring buffer resize |
|
||||
| `calibration` | `cal:[{source, signal, scale, offset, unit}]` | On connect; after an accepted `setCalibration`; after a successful `reloadConfig` |
|
||||
| `configSaved` | `ok`, `path`, `error?` | In reply to `saveSources` |
|
||||
| `configReloaded` | `ok`, `path`, `error?` | In reply to `reloadConfig` |
|
||||
| `pong` | — | In reply to `ping` |
|
||||
|
||||
### Config File Format
|
||||
|
||||
`SourcesFile` is a flat JSON array of flat objects; `addr` marks a source,
|
||||
`signal` marks a calibration entry.
|
||||
|
||||
```json
|
||||
[
|
||||
{"label": "wave", "addr": "127.0.0.1:44500"},
|
||||
{"source": "wave", "signal": "Adc", "scale": 0.00030518, "offset": -1.25, "unit": "V"}
|
||||
]
|
||||
```
|
||||
|
||||
Flatness is a hard constraint: `StreamHub::LoadSourcesFile` scans from each `{`
|
||||
to the next `}`, so a nested object would truncate the parse. Both hubs read and
|
||||
write this format identically, and pre-calibration files load unchanged.
|
||||
|
||||
Calibration is applied **client-side only**. Rings, history, `zoom` replies, both
|
||||
binary frames and the trigger comparator are all in raw units.
|
||||
|
||||
### Binary Push Frame (version 1, hub → client, binary WS frame)
|
||||
|
||||
Little-endian throughout. Sent at `PushRate` Hz per source; contains **only
|
||||
|
||||
Reference in New Issue
Block a user