feat(F-040,F-041,F-042): relay.set_config, output numbering fix, clock batch commands

Enforce 1-based output numbering throughout the entire stack. Stored values,
MQTT wire format, and console UI are all 1-based; the single 0-based conversion
happens only in OutputManager::getPhysicalOutput(). Fixed createDefaultBellConfig
(was setting identity 0-based map instead of 0=disabled), updateBellDurations and
updateBellOutputs (support both v2 0/1 and v1 b1/b2 keys), all call
sites that bypassed getPhysicalOutput, and fireClockOutput conversion.

New commands:
- relay.set_config: combined durations + outputs in one round trip (F-040)
- clock.set_config: enabled/c1/c2/pulse_duration/pause_duration in one call (F-042)
- clock.set_alerts_config: alert type, bells, and silence windows in one call (F-042)

Feature catalog updated with F-040, F-041, F-042 detail sections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 18:44:52 +03:00
co-authored by Claude Sonnet 4.6
parent a5395b0de7
commit 0ac63e82ed
8 changed files with 241 additions and 68 deletions
+40
View File
@@ -49,6 +49,9 @@ Every feature — user-facing or significant internal mechanism — is listed he
| F-037 | Network status extended (SSID + MAC in `network.status`) | v2.1.0 | Stable |
| F-038 | Bell test fire commands (`relay.test_bell` / `relay.test_batch`) | v2.1.0 | Stable |
| F-039 | Clock output test fire commands (`clock.test_c1` / `clock.test_c2`) | v2.1.0 | Stable |
| F-040 | Combined relay config command (`relay.set_config`) | v2.1.1 | Stable |
| F-041 | Output numbering convention enforced — 1-based everywhere except raw chip pin | v2.1.1 | Stable |
| F-042 | Combined clock config commands (`clock.set_config` / `clock.set_alerts_config`) | v2.1.1 | Stable |
---
@@ -526,3 +529,40 @@ Both use `OutputManager::fireClockOutput()` which resolves the physical pin from
`ClockHandler` constructor now accepts an optional `OutputManager*` (defaults to `nullptr`); the router passes `_outputManager` so the test commands are live when the output manager is registered.
Subsystem: `src/Communication/Handlers/ClockHandler/ClockHandler.cpp`
---
### F-040 — Combined relay config command (`relay.set_config`)
Single command that sets bell durations and/or output assignments in one round trip, replacing the need to send `relay.set_durations` + `relay.set_outputs` separately. Both `durations` and `outputs` fields are optional — at least one must be present. Partial updates accepted (only the fields provided are changed).
Subsystem: `src/Communication/Handlers/RelayHandler/RelayHandler.cpp`
---
### F-041 — Output numbering convention enforced — 1-based everywhere except raw chip pin
Bell outputs are stored and communicated as **1-based numbers** throughout the entire stack (config, MQTT protocol, console UI). The single conversion to 0-based chip pin index happens only in `OutputManager::getPhysicalOutput()`, which subtracts 1 immediately before calling the hardware driver.
`0` = disabled. `255` = unconfigured sentinel (internal only, never sent over wire).
All call sites (BellEngine, RelayHandler test commands, TimeKeeper alerts) now go through `getPhysicalOutput()` rather than calling `fireOutputForDuration()` with a raw stored value. `relay.test_output` is the sole exception — it is a raw hardware diagnostic that intentionally takes a 0-based chip pin directly, and is documented as such.
`createDefaultBellConfig()` initialised outputs to `i` (0-based identity map) — corrected to `0` (all disabled).
Subsystems: `src/OutputManager/OutputManager.cpp`, `src/ConfigManager/ConfigManager.cpp`, `src/Communication/Handlers/RelayHandler/RelayHandler.cpp`, `src/TimeKeeper/TimeKeeper.cpp`
---
### F-042 — Combined clock config commands (`clock.set_config` / `clock.set_alerts_config`)
Two batch commands that each collapse multiple individual clock commands into one round trip:
| Command | Replaces |
|---|---|
| `clock.set_config` | `clock.enable/disable` + `clock.set_outputs` + `clock.set_timings` |
| `clock.set_alerts_config` | `clock.set_alerts` + `clock.set_silence` |
All fields optional — at least one required. Single `saveClockConfig()` call per command regardless of how many fields are set.
Subsystem: `src/Communication/Handlers/ClockHandler/ClockHandler.cpp`