# Feature Catalog This is the single source of truth for "what does this device actually do?" Every feature — user-facing or significant internal mechanism — is listed here. **Rule: every new feature or observable behaviour change gets an entry before or with its commit.** --- ## Index **"Since" = the `FW_VERSION` actually shipped in `src/Version.hpp` at the time, never a guessed/incremented number.** Check `git log -- src/Version.hpp` for the real bump history before tagging a new entry. | ID | Feature | Since | Status | |---|---|---|---| | F-001 | Relay-driven melody playback | pre-v2 | Stable | | F-002 | Built-in melody library (PROGMEM) | pre-v2 | Stable | | F-003 | SD-card melody download & storage | pre-v2 | Stable | | F-004 | MQTT transport | pre-v2 | Stable | | F-005 | WebSocket transport | pre-v2 | Stable | | F-006 | UART/Serial transport | pre-v2 | Stable | | F-007 | HTTP / AsyncWebServer transport | pre-v2 | Stable | | F-008 | MQTT heartbeat (retained, 30 s) | v130 | Stable | | F-009 | SemVer firmware versioning | v2.0.0 | Stable | | F-010 | OTA update (FastAPI backend, safe-mode boot check) | v2.0.1 | Stable | | F-011 | MQTT dynamic auth (HMAC-SHA256 device password) | v2.x | Stable | | F-012 | HAL variant system (multi-board build flags) | v2.x | Stable | | F-013 | RF Remote subsystem (HAS_RF variant) | v2.x | Stable | | F-014 | NVS device-identity migration (`device_uid`/`hw_type`/`hw_version` → `serial`/`hw_family`/`hw_revision`) | v2.x | Stable | | F-015 | Two-tier factory reset (5 s WiFi wipe / 10 s full reset) | v2.0.3 | Stable | | F-016 | WiFi credential fallback chain (saved → failsafe → portal) | v2.0.3 | Stable | | F-017 | SettingsWebServer (captive-portal config UI) | v2.0.3 | Stable | | F-018 | Built-in melody `builtin_*` UID aliases (backward compat) | v2.0.3 | Stable | | F-019 | NTP sync — fetch UTC, apply stored offsets manually | v2.0.3 | Stable | | F-020 | Command envelope version default changed to v1 | v2.0.3 | Stable | | F-021 | RelayHandler v1/v2 dual-format compatibility | v2.0.3 | Stable | | F-022 | Player speed guard (zero-speed defaults to 300 ms) | v2.0.3 | Stable | | F-023 | Telemetry bell max load default raised to 500 | v2.0.3 | Stable | | F-024 | V1 playback segment_duration fix (single-segment mode) | v2.1.0 | Stable | | F-025 | V2 playback command namespace (`playback.play` / `playback.stop`) | v2.1.0 | Stable | | F-026 | V2 playback `mode` field (`single` / `timed` / `interval` / `infinite`) | v2.1.0 | Stable | | F-027 | FileManager HTTPS removed — melody downloads over plain HTTP only | v2.1.0 | Stable | | F-028 | Logging level calibration — sane defaults + per-subsystem MQTT caps | v2.1.0 | Stable | | F-029 | Bell mechanism master ON/OFF switch (`bells.enable` / `bells.disable`) | v2.1.0 | Stable | | F-030 | Bell load guard ON/OFF switch (`telemetry.set_guard_enabled`) | v2.1.0 | Stable | | F-031 | Bell load guard threshold control per-bell (`telemetry.set_max_loads`) | v2.1.0 | Stable | | F-032 | Device runtime + boot tracking (SD-persisted, 10-min flush, boot log) | v2.1.0 | Stable | | F-033 | Total playback counter (SD-persisted lifetime count) | v2.1.0 | Stable | | F-034 | Telemetry aggregate commands (`telemetry.get_metrics`, `telemetry.reset_metrics`) | v2.1.0 | Stable | | F-035 | System aggregate commands (`system.get_config`, `system.get_all`, `system.get_telemetry`) | v2.1.0 | Stable | | F-036 | Per-subsystem config getters (`log.get_config`, `mqtt.get_config`, `bells.get_config`) | v2.1.0 | Stable | | 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.0 | Stable | | F-041 | Output numbering convention enforced — 1-based everywhere except raw chip pin | v2.1.0 | Stable | | F-042 | Combined clock config commands (`clock.set_config` / `clock.set_alerts_config`) | v2.1.0 | Stable | | F-043 | `network.info` expanded — subnet, MAC, hostname, SSID, connection type | v2.1.0 | Stable | | F-044 | `network.status` slimmed — pure runtime state (connected, state, RSSI, uptime, AP mode) | v2.1.0 | Stable | | F-045 | Day-rotated SD log files with size cap (`/logs/YYYY-MM-DD.log`) | v2.1.0 | Stable | | F-046 | Boot reset-reason capture, routed to alerts (fault) or info (expected) | v2.1.0 | Stable | | F-047 | Per-subsystem MQTT log rate limiting (token bucket + drop summary) | v2.1.0 | Stable | | F-048 | SD log retrieval commands (`logs.list` / `logs.download`) | v2.1.0 | Stable | | F-049 | `firmware.status` rollback safety-net diagnostics (retry/failure counts, backup partition) | v2.1.0 | Stable | | F-050 | SD log lines prefixed with wall-clock date/time + uptime | v2.1.0 | Stable | | F-051 | Fix: TelemetryTask/HealthMonitor stack overflow — stack bump + deferred MQTT/SD logging queue | v2.1.0 | Stable | | F-052 | Consolidated lifetime boot counter + coredump crash detail, published automatically over MQTT | v2.1.0 | Stable | | F-053 | `telemetry.get_boot_history` command + fixed boot-log counter drift + crash detail in SD history | v2.1.0 | Stable | | F-054 | Console Health tab support — `free_heap` on heartbeat + `ping` round-trip timestamp echo | v2.1.0 | Stable | | F-055 | Fix: heap-exhaustion abort() under rapid MQTT command bursts — free-heap guard on publish + command intake | v2.1.0 | Stable | | F-056 | Diagnostics report — CPU temperature, WiFi reconnects, OTA state, stack high-water mark, published automatically every 5 min + on-demand via `telemetry.get_diagnostics` | v2.1.0 | Stable | | F-057 | QA-to-shipping stats reset — `telemetry.reset_boot_data` (lifetime boot count + SD boot log) and `logs.clear` (SD debug logs) | v2.1.0 | Stable | | F-058 | Fix: NTP sync RTC corruption on flaky internet — de-dup guard, retry cooldown, large-jump consensus check | v2.1.0 | Stable | | F-059 | Fix: partition table mismatch blocking safe OTA to pre-restructure field devices | v2.1.0 | Stable | | F-060 | `system.set_identity` — sysadmin override of factory-set device identity (serial/hw_family/hw_revision) | v2.1.0 | Stable | | F-061 | Fix: `LegacyResponseAdapter` — v1 tablets saw device as "unavailable" while playing, due to `system.status` reply schema mismatch | v2.1.1 | Stable (temporary migration scaffolding) | | F-062 | MQTT topic spec v2 — restructured topics (`control/command`/`control/ack`/`control/reports`/`status/playback`/`system/*`), LWT, `req_id` correlation, per-topic ON/OFF switches (`mqtt.set_topics`) | v2.2.0 | Stable | | F-063 | Fix: malformed `control/command` input (bad JSON, missing `cmd`) now gets an `ERROR` reply on `control/ack` instead of being silently dropped | v2.2.1 | Stable | | F-064 | Richer `status/playback` — `pid`, `speed`, `duration`, `started_at`, `source`, `ts` (same fields on the WebSocket playback INFO event); command origin carried on `CommandEnvelope` | v2.3.0 | Stable | --- ## Feature Details --- ### F-001 — Relay-driven melody playback The core function of the device. The Player subsystem reads a sequence of 16-bit bitmasks (one per step) from either a `.bsm` file on SD or the built-in PROGMEM library. Each bit maps to a relay output (bell). Relays fire at a configurable `speed` (ms per step). Key config: `speed` (ms/step), `note_assignments[16]` (relay index per note), `total_duration`, `continuous_loop`. Subsystem: `src/Player/Player.cpp` --- ### F-002 — Built-in melody library (PROGMEM) A set of hardcoded melodies stored in flash (PROGMEM) inside `src/BuiltInMelodies/BuiltInMelodies.hpp`. No SD card required to play these. Looked up by PID string. Lookup: `BuiltInMelodies::findMelodyByPID(pid)` and `BuiltInMelodies::isBuiltInMelody(pid)`. --- ### F-003 — SD-card melody download & storage Melodies not found in the built-in library are downloaded from a URL (Firebase Storage) and stored as `.bsm` files on the SD card. FileManager handles download, write, and lookup. If the melody PID matches a built-in, the download is skipped entirely. Subsystem: `src/FileManager/FileManager.cpp` --- ### F-004 — MQTT transport The device connects to a broker (VPS) and subscribes to `vesper/{deviceUID}/cmd`. Commands arrive as JSON envelopes. Responses are published back. Auth uses dynamic HMAC passwords (see F-011). Subsystem: `src/Communication/Transport/MQTTTransport/` --- ### F-005 — WebSocket transport AsyncWebSocket on `/ws`. Commands arrive as JSON envelopes from browser or Node-RED. `clientId` is the WebSocket client ID for per-client responses. Subsystem: `src/Communication/Transport/WebSocketTransport/` --- ### F-006 — UART/Serial transport Commands can be sent over Serial (USB). Useful for lab/dev work. JSON envelope format, same as other transports. Subsystem: `src/Communication/Transport/UARTTransport/` --- ### F-007 — HTTP / AsyncWebServer transport REST-style HTTP endpoints via AsyncWebServer on port 80. Also hosts the SettingsWebServer (F-017). --- ### F-008 — MQTT heartbeat (retained, 30 s) Every 30 seconds while MQTT is connected, a retained message is published to `vesper/{deviceUID}/status/heartbeat` with uptime, IP, firmware version, and gateway. Clients get the last status immediately on subscribe. See full details: [heartbeat.md](heartbeat.md) Since: firmware v130 --- ### F-009 — SemVer firmware versioning Version defined as `FW_VERSION` string in `src/Version.hpp`. Format `MAJOR.MINOR.PATCH`. Also exposes a `SemVer` struct for programmatic comparison. Changelog embedded in the same file. --- ### F-010 — OTA update (FastAPI backend, safe-mode boot check) On every boot, before starting normal operation, the device queries the backend for a pending OTA. If one exists, it is applied immediately (boot-phase OTA, safe-mode). OTA can also be triggered via MQTT/WebSocket command at runtime. Backend: FastAPI on VPS. Binary served from Firebase Storage. --- ### F-011 — MQTT dynamic auth (HMAC-SHA256 device password) Each device authenticates to the MQTT broker with: - username: `deviceUID` (e.g. `PV000000000000`) - password: `HMAC-SHA256(MQTT_SECRET, deviceUID).hexdigest()[:32]` `MQTT_SECRET` is compiled in via `platformio.ini`. The backend verifies the same derivation. Legacy password `vesper` still accepted but will be removed in Stage 7. --- ### F-012 — HAL variant system (multi-board build flags) PlatformIO build flags (`HAS_RF`, `HAS_RTC`, `HAS_LCD`, etc.) select hardware capabilities at compile time. Code is guarded with `#if HAS_RF` etc. to produce board-specific binaries from a single codebase. Environments: `vesper-v1` (standard), others in progress. --- ### F-013 — RF Remote subsystem (HAS_RF variant) When compiled with `HAS_RF`, the device can receive IR/RF remote control signals and map them to bell actions. --- ### F-014 — NVS device-identity migration Runs once at the very start of `setup()`, before `ConfigManager::begin()`, to upgrade the NVS device-identity keys written by pre-v2 factory firmware. **Key renames (namespace `device_id`):** | Old key | New key | Notes | |---|---|---| | `device_uid` | `serial` | Value carried forward unchanged | | `hw_type` | `hw_family` | Value translated via lookup table (e.g. `"VS"` → `"vesper"`) | | `hw_version` | `hw_revision` | Value carried forward unchanged | **Lookup table** (`hw_type` → `hw_family`) covers all codes ever written by factory firmware: `VS` → `vesper`, `VP` → `vesper_plus`, `VX` → `vesper_pro`, `bell_core` → `vesper`, `bell_plus` → `vesper_plus`, `bell_pro` → `vesper_pro`, `agnus_mini` → `agnus_mini`. Unknown codes are carried forward as-is. **Behaviour:** Each step is idempotent — if the new key already exists the old one is just erased. If none of the old keys are present, the migration exits immediately with no NVS writes. Safe to leave in permanently. Subsystem: `src/NvsMigration/NvsMigration.cpp` --- ### F-015 — Two-tier factory reset (5 s / 10 s button hold) The BOOT button (GPIO 0) supports two hold durations: | Hold | Action | |---|---| | < 5 s, then release | Short press — no action (reserved) | | 5 s (while held) | WiFi credentials wiped immediately | | Release between 5–10 s | Device restarts (WiFi-only reset complete) | | 10 s (while held) | Full factory reset — all settings cleared, then restart | **Why two tiers:** A deployed device that loses WiFi connectivity needs a way to re-provision without losing all its bell configuration and schedule. The 5 s gesture wipes only the WiFi credentials (so WiFiManager will open the captive portal on next boot). The 10 s gesture is a last resort that wipes everything. Subsystem: `src/InputManager/InputManager.cpp` — `MEDIUM_PRESSED` state, `mediumPressMs = 5000`. main.cpp callbacks: `handleWiFiCredsReset()`, `handleWiFiCredsResetRelease()`, `handleFactoryReset()`. --- ### F-016 — WiFi credential fallback chain On WiFi connect attempt, the device tries credentials in order: 1. **Saved credentials** (stored by WiFiManager from previous captive portal session) — `WiFi.begin()` 2. **Hardcoded failsafe** (compiled-in `defaultWifiSsid` / `defaultWifiPsk` from config) — after `MAX_WIFI_FAILURES = 2` on stage 1 3. **Captive portal** (WiFiManager AP, boot-phase only) — after `MAX_WIFI_FAILURES = 2` on stage 2 Post-boot: if all credentials fail, cycle restarts from stage 1 indefinitely (no portal after boot). After portal saves credentials: device **reboots** (not continues) so AsyncWebServer can bind port 80 cleanly. `_triedSavedCredentials` flag tracks which stage is active. Subsystem: `src/Networking/Networking.cpp` --- ### F-017 — SettingsWebServer (captive-portal config UI) A web UI served on port 80 that allows local configuration of the device (network settings, bell config, etc.) without needing MQTT or a mobile app. Instantiated as `settingsWebServer` in `main.cpp`. `begin()` called when network becomes ready. Subsystem: `src/SettingsWebServer/SettingsWebServer.hpp` --- ### F-018 — Built-in melody `builtin_*` UID aliases 24 backward-compatibility PID aliases prefixed with `builtin_` that map to existing melody arrays. Devices shipped with old firmware used these PIDs in their schedules. The alias table ensures those schedules continue to work without SD downloads. Two new PROGMEM arrays added: `builtin_catehetical`, `bulitin_mournfull_toll_alternative`. `isBuiltInMelody(pid)` helper added for O(n) lookup without needing the full `MelodyInfo*`. Subsystem: `src/BuiltInMelodies/BuiltInMelodies.hpp` --- ### F-019 — NTP sync: fetch UTC, apply stored offsets manually Previous behaviour: `configTime(gmtOffset, dstOffset, ntpServer)` let the ESP-IDF SDK apply offsets internally, which caused double-application bugs when the SDK also read stored timezone state. Current behaviour: `configTime(0, 0, ntpServer)` fetches raw UTC. Stored `gmtOffsetSec + daylightOffsetSec` are added manually to the UTC epoch before writing to RTC. Logged as both UTC and local time. Subsystem: `src/TimeKeeper/TimeKeeper.cpp:syncTimeWithNTP()` --- ### F-020 — Command envelope version default changed to v1 When an incoming JSON command does not include a `"v"` field, the envelope version defaults to **1** (was 2). This matches the actual format sent by the mobile app and Node-RED flows, fixing a regression where the v2 default caused the legacy adapter to reject commands from these clients. Affected transports: MQTT, UART, WebSocket. --- ### F-021 — RelayHandler v1/v2 dual-format compatibility `relay.set_durations` and `relay.set_outputs` now accept two payload shapes: - **v2:** `{ "bells": { "b1": ..., "b2": ... } }` — bells nested under a `"bells"` key - **v1:** `{ "b1": ..., "b2": ... }` — bells at the top level of `contents` The handler checks `contents["bells"].is()` and unpacks accordingly. Subsystem: `src/Communication/Handlers/RelayHandler/RelayHandler.cpp` --- ### F-022 — Player speed guard If the incoming playback command contains `"speed": 0` (or omits it and JSON parsing produces 0), the Player now defaults to `300 ms` per step instead of dividing by zero / producing silent playback. Also guards `calculateProjectedRunTime()` against `singleLoopDuration == 0`. Subsystem: `src/Player/Player.cpp:setMelodyAttributes()` --- ### F-024 — V1 playback segment_duration fix (single-segment mode) When `continuous_loop: false` and `segment_duration > 0`, the melody now plays for the full `segment_duration` milliseconds (completing the last loop in progress) before stopping. Previously, sending `total_duration: 0` explicitly caused the player to stop after the very first loop regardless of `segment_duration`. **Root cause:** `setMelodyAttributes` only derived `total_duration` from `segment_duration` when `total_duration` was *absent* from the payload. An explicit `total_duration: 0` bypassed the derivation, leaving the stop timer at zero. `onMelodyLoopCompleted` then hit the "play-once" shortcut and stopped immediately. **Fix:** When `continuous_loop` is false, `total_duration` is now always overwritten with `segment_duration` regardless of what the client sent — it is semantically meaningless in single-segment mode. The play-once fallback in `onMelodyLoopCompleted` is also tightened to only fire when *both* `segment_duration` and `total_duration` are zero (truly no duration configured). Subsystem: `src/Player/Player.cpp:setMelodyAttributes()`, `Player.cpp:onMelodyLoopCompleted()` --- ### F-025 — V2 playback command namespace V2 clients send `playback.play` and `playback.stop` as the `cmd` field (with `"v": 2`), consistent with all other V2 namespaced commands (`relay.set_durations`, `system.restart`, etc.). `PlaybackHandler` now registers these two commands directly. The old root-level `"playback"` command no longer exists in V2. **Legacy (V1) compatibility:** `LegacyAdapter` maps `{ cmd:"playback", action:"play" }` → `"playback.play"` and `{ cmd:"playback", action:"stop" }` → `"playback.stop"`. All deployed V1 clients continue to work without any changes. Subsystem: `src/Communication/Handlers/PlaybackHandler/PlaybackHandler.cpp`, `src/Communication/CommandBus/LegacyAdapter.cpp` --- ### F-026 — V2 playback `mode` field V2 play commands replace the ambiguous `continuous_loop` / `segment_duration` / `total_duration` triplet with a single `mode` string and a `duration` field: | `mode` | Behaviour | Required fields | |---|---|---| | `"single"` | Play exactly one melody loop, then stop | none | | `"timed"` | Loop continuously for `duration` ms, stop at end of a full loop | `duration` | | `"interval"` | Loop for `duration` ms, pause for `pause_duration` ms, repeat until `total_duration` ms elapsed | `duration`, `pause_duration`, `total_duration` | | `"infinite"` | Loop forever until a `stop` command | none | V1 timing fields (`segment_duration`, `continuous_loop`, `total_duration`) are still parsed when `mode` is absent, so the fix from F-024 continues to apply to V1 clients. **Example V2 play command:** ```json { "cmd": "playback.play", "v": 2, "contents": { "pid": "builtin_festive_4voices", "speed": 232, "mode": "timed", "duration": 30000, "note_assignments": [1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0], "url": "..." } } ``` Subsystem: `src/Player/Player.cpp:setMelodyAttributes()` --- ### F-027 — FileManager HTTPS removed — melody downloads over plain HTTP only `FileManager::downloadFile` no longer supports HTTPS URLs. Any URL starting with `https://` is rejected immediately with an error log. **Why:** The ESP32's mbedTLS context requires ~40 KB of contiguous heap for the TLS handshake. After the device has been running for a while, heap fragmentation makes this allocation unreliable, causing intermittent download failures. Melody `.bsm` files contain only note sequences and carry no credentials, so plain HTTP is acceptable for this use case. **What was removed:** `WiFiClientSecure`, the SSL heap guard (`largestBlock < 40000` check), `esp_task_wdt_delete/add` calls around the GET, and all `secureClient` cleanup paths. The `esp_task_wdt` include was also dropped from `FileManager.cpp` and `WiFiClientSecure.h` from `FileManager.hpp`. **Also fixed in this change:** `ensureDirectoryExists` now strips trailing slashes instead of appending one — `SD.exists()` returns false for directories when a trailing slash is present. Melody files must be served via plain HTTP. The Firebase Storage URLs (currently used) must be proxied or replaced with an HTTP endpoint before downloads will work. Subsystem: `src/FileManager/FileManager.cpp`, `src/FileManager/FileManager.hpp` --- ### F-028 — Logging level calibration Establishes sane production defaults for all three log channels and suppresses high-frequency noise on MQTT. **Default channel levels (ConfigManager defaults):** | Channel | Old default | New default | Effective behaviour | |---|---|---|---| | Serial | VERBOSE (5) | INFO (3) | Clean boot log; DEBUG/VERBOSE only when explicitly set | | MQTT | NONE (0) | WARNING (2) | Error and warning events flow to server by default | | SD | NONE (0) | WARNING (2) | Ready for SD log callback when wired up | **Per-subsystem MQTT caps** (set in `CommunicationRouter::begin()`): | Subsystem | MQTT cap | Reason | |---|---|---| | BellEngine | WARNING | Per-note STRIKE/FIRE logs are VERBOSE/DEBUG — would flood MQTT on every bell strike | | OutputManager | WARNING | Per-output AUTO-EXTINGUISH log fires on every note | | HealthMonitor | WARNING | Health-check runs every few seconds; only failures matter remotely | | ConfigManager | WARNING | NVS read trace and isHealthy debug chatter | | MQTTClient | NONE | Prevents feedback loop (MQTT driver logging over MQTT) | | CommRouter | WARNING | Internal dispatch noise | | Logger | NONE | Prevents recursion | | Player | INFO | State transitions (PLAY/STOP/PAUSE) are useful to see remotely | | Telemetry | INFO | Load data useful for fleet monitoring | | OTAManager | INFO | Update events are important to track | **Other fixes in this change:** - Early `Logging::setLevel()` call in `main.cpp` removed — `CommunicationRouter::begin()` applies all three channels at once once the MQTT callback is wired, removing a redundant partial application. - Loop heartbeat downgraded `LOG_DEBUG` → `LOG_VERBOSE` (only visible at VERBOSE level). - HealthMonitor periodic "skipping/performing" polling lines removed entirely. Per-subsystem status lines and completion timing: VERBOSE → DEBUG. - FirmwareValidator boot-path health check lines: VERBOSE → INFO (one-shot boot events worth seeing at INFO). - ConfigManager: all remaining VERBOSE lines → DEBUG. Subsystem: `src/ConfigManager/ConfigManager.hpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/HealthMonitor/HealthMonitor.cpp`, `src/FirmwareValidator/FirmwareValidator.cpp`, `src/main.cpp` --- ### F-023 — Telemetry bell max load default raised to 500 `bellMaxLoad[i]` initialised to `500` (was `200`). This is the denominator used to calculate bell load percentage in telemetry reports. The old value caused false "overload" warnings on normal use patterns. Subsystem: `src/Telemetry/Telemetry.cpp:begin()` --- ### F-029 — Bell mechanism master ON/OFF switch A new `bellsEnabled` boolean in `GeneralConfig` (default `true`) gates all bell firing at the mechanism level. When disabled: - `BellEngine::start()` returns immediately without activating any relay outputs. - `Timekeeper::checkClockAlerts()` returns immediately without firing hour/half/quarter bells. - Manual relay tests (`relay.test_output`) are **not** affected — the guard is at the playback/alert layer, not the hardware layer. Persisted to `settings/generalConfig.json` via `saveGeneralConfig()`. Commands: `bells.enable` / `bells.disable` / `bells.get_config` Subsystems: `src/ConfigManager/ConfigManager.hpp`, `src/BellEngine/BellEngine.cpp`, `src/TimeKeeper/TimeKeeper.cpp`, `src/Communication/Handlers/BellsHandler/` --- ### F-030 — Bell load guard ON/OFF switch `Telemetry::guardEnabled` (default `true`) allows the thermal protection system to be disabled at runtime via command without touching the thresholds. When disabled, load decay still runs for accurate reporting, but `forceStopCallback` is never triggered regardless of load levels. Command: `telemetry.set_guard_enabled` `{ "enabled": true|false }` Not persisted — resets to `true` on reboot (deliberate: guard is a safety feature). Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp` --- ### F-031 — Bell load guard threshold control `telemetry.set_max_loads` allows setting `bellMaxLoad[i]` per-bell or globally via command at runtime. Two forms: - `{ "all": 500 }` — sets all 16 bells to the same threshold. - `{ "loads": { "0": 300, "3": 700 } }` — sets specific bells individually. `telemetry.get_loads` now also returns `max_loads` and `guard_enabled` alongside the existing `loads`, `cooling_active`, `overloaded` fields. Subsystem: `src/Telemetry/Telemetry.cpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp` --- ### F-032 — Device runtime and boot tracking Three types of persistent records written to SD: **Runtime (`/telemetry_runtime.json`):** - `lifetime_seconds`: cumulative powered-on time across all boots. Loaded at boot, flushed every 10 minutes. If the device reboots before 10 minutes, that session's contribution is lost (accepted trade-off to avoid SD wear). **Boot log (`/telemetry_boot_log.json`):** - Rotating array of up to 200 boot entries, each with `ts` (Unix timestamp) and `boot` (sequential boot count). - Written after first NTP sync so the timestamp is real. Offline boots without NTP produce no entry. - Useful for diagnosing crash/reboot loops: a device that rebooted 25 times on one day is instantly visible. Runtime flush is done inside `TelemetryTask` on a 10-minute timer (`RUNTIME_FLUSH_INTERVAL_MS`). Boot log is written from `ntpSyncTask` in `main.cpp`. Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`, `src/main.cpp` --- ### F-033 — Total playback counter `Telemetry::totalPlaybackCount` (uint32_t) increments on every call to `Player::play()`. Persisted in `telemetry_runtime.json` alongside lifetime runtime. Readable via `telemetry.get_metrics` and `system.get_telemetry`. Resettable via `telemetry.reset_metrics` (also resets lifetime runtime). Subsystem: `src/Telemetry/Telemetry.cpp`, `src/Player/Player.cpp` --- ### F-034 — Telemetry aggregate commands New commands added to `TelemetryHandler`: | Command | Description | |---|---| | `telemetry.get_metrics` | Returns `lifetime_runtime_seconds`, `session_runtime_seconds`, `total_playbacks`, `guard_enabled`, `lifetime_boot_count` (F-052) | | `telemetry.reset_metrics` | Resets lifetime runtime and playback count to zero (persisted) | Subsystem: `src/Communication/Handlers/TelemetryHandler/` --- ### F-035 — System aggregate commands `system.get_settings` renamed to `system.get_config` (old name still accepted as backward-compat alias). Two new aggregate commands: | Command | Returns | |---|---| | `system.get_config` | All user-configurable settings (full config dump) + `general` block with `bells_enabled`, `mqtt_enabled`, `ota_channel`, log levels | | `system.get_telemetry` | Strike counters, loads, max_loads, cooling, guard, runtime metrics, uptime, free heap — all in one call | | `system.get_all` | Everything: device identity + full config + telemetry snapshot + player status | Reduces initialization round-trips from 8+ commands to 1. Subsystem: `src/Communication/Handlers/SystemHandler/SystemHandler.cpp` --- ### F-036 — Per-subsystem config getters Three new getter commands that were previously write-only: | Command | Returns | |---|---| | `log.get_config` | `serial_level`, `sd_level`, `mqtt_level` | | `mqtt.get_config` | `enabled`, `host`, `port`, `user`, `use_ssl` | | `bells.get_config` | `bells_enabled`, `durations[16]`, `outputs[16]` | Subsystem: `src/Communication/Handlers/LoggingHandler/`, `src/Communication/Handlers/MQTTHandler/`, `src/Communication/Handlers/BellsHandler/` --- ### F-037 — Network status extended `network.status` now returns three additional fields alongside the existing `connected`, `ip`, `ap_mode`, `rssi`, `state`, `type`: - `ssid`: currently connected WiFi network name (`WiFi.SSID()`) - `mac`: device MAC address (`WiFi.macAddress()`) - `hostname`: device hostname from `NetworkConfig` Subsystem: `src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp` --- ### F-038 — Bell test fire commands (`relay.test_bell` / `relay.test_batch`) Two non-blocking test commands for firing bells on demand, bypassing the `bellsEnabled` guard (manual tests always work regardless of the master switch): | Command | Behaviour | |---|---| | `relay.test_bell` | Fire bell channel N using its configured output and duration. Non-blocking — OutputManager timer handles the shutoff. Can be sent in rapid succession like piano keys. | | `relay.test_batch` | Fire a list of bell channels simultaneously (like a single melody step). Each bell fires for its own configured duration. | Both commands read output and duration from `ConfigManager` (same values as real playback). Returns the resolved output and duration so the caller can confirm what was fired. Subsystem: `src/Communication/Handlers/RelayHandler/RelayHandler.cpp` --- ### F-039 — Clock output test fire commands (`clock.test_c1` / `clock.test_c2`) Two test commands for verifying clock relay wiring without waiting for the next scheduled clock strike: | Command | Behaviour | |---|---| | `clock.test_c1` | Fire the C1 (ODD) clock output immediately for `pulse_duration` ms | | `clock.test_c2` | Fire the C2 (EVEN) clock output immediately for `pulse_duration` ms | Both use `OutputManager::fireClockOutput()` which resolves the physical pin from `ClockConfig`. Returns the output name and actual duration used. `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` --- ### F-043 — `network.info` expanded `network.info` now returns the full set of fields needed by the console network panel: | Field | Source | |---|---| | `ip` | `WiFi.localIP()` | | `subnet` | `WiFi.subnetMask()` | | `gateway` | `WiFi.gatewayIP()` | | `dns` | `WiFi.dnsIP()` | | `mac` | `WiFi.macAddress()` | | `hostname` | `NetworkConfig.hostname` | | `ssid` | `WiFi.SSID()` | | `connection_type` | `"WIFI"` / `"ETHERNET"` / `"AP"` | Previously only returned `ip`, `gateway`, `dns`. Fields `mac`, `hostname`, `ssid` were spread across `network.status`. Subsystem: `src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp` --- ### F-044 — `network.status` slimmed to pure runtime state `network.status` now returns only live/volatile data useful for health monitoring and polling: | Field | Notes | |---|---| | `connected` | bool | | `ap_mode` | bool | | `rssi` | dBm, live WiFi signal strength | | `uptime_ms` | `millis()` — time since last boot | | `state` | Connection state machine: `DISCONNECTED` / `CONNECTING` / `CONNECTED_WIFI` / `CONNECTED_ETHERNET` / `RECONNECTING` / `AP_MODE` | Removed from `network.status`: `ip`, `mac`, `hostname`, `ssid`, `type` — these are static addressing facts, now served by `network.info`. Subsystem: `src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp` --- ### F-045 — Day-rotated SD log files with size cap Fixes a bug where SD logging was a silent no-op: `FileManager::appendLine` never created the `/logs` directory before opening the file in append mode, which fails on most SD/FAT implementations when the parent directory doesn't exist. New `FileManager::appendLogLine(logDir, line, timestamp, maxTotalBytes)` replaces the direct `appendLine` call as the SD log channel's write path: - Ensures `logDir` exists before every write. - Names the file `YYYY-MM-DD.log` from the supplied timestamp (`time(nullptr)`, works with or without an RTC once NTP has synced). Falls back to `unset-date.log` if no wall clock is available yet, rather than dropping early-boot lines. - Every 50 writes (not every write), sums directory size and prunes oldest whole files once over a 512KB total budget (`SD_LOG_MAX_TOTAL_BYTES` in `CommunicationRouter.cpp`). **Fixed after initial testing:** the first version pruned on every write, which does a full `SD.open()` directory scan + `std::vector` build on the calling task's own stack. The first device test (SD log level set to INFO) hit this from `MQTTDriver`'s 3KB-stack connect task and panicked with a stack canary trigger, causing a reboot loop. Fixed by throttling the prune check to once per 50 writes and bumping the three MQTT driver task stacks (connect/reconnect/heartbeat) from 3072 to 4096 bytes. Subsystems: `src/FileManager/FileManager.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp` --- ### F-046 — Boot reset-reason capture `Telemetry::begin()` now reads `esp_reset_reason()` at the very start of boot, before anything else can crash again this cycle. Classified into fault (`ESP_RST_PANIC`, `ESP_RST_INT_WDT`, `ESP_RST_TASK_WDT`, `ESP_RST_WDT`, `ESP_RST_BROWNOUT`) vs expected (power-on, software reset/OTA, deep sleep wake, etc). - Persisted in the SD boot log (`/telemetry_boot_log.json`, field `reason`) regardless of connectivity — works for offline devices. - For online devices, `CommunicationRouter::reportBootReasonOnce()` fires the first time MQTT connects after boot (registered via `MQTTDriver::setOnConnectCallback`): fault reasons publish to `vesper/{uid}/status/alerts`, expected reasons publish to `vesper/{uid}/status/info` (event type `boot_reason`). Fires once per boot, not on every reconnect. Subsystems: `src/Telemetry/Telemetry.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp` --- ### F-047 — Per-subsystem MQTT log rate limiting Token bucket per subsystem tag on the MQTT log channel (burst of 10, refills 1/second) inside `Logging::publishToMqtt()`. Protects the broker/airtime from a chatty or misconfigured subsystem (e.g. a per-subsystem override left at VERBOSE via `log.set_mqtt`). Drops are counted, not silently discarded: the next time a rate-limited tag is allowed to publish again, a `WARNING` summary line (`"suppressed N log message(s) (MQTT rate limit)"`) is emitted first. Serial and SD channels are unaffected — MQTT only. Subsystem: `src/Logging/Logging.cpp` --- ### F-048 — SD log retrieval commands (`logs.list` / `logs.download`) Two new commands on `LoggingHandler` for pulling day-rotated SD logs off a device remotely (offline-device troubleshooting workflow: app queries device directly, or backend requests once the device is back online). | Command | Description | |---|---| | `logs.list` | Lists dated log files under `/logs` with name + size. | | `logs.download` | Returns a bounded chunk (`{file, offset}` → `{data, next_offset, eof}`) of a log file. Callers loop, feeding `next_offset` back as `offset`, until `eof` is true. Rejects path traversal in `file`. | Chunked rather than whole-file because `CommandResult` JSON payloads need to stay small regardless of file size (a rotated file can be up to the full SD log budget). Both commands return an error (not a crash) on boards without an SD card — `LoggingHandler` now takes an optional `FileManager*`. Subsystems: `src/Communication/Handlers/LoggingHandler/LoggingHandler.cpp`, `src/FileManager/FileManager.cpp` --- ### F-049 — `firmware.status` rollback safety-net diagnostics `FirmwareValidator` tracked startup retry count, runtime failure count, and backup partition info internally (NVS-persisted) but never exposed them remotely — only visible via `LOG_*` output. Added public getters (`getStartupRetryCount()`, `getRuntimeFailureCount()`) and extended `firmware.status` with `startup_retry_count`, `max_startup_retries`, `runtime_failure_count`, `max_runtime_failures`, `backup_version`, `backup_is_valid`. Subsystems: `src/FirmwareValidator/FirmwareValidator.hpp`, `src/Communication/Handlers/FirmwareHandler/FirmwareHandler.cpp` --- ### F-050 — SD log lines prefixed with wall-clock date/time + uptime The SD log line format previously carried only `millis()` — useless for reading a log file after the fact without knowing when boot happened. Lines are now prefixed with real date/time plus uptime: ``` 2026-07-15 | 12:28:04 | 13460843 -> 🔵 [DEBG][OutputManager] message ``` Date/time comes from `time(nullptr)`, set by NTP via `Timekeeper::syncTimeWithNTP()` — works regardless of `HAS_RTC`, since NTP sync sets the ESP32 system clock independently of any RTC peripheral. Prints `unset-date | unset-time` instead of a bogus 1970 epoch date if NTP hasn't synced yet (matches the day-rotation file's `unset-date.log` fallback from F-045). The level icon (🔴🟡🟢🔵⚪) — previously Serial-only — is now also written to SD for faster visual scanning. Serial and MQTT lines are unchanged (Serial already had the icon; MQTT already carries a `timestamp` field, albeit `millis()`-only). --- ### F-051 — Fix: TelemetryTask/HealthMonitor stack overflow on SD+MQTT-nested logging Device rebooted every ~10 minutes with `Guru Meditation Error: ... Stack canary watchpoint triggered (TelemetryTask)`. **Root cause:** `Telemetry::flushRuntimeToSD()` runs on `TelemetryTask` (4096-byte stack) every `RUNTIME_FLUSH_INTERVAL_MS`. Its call chain nests several stack-hungry operations on top of each other: `FileManager::writeJsonFile()` (SD.open + ArduinoJson `serializeJson`) → `LOG_DEBUG` on success → `Logging::log()` (allocates a 512-byte `char buffer[512]` for `vsnprintf`) → `Logging::publishToMqtt()` (builds a `String` reserved at 600 bytes) → `AsyncMqttClient::publish()`. Combined, this exceeded the 4096-byte budget and corrupted the stack canary. **Fix applied:** Bumped `TelemetryTask` to 8192 bytes ([Telemetry.cpp](../../src/Telemetry/Telemetry.cpp)) and `HealthMonitor`'s monitoring task to 6144 bytes ([HealthMonitor.cpp](../../src/HealthMonitor/HealthMonitor.cpp)) — `HealthMonitor::performFullHealthCheck()` logs once per subsystem (11 `LOG_*` calls per pass) through the same nested nesting pattern and was judged the next most likely to trip. Verified via `pio run` — RAM usage after the bump is 19.2% (63KB/320KB), so the +6KB combined stack cost is not a concern. **Broader risk identified at the time:** `OutputManager` (`OutputDuration`, 4096B), `TimeKeeper` (`TimeKeeper`, 4096B), `MQTTDriver`'s `mqttRecon`/`mqttHB`/`mqttConnect` (4096B each), and `Networking`'s `netRecon` (3072B, the tightest of all) all called `LOG_*` directly on small task stacks, sharing the same structural fragility: any `LOG_*` call that fanned out to MQTT or SD added `Logging::log()`'s 512-byte buffer plus `publishToMqtt()`'s 600-byte `String` and a synchronous `AsyncMqttClient::publish()`/SD-write call onto whatever stack the calling task happened to have. This is fixed at the root by the logging redesign below — those tasks no longer pay that cost regardless of their own stack size. **Proper fix — deferred MQTT/SD logging via a dedicated queue + task:** The root architectural problem was that `Logging::log()` did all formatting *and* all I/O (Serial/MQTT/SD) synchronously, on whatever task called `LOG_*`. A task with other stack-heavy work nested (JSON serialization, SD I/O) had no way to know it was borrowing stack for the logger too. Implemented in `src/Logging/Logging.hpp` / `Logging.cpp`: 1. A dedicated `LoggingTask` (4096B stack, Core 0, priority 1), lazily created on the first log call that needs MQTT or SD output — `ensureLoggingTaskStarted()` is guarded by a spinlock (`_logQueueInitSpinlock`) so concurrent first-callers can't race and create two queues/tasks. 2. `Logging::log()` still does `vsnprintf` into its local 512-byte buffer (cheap, fixed-size, stays on the caller's stack — unchanged). If the message is MQTT- or SD-enabled for that tag, it's copied into a fixed-size `LogQueueItem` (`tag[24]`, `levelStr[6]`, `message[256]`, plus the `LogLevel` enum and `toMqtt`/`toSd` flags) and sent via `xQueueSend(..., 0)` — non-blocking, so a full queue (depth 16) drops the line rather than stalling the caller. 3. `LoggingTask` drains the queue and calls the existing `publishToMqtt()` / `writeToSd()` unchanged — those functions, and the expensive/variable-depth `AsyncMqttClient::publish()` and SD file write calls inside them, now only ever nest on the logging task's own stack, never on the caller's. 4. Serial output stays synchronous in `Logging::log()` — cheap, and keeps the USB serial monitor showing the true, immediate order of events (important when debugging a crash, as opposed to a queue-drained/reordered view). **Message length cap:** queued MQTT/SD messages are capped at 256 bytes (vs. 512 for the Serial/vsnprintf buffer). Audited via grep across all `LOG_*` call sites in the codebase — the longest literal format strings are ~110 characters; with realistic `%s`/`%d` substitutions (hostnames, paths, `ArduinoJson::DeserializationError::c_str()`, which is always a short fixed string like `"InvalidInput"`), worst-case realistic messages land around 150–180 characters. 256 bytes leaves comfortable margin with no observed truncation risk. **What this does NOT fix:** stack pressure from non-logging causes. `FileManager::writeJsonFile()`'s own ArduinoJson serialization and SD I/O still run synchronously on whatever task calls it — only the logging fan-out (the part that made TelemetryTask's overflow possible in the first place) was moved off the caller's stack. RAM impact verified negligible via `pio run` (62980 vs. 62956 bytes static RAM; the 4096B task stack is allocated at runtime only if MQTT or SD logging is actually enabled). Subsystem: `src/Logging/Logging.hpp`, `src/Logging/Logging.cpp` --- ### F-052 — Consolidated lifetime boot counter + coredump crash detail, published automatically over MQTT **Motivation:** Investigating the F-051 crash surfaced a gap — the console only ever saw `"Device reset due to fault: PANIC"`, a coarse `esp_reset_reason()` string, with none of the detail the serial monitor showed (faulting task name, program counter, register dump). Separately, there was no automatic per-boot report a console could use to count reboots ("did this device restart 50 times today?") without polling — the two existing boot counters (`FirmwareValidator`'s NVS `boot_count` and `Telemetry`'s SD-based `total_boots`) were both unsuited to that job for different reasons (see table below). **Three boot/crash mechanisms now coexist, deliberately kept separate:** | Mechanism | Storage | Scope | Survives SD failure? | |---|---|---|---| | `Telemetry::getLifetimeBootCount()` — **new, this feature** | NVS, namespace `vesper_boot` | Whole device lifetime | Yes | | `FirmwareValidator::getBootCount()` — pre-existing, unchanged | NVS, namespace `fw_validator` | Boots since this firmware image was flashed (rollback-safety bookkeeping) | Yes | | `Telemetry::logBootEvent()` → SD `/telemetry_boot_log.json` — pre-existing, unchanged | SD card, rotating array (200 entries) | Timestamped history of recent boots | No — silently empty without SD or before NTP sync | `FirmwareValidator`'s counter was deliberately left untouched rather than repurposed — it's load-bearing for startup/runtime validation retry logic and scoped to "since this OTA slot was flashed," not the device's lifetime. The SD-based log is repositioned as a *history* (useful for browsing recent boots with timestamps), not a counter — its `total_boots` field was never reliable as one (no-SD `agnus` variants get nothing from it, and it's silently skipped before NTP sync). **Coredump-based crash detail (`Telemetry::captureCrashReport()`):** ESP-IDF's panic handler already writes a coredump to flash on every crash — this project's stock `min_spiffs.csv` partition table already reserves a 64KB `coredump` partition, and the precompiled Arduino-ESP32 core already has `CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH` enabled. Neither needed to change. `captureCrashReport()` calls the official, documented "user mode" retrieval API (`esp_core_dump_image_check()` + `esp_core_dump_get_summary()`) once at `begin()` — no custom panic hook, nothing runs inside the panic handler itself, so there's no risk to the crash path. If a coredump is present, it extracts the faulting task name, program counter, Xtensa exception cause, and faulting virtual address into a `CrashReport` struct, then erases the coredump from flash (`esp_core_dump_image_erase()`) so it's reported exactly once, not re-sent on every subsequent boot. A custom RTC-noinit-memory panic hook was considered and rejected — the coredump API already gives strictly more detail (task name + PC + backtrace vs. just a reason string) with less risk (no code runs during the crash itself), for free, since the partition and SDK support already existed. **MQTT reporting (`CommunicationRouter::reportBootOnce()`, renamed from `reportBootReasonOnce()`):** fires once per boot, on first MQTT connect. Fault resets still additionally publish the existing `status/alerts` WARNING (unchanged trigger/topic). A new consolidated `boot_report` event is **always** published to `vesper/{uid}/status/info`, fault or not: ```json { "type": "boot_report", "boot_count": 47, "reset_reason": "PANIC", "is_fault": true, "free_heap": 187234, "crash": { "task": "TelemetryTask", "pc": 1074111832, "exc_cause": 1, "exc_vaddr": 0 } } ``` The `crash` object is present only when `CrashReport::available` is true (a coredump was actually found — e.g. absent on a brownout reset, which doesn't produce one). **On-demand access:** `lifetime_boot_count` was also added to `telemetry.get_metrics`, `system.get_telemetry`, and `system.get_all` responses, so a console can poll the same counter without waiting for the next reboot. Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp`, `src/Communication/Handlers/SystemHandler/SystemHandler.cpp` --- ### F-053 — `telemetry.get_boot_history` command + fixed boot-log counter drift + crash detail in SD history **Context — direct follow-up to F-052.** F-052 added an NVS-backed lifetime boot counter and coredump crash capture, reported automatically over MQTT. That work surfaced that the pre-existing SD-based boot history (`Telemetry::logBootEvent()` → `/telemetry_boot_log.json`, written once per boot from `ntpSyncTask` in `main.cpp`) had two problems worth fixing rather than leaving alone: 1. **It was write-only.** Nothing in the firmware ever read `/telemetry_boot_log.json` back — not the firmware itself, not any command handler, not `logs.list`/`logs.download` (which only serve the unrelated day-rotated plain-text `/logs/YYYY-MM-DD.log` files). 200 entries of real boot history were accumulating on every SD-equipped device with no way for a console to ever retrieve them. 2. **Its `"boot"` counter had silently drifted from the new authoritative one.** The file kept its own local tally (`total_boots` in the JSON, incremented only inside `logBootEvent()`) instead of using F-052's new `Telemetry::getLifetimeBootCount()`. Because `logBootEvent()` only runs after a successful NTP sync for that boot (see the NTP-gated gotcha below), a device with intermittent connectivity would have this file's counter fall behind the NVS counter's true value — two numbers that look like they should agree, quietly telling different stories. **Fix 1 — `logBootEvent()` now uses `lifetimeBootCount` directly** ([Telemetry.cpp](../../src/Telemetry/Telemetry.cpp)) instead of computing its own `doc["total_boots"] + 1`. Every entry's `"boot"` field is now guaranteed consistent with the same counter reported via MQTT `boot_report` and `telemetry.get_metrics`/`system.get_telemetry`/`system.get_all`. The old top-level `"total_boots"` key is no longer written; files from older firmware may still have it lying around — current firmware ignores it, consumers can ignore or discard it. **Fix 2 — crash detail is now included in each SD history entry** when available, using the same `CrashReport` populated by F-052's `captureCrashReport()`: ```json { "ts": 1752600000, "boot": 47, "reason": "PANIC", "crash": { "task": "TelemetryTask", "pc": 1074111832, "exc_cause": 1, "exc_vaddr": 0 } } ``` Same shape as the MQTT `boot_report`'s `crash` object (see F-052) — present only when a coredump was found for that specific boot. **Fix 3 — new command, `telemetry.get_boot_history`** ([TelemetryHandler.cpp](../../src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp)), backed by a new `Telemetry::getBootHistory(JsonDocument&, uint16_t maxEntries)` ([Telemetry.hpp](../../src/Telemetry/Telemetry.hpp)) that reads the file and returns up to N most recent entries. Request takes an optional `{ "limit": N }` (clamped to `[1, 200]`, defaults to all 200). Response: `{ "count": , "boots": [ ...entries, oldest of the selection first... ] }`. Returns a `CommandResult::err` — not a crash or empty success — when there's no SD card, no FileManager, or the file has never been written (expected on `agnus` no-SD variants, or any device that hasn't completed its first NTP sync yet). See [Telemetry's README](../../src/Telemetry/README.md#boot-tracking) for the full request/response contract, including the NTP-gating gotcha (a boot that never reaches NTP sync produces **no entry at all**, not a zeroed one — so this file's entry count can run behind `lifetime_boot_count` on flaky-network devices; that's expected, not a bug). **Three boot mechanisms remain deliberately separate** (see F-052's table, now joined by this file's corrected role): | Mechanism | Now used for | |---|---| | `Telemetry::getLifetimeBootCount()` (NVS) | The authoritative "how many times, ever" — MQTT `boot_report`, `telemetry.get_metrics`, `system.get_telemetry`, `system.get_all`. | | `FirmwareValidator::getBootCount()` (NVS, separate namespace) | Unchanged — rollback-safety bookkeeping only, scoped to boots since this OTA slot was flashed. Exposed via `firmware.status`. | | `Telemetry::logBootEvent()` / `getBootHistory()` (SD) | Timestamped, per-boot history with reason + crash detail — retrievable via `telemetry.get_boot_history`. Its `"boot"` field now just mirrors the NVS counter; it is not an independent count. | Verified: `pio run` on both `vesper-std-v1` and `agnus-v1` (no-SD variant, where `getBootHistory()` correctly returns `false`/the command returns its error response). Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.hpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp` --- ### F-054 — Console Health tab support: `free_heap` on heartbeat + `ping` round-trip timestamp echo Requested by the console-side agent building a device Health tab (RSSI, ping latency, free heap, and restart-timeline graphs). Two small, additive, backward-compatible changes — no existing field renamed or removed. **1. `free_heap` added to the 30s MQTT heartbeat.** [MQTTDriver.cpp](../../src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp)'s `publishHeartbeat()` now includes `payload["free_heap"] = ESP.getFreeHeap()` alongside the existing `rssi` sample. Before this, free heap was only visible once per boot (via F-052's `boot_report`) — a single data point per device lifetime segment, not a trend. Every device already publishes RSSI on this same 30s cadence; heap costs nothing extra to piggyback on the same message. Heartbeat payload is now: `device_id`, `firmware_version`, `timestamp`, `ip_address`, `gateway`, `uptime_ms`, `rssi`, `free_heap`. **2. `ping` now echoes a caller-supplied timestamp for round-trip latency measurement.** [SystemHandler.cpp](../../src/Communication/Handlers/SystemHandler/SystemHandler.cpp)'s `handlePing()` previously built a `doc` and never used it — `ping` was a pure ack (`{"status":"SUCCESS","type":"pong"}`), no timing data. Now: Request (contents optional): ```json { "v": 2, "cmd": "ping", "contents": { "ts": 1752600000123 } } ``` Response: ```json { "status": "SUCCESS", "type": "pong", "data": { "ts": 1752600000123, "device_uptime_ms": 184213 } } ``` - `ts` — caller's own epoch-millis timestamp at send time, echoed back **unchanged**. The device does not attempt to measure round-trip time itself — it has no reliable epoch clock without NTP, and the caller (backend) is already positioned to timestamp its own send and receipt. The device's only job is to echo promptly. Backend computes RTT as `(time of response receipt) − ts`. - `ts` is optional on the request — if omitted, the response simply omits `ts` too. Fully backward compatible with any existing caller that just wants a liveness ack, exactly like before this change. - `device_uptime_ms` (`millis()`) is included as a bonus — cheap, already-available, potentially useful for correlating a ping sample with a reboot — but is not required for RTT math. - **Scope note:** `SystemHandler.cpp` (and therefore `ping`) is entirely wrapped in `#if HAS_RTC` — this command only exists on RTC-equipped board variants (`vesper-std`, not `agnus`/`agnus-mini`). This was a pre-existing constraint, left untouched by this change; non-RTC devices don't support ping-based latency until/unless that scoping is revisited separately. Verified: `pio run` on `vesper-std-v1` (has `ping`) and `agnus-v1` (compiles clean with `SystemHandler.cpp` excluded via `#if HAS_RTC`, confirming the scoping wasn't disturbed). Subsystem: `src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp`, `src/Communication/Handlers/SystemHandler/SystemHandler.cpp` --- ### F-055 — Fix: heap-exhaustion `abort()` under rapid MQTT command bursts **Incident.** After the F-051 stack-overflow fix held for a 4-hour idle test, the device crashed again when spammed with `relay.test_bell` MQTT commands for ~20 seconds with Serial/SD logging at Verbose and MQTT logging at Debug. F-052's coredump capture correctly reported the crash as: faulting task `async_tcp`, PC `0x40083ed5`, exception cause `29` (`EXCCAUSE_STORE_PROHIBITED`), faulting address `0x0`. **Diagnosis method (reusable for future crashes).** The coredump summary's PC and backtrace are addresses into the exact firmware binary that was running — decode them with the toolchain's `addr2line` against the matching build's `.elf` (not `.bin` — the `.elf` retains debug symbols): ``` xtensa-esp32-elf-addr2line.exe -pfiaC -e .pio/build/vesper-std-v1/firmware.elf 0x40083ed5 ``` (`xtensa-esp32-elf-addr2line.exe` ships with PlatformIO's toolchain package, e.g. `~/.platformio/packages/toolchain-xtensa-esp32/bin/`.) This requires the `.elf` to be the *exact* build that was flashed — check `git status` is clean and the checked-out commit matches what was flashed before trusting the decode. The full serial backtrace (not just the top `abort()` frame) is needed — decode every address in the `Backtrace:` line, since the top frames are almost always inside `abort()`/`std::terminate()` internals, not the original call site. **What the decode revealed:** the real call chain was `_async_service_task` (AsyncTCP's own task — this is the `async_tcp` the console reported) → `AsyncClient::_recv` → `AsyncMqttClient::_onData` → `MQTTTransport::onMessage()` → `CommandBus::dispatch()` → the reply path → `MQTTDriver::publish()` → `AsyncMqttClient::publish()` → `AsyncMqttClientInternals::PublishOutPacket`'s constructor → `std::vector::reserve()` → `operator new` → **allocation failed** → unhandled C++ exception → `std::terminate()` → `abort()`. **Important correction to the console's crash-detail semantics (relevant to F-052's `boot_report.crash` fields and `telemetry.get_boot_history`'s per-entry `crash` object):** for a crash reached via an unhandled C++ exception (as opposed to a direct hardware fault like F-051's stack-canary trip), the coredump's `pc`/`exc_cause`/`exc_vaddr` describe the state at the point `abort()`'s internal `panic_abort()` ran — i.e. the *abort mechanics* — not the original fault site. Cause 29 / vaddr 0 here does not mean "null pointer dereference at address 0"; it's an artifact of how this SDK's `std::terminate()` path reaches `abort()`. **The `task` field remains accurate and is the most actionable piece** — it correctly named `async_tcp`, which is what led straight to the real cause. Console/dashboard builders should treat `pc`/`exc_cause`/`exc_vaddr` as "useful forensic detail, decode with `addr2line` for confirmation" rather than literal ground truth when the reset reason is a plain `PANIC` from an `abort()` call (vs. a true Xtensa hardware exception). **Root cause:** heap fragmentation, not a single bad allocation. Every incoming MQTT command allocates a `JsonDocument` (ArduinoJson v7's `JsonDocument` always heap-allocates via `DefaultAllocator` — this codebase has no fixed-capacity `StaticJsonDocument` on this path), and every reply/log line allocates its own `JsonDocument`/`String`/`AsyncMqttClientInternals::PublishOutPacket` vector — all on `_async_service_task`, back-to-back, with logging at Verbose/Debug multiplying the allocation count per command roughly 4-5x (RX log, dispatch log, handler log, reply publish, plus each of those again on the `/logs` MQTT channel via F-051's `LoggingTask` queue). Sustained rapid-fire commands don't give the allocator time to coalesce freed blocks between cycles. The log immediately before the crash showed `Free heap: 63864 bytes` but `Largest block: 40948` — measurable fragmentation already present before the fatal allocation. Two `"JSON parse error: NoMemory"` warnings (ArduinoJson failing to allocate for *incoming* command deserialization) appeared seconds before the abort — an early symptom of the same fragmentation, not the crash itself. **Why this can't be made a catchable exception:** checked this SDK build's `sdkconfig` — `CONFIG_COMPILER_CXX_EXCEPTIONS=y` (exceptions are enabled) but `CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0`. When the heap is too fragmented to allocate even the small object needed to *throw* `std::bad_alloc`, ESP-IDF's C++ runtime normally falls back to a small reserved "emergency pool" to make the throw possible — with that pool sized 0, there's nothing to fall back to, so it aborts instead. This value is baked into the precompiled Arduino-ESP32 framework binary PlatformIO uses; changing it requires rebuilding the entire ESP-IDF core from source with a custom `sdkconfig` (hours of toolchain setup), which was judged out of scope for this fix. **Prevention was chosen over a catchable-exception fix.** **Fix applied — free-heap guard before allocation-heavy MQTT work:** - `MQTTDriver::hasHeapForPublish()` (public, so `MQTTTransport` can reuse the same threshold) checks `ESP.getFreeHeap() >= MIN_FREE_HEAP_FOR_PUBLISH` (20480 bytes / 20KB — chosen with real margin above the ~62KB-free-but-already-fragmented state observed at crash time). On failure it logs via `Serial.printf()` directly, **not** `LOG_*` — an MQTT-channel log call here would itself attempt a publish, recursing straight back into the low-heap condition being guarded against (same reasoning as the pre-existing "don't log here" comment on the disconnected-check in the same function). - Applied at three call sites: `MQTTDriver::publish()`, `MQTTDriver::publishDirect()` (both wrap the same underlying `AsyncMqttClient::publish()` that failed in this incident), and `MQTTDriver::publishHeartbeat()` (checked *before* building its `JsonDocument`, not just before the final publish, since that construction is itself part of the churn). - `MQTTTransport::onMessage()` also checks `_mqtt.hasHeapForPublish()` **first thing**, before even constructing the incoming `JsonDocument doc` for deserialization — under critical heap pressure, incoming commands are dropped silently rather than attempting to process them and risk being the allocation that finally fails. A dropped command under this condition means the caller gets no reply (indistinguishable from a lost network message) — no error response is sent, since building one would itself risk the same allocation failure. **What this does NOT fix:** the underlying churn (every command still allocates a `JsonDocument`, `String`s, and does 4-5 heap alloc/free cycles under verbose logging) is unchanged — the guard prevents the crash by refusing to attempt risky work below the threshold, it doesn't reduce how much allocation happens above it. A **command-processing queue** (mirroring F-051's logging-queue redesign — move `MQTTTransport::onMessage()`'s deserialize/dispatch/reply work off `_async_service_task` onto a dedicated task with its own stack, so AsyncTCP's task only ever does a fast, non-allocating handoff) was considered but scoped out as a separate, larger follow-up rather than rushed into this fix. Documented here so it isn't lost as a vague TODO — same rationale as F-051's own deferred-queue redesign. Verified: `pio run` on both `vesper-std-v1` and `agnus-v1`. Subsystem: `src/Communication/Drivers/MQTTDriver/MQTTDriver.hpp`, `src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp`, `src/Communication/Transport/MQTTTransport/MQTTTransport.cpp` --- ### F-056 — Diagnostics report: CPU temperature, WiFi reconnects, OTA state, stack high-water mark Second console-requested addition to the Health tab (after F-054's `free_heap`/`ping` work). The console wanted four more metrics — CPU temperature, WiFi reconnect count, firmware/OTA state, and per-task stack headroom — but none of them belonged on the 30s heartbeat: the heartbeat fires forever, per device, at fleet scale, and none of these four need 30-second freshness. Instead, this adds a new low-frequency **diagnostics report**, published every 5 minutes to `status/info` (same transport pattern as F-052's `boot_report`) and additionally queryable on-demand via a new `telemetry.get_diagnostics` command. **Local sampling vs. batch send — why they differ per metric.** The console's initial ask was "read everything every 5 minutes." That's fine for three of the four metrics but wrong for temperature: | Metric | Behaviour between reports | Sampling strategy | |---|---|---| | CPU temperature | Fluctuates continuously — a thermal spike can be short-lived (e.g. a burst of relay activity) and gone by the time a slow report fires | Sampled locally every 15s ([`Telemetry::sampleDiagnosticsIfDue()`](../../src/Telemetry/Telemetry.cpp), called from `TelemetryTask`'s existing 1s loop), reduced to a `RunningStats` min/max/avg accumulator (O(1) per sample, no per-sample storage), reset after each 5-minute report | | WiFi reconnects | Monotonic counter — only ever increases | Single read at report time. No information is lost by infrequent reads; the counter already remembers every increment | | Stack high-water mark | `uxTaskGetStackHighWaterMark()` is itself a running low-water-mark maintained by FreeRTOS since the task started — it only ever goes down | Single read at report time — reading more often cannot reveal a lower value than the task's own internal tracking already has | | OTA state | Changes only around an actual update attempt (rare) | Single read at report time | Only temperature needed the local-sampling treatment; over-engineering a sampling buffer for three values that are already monotonic/self-tracking would have added complexity with no benefit. **1. CPU temperature.** [Telemetry.hpp](../../src/Telemetry/Telemetry.hpp)/[.cpp](../../src/Telemetry/Telemetry.cpp) add a `RunningStats` accumulator (`sum`/`min`/`max`/`count`, `addSample()`/`average()`/`reset()`) and `sampleDiagnosticsIfDue()`, which reads `temperatureRead()` (ESP32 Arduino core's built-in die-temperature sensor) every `DIAGNOSTICS_SAMPLE_INTERVAL_MS` (15s) and folds it into the accumulator. **Caveat carried into the wire format's docs:** the ESP32's internal sensor reads die temperature, not ambient, and is not a calibrated instrument — useful as a coarse "is this thing running hot" trend, not a precise reading. `logTemperature(float)` (the pre-existing stub noted in Telemetry's own README as "no persistent storage or analysis yet") is untouched — this is a new, separate mechanism, not an implementation of that stub. **2. Stack high-water mark.** New static registry in `Telemetry` (`registerTaskForStackMonitoring(name, handle)` / `writeStackHighWaterMarks(JsonObject&)`), backed by a fixed 8-slot array (this codebase's established style — see `strikeCounters[16]` — avoids dynamic allocation). Only tasks that already keep a stored `TaskHandle_t` can be monitored this way; short-lived fire-and-forget tasks created with `xTaskCreate(..., NULL)` (`mqttRecon`, `mqttHB`, `mqttConnect`, `netRecon`, `PlayerCtrl`, `MelodyDL`, `ntpSync`) don't keep a handle and can't be queried. Registered at `begin()` time: `TelemetryTask` itself ([Telemetry.cpp](../../src/Telemetry/Telemetry.cpp)) and `HealthMonitor`'s monitoring task ([HealthMonitor.cpp](../../src/HealthMonitor/HealthMonitor.cpp)) — the two tasks F-051's stack-overflow incident specifically named. Reports bytes free (`uxTaskGetStackHighWaterMark()`'s words-remaining × `sizeof(StackType_t)`), not words, so the console doesn't need to know the platform's word size. **3. WiFi reconnect count + last disconnect reason.** [Networking.hpp](../../src/Networking/Networking.hpp)/[.cpp](../../src/Networking/Networking.cpp) add `_reconnectCount` (incremented in `onWiFiConnected()`, guarded by `_bootSequenceComplete` so the initial boot-time connection isn't counted as a "reconnect" — only connects *after* that first one are) and `_lastDisconnectReason`/`_lastDisconnectUptimeMs`, captured in `networkEventHandler()`'s `ARDUINO_EVENT_WIFI_STA_DISCONNECTED` case via the event's `info.wifi_sta_disconnected.reason` field and Arduino-ESP32's own `WiFi.disconnectReasonName()` helper (already shipped in this SDK — no new lookup table needed). Both are in-memory only, reset on reboot by design: a fresh boot legitimately starts a new "how flaky has this session been" count, distinct from the lifetime boot counter (F-052) which already answers "how many times has this device restarted, ever." **4. OTA / firmware state.** [OTAManager.hpp](../../src/OTAManager/OTAManager.hpp)/[.cpp](../../src/OTAManager/OTAManager.cpp) add `_lastCheckUptimeMs` (set at the top of `checkForUpdates(channel)`, the single call site both the scheduled and emergency check paths funnel through) and `errorCodeToString(ErrorCode)`. `OTAManager::getStatus()`, `getLastError()`, `getAvailableVersion()`, and `isUpdateAvailable()` already existed but were never wired into any command response before this — `firmware.status` (F-049) only surfaced `FirmwareValidator`'s rollback-safety data, a separate concern (see F-052's boot-counter table for why these two subsystems are kept deliberately distinct). **Publishing.** [CommunicationRouter.cpp](../../src/Communication/CommunicationRouter/CommunicationRouter.cpp)'s `reportDiagnosticsIfDue()` — checked from the existing `loop()` (a `millis()`-diff check every main-loop iteration, same lightweight style as `Telemetry`'s own `RUNTIME_FLUSH_INTERVAL_MS` check, not a new FreeRTOS timer) — assembles all four into one payload and calls the existing `publishInfo("diagnostics_report", payload)`: ```json { "type": "diagnostics_report", "payload": { "cpu_temp": { "avg": 47.1, "min": 44.8, "max": 52.8, "samples": 20 }, "wifi_reconnects": { "lifetime_count": 2, "last_reason": "AUTH_EXPIRE", "last_at_uptime_ms": 3600000 }, "ota": { "current_version": "2.7.3", "update_available": false, "last_check_uptime_ms": 180000, "last_error": "NONE" }, "stack_high_water": { "TelemetryTask": 1024, "HealthMonitor": 890 } } } ``` `cpu_temp` is omitted entirely if no samples were taken (e.g. the very first report shortly after boot, before 15s has elapsed). **On-demand access.** [TelemetryHandler.hpp](../../src/Communication/Handlers/TelemetryHandler/TelemetryHandler.hpp)/[.cpp](../../src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp) gain `telemetry.get_diagnostics`, returning the identical shape (unwrapped, per the standard `CommandResult::ok(type, doc)` response envelope — no `"payload"` nesting, unlike the MQTT `status/info` publish). `TelemetryHandler`'s constructor now also takes `OTAManager&` and `Networking&` (previously `Telemetry&` only) — its single construction call site in `CommunicationRouter::registerHandlers()` was updated accordingly. Critically, the on-demand path does **not** reset the temperature accumulator (`Telemetry::writeTemperatureStats()` peeks without consuming) — it's a read, not a report cycle, so a console polling this command doesn't rob the next scheduled 5-minute report of its sampling window. **Scope note (RTC/SD independence):** unlike F-054's `ping` addition, none of these four metrics depend on `#if HAS_RTC` or SD-card presence — `temperatureRead()`, `uxTaskGetStackHighWaterMark()`, WiFi events, and `OTAManager` are all available on every board variant. Verified via `pio run` on all four environments (`vesper-std-v1`, `agnus-v1`, `agnus-mini-v1`, `bespoke-rs485-v1`). Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`, `src/Networking/Networking.hpp`, `src/Networking/Networking.cpp`, `src/OTAManager/OTAManager.hpp`, `src/OTAManager/OTAManager.cpp`, `src/HealthMonitor/HealthMonitor.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.hpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.hpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp` --- ### F-057 — QA-to-shipping stats reset: `telemetry.reset_boot_data` + `logs.clear` Console-requested: a "reset device stats before shipping to customer" button, to clear data accumulated on the bench during QA (bell fires, melody playback, deliberate reboots) without wiping the device's actual configuration. Two commands cover the pieces that had no existing reset path — `telemetry.reset_strikes` (bell strikes) and `telemetry.reset_metrics` (runtime seconds + playback count) already existed and needed no changes. **1. `telemetry.reset_boot_data`.** [Telemetry.hpp](../../src/Telemetry/Telemetry.hpp)/[.cpp](../../src/Telemetry/Telemetry.cpp) add `resetBootData()`, called by the new command in [TelemetryHandler.cpp](../../src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp). Does two things: - Zeroes the lifetime boot counter — both in RAM (`lifetimeBootCount`) and persisted (`nvs_set_u32(_bootNvsHandle, "lifetime_boots", 0)` + `nvs_commit()`, namespace `vesper_boot`). - Deletes `/telemetry_boot_log.json` (the SD-side rotating boot history) via `FileManager::deleteFile()`. Best-effort — a missing SD card or FileManager doesn't fail the command, since the NVS counter is the authoritative piece. **Explicitly does NOT touch `FirmwareValidator`'s NVS namespace (`fw_validator`)** — `boot_count` there is validation-cycle/rollback-safety bookkeeping (boots since the current OTA slot was flashed), not a customer-facing "how many times has this device rebooted" stat. Wiping it would be pointless (not history) and could force an unwanted re-validation cycle. See the boot-tracking table in F-052 for why these two counters are kept structurally separate — this reset only ever touches the one meant to represent device history. ```json { "v": 2, "cmd": "telemetry.reset_boot_data", "contents": {} } ``` Response: `{ "status": "SUCCESS", "type": "telemetry.reset_boot_data", "message": "Lifetime boot count and SD boot log reset" }` — or an error if the NVS write itself failed (SD-only failure is silent/best-effort, not surfaced as an error). **2. `logs.clear`.** [FileManager.hpp](../../src/FileManager/FileManager.hpp)/[.cpp](../../src/FileManager/FileManager.cpp) add `deleteAllLogFiles(logDir)` — lists every file under `/logs` (the day-rotated SD debug log directory) via the same `SD.open()`/`openNextFile()` iteration `pruneLogDirectory()` already uses, then `SD.remove()`s each one. [LoggingHandler.cpp](../../src/Communication/Handlers/LoggingHandler/LoggingHandler.cpp) wires this to a new `logs.clear` command. **Not the same thing as automatic day-rotation pruning** (`FileManager::pruneLogDirectory()`, called from inside `appendLogLine()`) — that only trims the *oldest* files once the directory exceeds `SD_LOG_MAX_TOTAL_BYTES` (512KB), during normal operation, and is deliberately silent (no `LOG_*` calls, to avoid re-entering the SD log write path it's called from). `logs.clear` is a full wipe, invoked only via explicit command, and logs normally (`LOG_WARNING`) since it isn't called from that same nested write path. ```json { "v": 2, "cmd": "logs.clear", "contents": {} } ``` Response: `{ "status": "SUCCESS", "type": "logs.clear", "data": { "deleted": 4 } }` — `deleted` is the file count actually removed. Returns an error only when no SD card/FileManager is present on this board variant (same degrade-gracefully pattern as `logs.list`/`logs.download`). **What this feature does NOT reset** (by design — see the console-side plan for the full picture): `strikeCounters`/runtime seconds/playback count (already covered by the two pre-existing commands), NVS `device_id` (factory identity, never touched by any reset), NVS `fw_validator` (rollback safety state, not history), NVS `rf` (RF remote pairings — customer configuration, not QA noise), and anything `system.factory_reset` already covers (network/bell/clock config, melodies — a different, much broader operation). Verified: `pio run` on all four environments. Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`, `src/FileManager/FileManager.hpp`, `src/FileManager/FileManager.cpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.hpp`, `src/Communication/Handlers/TelemetryHandler/TelemetryHandler.cpp`, `src/Communication/Handlers/LoggingHandler/LoggingHandler.hpp`, `src/Communication/Handlers/LoggingHandler/LoggingHandler.cpp` --- ### F-058 — Fix: NTP sync RTC corruption on flaky internet Field report: units on unstable internet had RTC time drift anywhere from ~10 minutes to half a day, while units on stable internet stayed accurate indefinitely. Root cause found by auditing `Timekeeper::syncTimeWithNTP()` (F-019) against the same function in the pre-restructure firmware (`Controller - Production FW/vesper`) — the bug was present identically in both, confirmed byte-for-byte before this fix. **Root cause.** `syncTimeWithNTP()` wrote whatever `getLocalTime()` returned straight to the RTC via `rtc.adjust()`, with no plausibility check. NTP sync is not on a fixed nightly schedule — `ntpSyncTimerCallback` in [main.cpp](../../src/main.cpp) fires on **every WiFi reconnect** (`onNetworkConnected` callback, 3s stabilisation delay), so an unstable link produces far more sync attempts than a healthy one. The underlying Arduino `configTime()`/`getLocalTime()` API has no request/response correlation — `getLocalTime()` accepts a reply based only on "does the system clock look set now," not "is this the reply to the request I just sent." If WiFi reconnected faster than a single attempt's ~5s resolve window, a stale reply from an earlier abandoned `configTime()` call could be read back during a later attempt's window and written straight to the RTC. This matches the reported symptom — random-magnitude jumps, not a fixed offset, and exposure scaling with connection flakiness rather than occurring on a schedule. **Fix — three layers, all in [TimeKeeper.cpp](../../src/TimeKeeper/TimeKeeper.cpp):** 1. **In-flight de-dup guard.** `ntpSyncInProgress` (`std::atomic`) rejects a new sync attempt while one is already running. Since the SNTP client itself can't distinguish attempts, the fix is to never have more than one in flight — nothing left for a stale reply to collide with. 2. **Retry cooldown.** `lastNtpAttemptMs` enforces a minimum 10s gap (`NTP_MIN_RETRY_MS`) between attempts, independent of the de-dup guard, throttling reconnect storms on a flapping link. 3. **Plausibility + consensus gate.** New `commitNtpResult(time_t candidateLocalEpoch)` compares the NTP candidate against the current RTC value before writing anything: - Drift ≤ `NTP_JUMP_THRESHOLD_SEC` (2 min) — committed immediately as normal drift correction. - Drift > threshold — held as a pending candidate, **not written**. Only committed once `NTP_AGREE_REQUIRED` (3) consecutive sync attempts agree with each other within `NTP_AGREE_TOLERANCE_SEC` (5s). A disagreeing candidate restarts the count. A single bad/stale reply can no longer move the clock by hours — it would have to reproduce identically across three independent syncs. - RTC not running (dead battery / fresh board) — first NTP result trusted unconditionally, since there is nothing meaningful to compare against. All four thresholds are `static constexpr` at the top of `TimeKeeper.cpp`. Consensus state (`pendingNtpEpoch`/`pendingNtpAgreeCount`) is in-RAM only and does not persist across reboot — a device that restarts mid-consensus starts the count over, which is intentional. Full rationale documented in [TimeKeeper/README.md](../../src/TimeKeeper/README.md#ntp-sync-safety-bugfix). Subsystem: `src/TimeKeeper/TimeKeeper.hpp`, `src/TimeKeeper/TimeKeeper.cpp` --- ### F-059 — Fix: partition table mismatch blocking safe OTA to pre-restructure field devices Pre-push sanity check ahead of rolling this firmware out to 6-7 units currently running the pre-restructure `vesper.ino` build (`Controller - Production FW/vesper`). Two things were checked: the NVS identity-key migration (F-014, confirmed correct — no changes needed) and whether OTA itself was safe to push. It was not, for a reason unrelated to any application code. **Root cause.** `platformio.ini` had every environment building against PlatformIO's `min_spiffs.csv` partition table. Field devices were originally flashed via Arduino IDE with `PartitionScheme=no_fs` (confirmed byte-for-byte from `Controller - Production FW/vesper/build/esp32.esp32.esp32/build.options.json` and `partitions.csv`). The two tables disagree on `app1`'s offset (`0x200000` vs `min_spiffs.csv`'s `0x1F0000`) and both app slot sizes (`0x1F0000` vs `0x1E0000`), because `min_spiffs.csv` carves out a 128KB `spiffs` partition that `no_fs` doesn't have. This matters because of how ESP32 OTA actually works: the bootloader and the running app both resolve partition offsets from a boot-time snapshot of the partition-table sector at flash offset `0x8000` — OTA (`Update.begin()`/`esp_ota_*`) never reads or writes that sector, it only writes app bytes into whichever slot the *currently burned* table already declares. A device still carrying the old `no_fs` table has no partition entry at `0x1F0000` (where `min_spiffs.csv` expects `app1` to live), so there is no way for a `min_spiffs`-built OTA image to ever land where the new firmware needs it to be. Rewriting the table itself via OTA to fix this is a separate, much riskier operation that Espressif's own team has stated they will never support ("highly dangerous, and will end up bricking some of your devices") — an interrupted write to that one sector has no redundancy and bricks the device, recoverable only via USB/serial. **Fix.** Since this firmware is SD-card only and has zero SPIFFS/LittleFS references anywhere in the codebase, the `spiffs` partition was never actually used — it was pulled in incidentally as PlatformIO's default template, not a deliberate requirement. [no_fs.csv](../../no_fs.csv) (copied verbatim from the Arduino ESP32 core's own `tools/partitions/no_fs.csv`) was added to the repo root and all four environments (`vesper-std-v1`, `agnus-v1`, `agnus-mini-v1`, `bespoke-rs485-v1`) now build against it instead of `min_spiffs.csv`. Verified the resulting `partitions.bin` decodes to an exact byte-for-byte match of the table already burned into field devices (`app0`/`app1` offsets and sizes, `otadata`, `nvs`, `coredump` all identical). No functionality lost, and each app slot actually gained ~64KB of headroom (`0x1F0000` vs `0x1E0000`) as a side effect of dropping the unused `spiffs` partition. With this in place, OTA to the existing field devices is safe going forward — no USB/serial reflash required for this release. `agnus-v1`/`agnus-mini-v1`/`bespoke-rs485-v1` were switched too for consistency even though they have no legacy install base, so the whole codebase can never regress into this mismatch again. Verified: `pio run` (all four environments) + manual decode of `partitions.bin` against the field-device `partitions.csv`. Subsystem: `platformio.ini`, `no_fs.csv` (new) --- ### F-060 — `system.set_identity`: sysadmin override of factory-set device identity Device identity (`serial`, `hw_family`, `hw_revision`) has been factory-set-and-read-only since the NVS provisioning work — production firmware loads it once at boot and previously had no write path at all (`ConfigManager::saveDeviceIdentityToNVS()` had been deliberately removed). That's still the right default: `serial` derives the MQTT password (`HMAC-SHA256(MQTT_SECRET, serial)`), and `hw_family`/`hw_revision` select the OTA channel/binary, so an uncontrolled identity change can desync MQTT auth or pull firmware built for the wrong board. This adds a narrow, deliberate exception: a new `system.set_identity` command lets a sysadmin overwrite identity on an already-deployed device — e.g. correcting a mis-provisioned unit, or reassigning a serial after a board swap — without a USB/serial reflash. **Design constraints, by intent:** - **MQTT-only.** Rejected over WebSocket/HTTP with an explicit transport check in the handler (same pattern as `identify`'s WebSocket-only restriction), and not added to `UARTTransport::WHITELIST`, so UART drops it by default. This means the command is only reachable by publishing to the device's MQTT command topic — i.e. only from the backend/console, not from a device on the local network probing the WebSocket/UART surface. - **All three fields required together.** No partial update. Matches the existing boot-time invariant (`loadDeviceIdentityFromNVS()` already fails if any of the three is empty) — there's no valid state with only some of them set. - **Forces a reboot after a successful write.** MQTT credentials, hostname, and AP SSID are all derived from `serial` once at boot (`ConfigManager::begin()`); they will not recompute live, so the device would otherwise keep authenticating with the *old* derived password after its stored identity already changed. Reply is sent first, then reboot after 2s (same pattern as `system.restart`). - **Firmware does not update the backend.** This command only writes the device's own NVS + in-RAM copy. The backend device record (and re-derived MQTT password) must be updated in the same operation by whatever triggers this command — documented as a caller responsibility in both the handler and `ConfigManager::saveDeviceIdentityToNVS()`. Not gated behind an additional `confirm` field in the command body — the console UI is expected to require its own confirmation step before ever publishing this command, so no device-side friction was added on top of that. Subsystem: `src/ConfigManager/ConfigManager.hpp`, `src/ConfigManager/ConfigManager.cpp`, `src/Communication/Handlers/SystemHandler/SystemHandler.hpp`, `src/Communication/Handlers/SystemHandler/SystemHandler.cpp` --- ### F-061 — Fix: `LegacyResponseAdapter` — v1 tablets saw device as "unavailable" while playing `LegacyAdapter` already translates incoming v1 **requests** (tablets still on the old Flutter app, which never sends a `"v"` field) into v2 internal commands. What was missing was the reverse: v2 handlers reply using v2 conventions — `system.status`'s reply used `type:"system.status"` with fields under `data`, UPPERCASE status strings (`"PLAYING"`/`"STOPPED"`/...), `time_elapsed_ms`, and `strike_counters` as an object keyed `"0".."15"` — none of which the v1 app recognises. It polls for `type:"current_status"` with fields under `payload`, lowercase status strings, `time_elapsed`, and `strike_counters` as an array. Because the reply never matched, the v1 app's own 5-second request timeout fired every time, and its `catch` block explicitly set `playbackStatus: PlaybackStatus.unavailable` — **while the device was actually playing correctly and had already replied.** This was reported as "the board shows unavailable sometimes while it's playing" and traced to this schema mismatch, not a real connectivity/timeout issue. The async `playback` INFO push (`Player::setStatus()`) was checked too and was already v1-compatible — no changes needed there. **Fix.** Added `LegacyResponseAdapter` (`src/Communication/CommandBus/LegacyResponseAdapter.{hpp,cpp}`) — a narrow, allowlisted translator that rewrites a `CommandResult` back into v1 shape, but only for replies to requests whose *original* envelope version was 1 (v2 clients and all other reply types are untouched, byte-for-byte). Each transport's reply lambda now captures `isLegacyRequest` (from `envelope.version` before `CommandBus::dispatch()` overwrites it to 2) and routes through the adapter when true. Wired into WebSocket, MQTT, and HTTP's general command path; not touched: HTTP's `system.status` shortcut route (hardcodes v2) and UART (board-to-board only, no known v1 peers). This is deliberately temporary migration scaffolding, not new permanent architecture — the plan is to update all devices (firmware + tablets) to v2 and retire both `LegacyAdapter` and `LegacyResponseAdapter` together once fleet telemetry shows zero v1 requests. Full rationale, the before/after schema table, and the exact removal steps are in [architecture/legacy-response-adapter.md](../architecture/legacy-response-adapter.md). Verified: `pio run -e vesper-std-v1` builds clean (all four environments share the touched files). Subsystem: `src/Communication/CommandBus/LegacyResponseAdapter.hpp` (new), `src/Communication/CommandBus/LegacyResponseAdapter.cpp` (new), `src/Communication/Transport/WebSocketTransport/WebSocketTransport.cpp`, `src/Communication/Transport/MQTTTransport/MQTTTransport.cpp`, `src/Communication/Transport/HTTPTransport/HTTPTransport.cpp` --- ### F-062 — MQTT topic spec v2 Full rebuild of the MQTT wire topics per `docs/reference/vesper_mqtt_topic_spec_v2.md`. Only the MQTT transport path changed — WebSocket, HTTP, and UART are untouched. **Old → new topic mapping:** - `control` (in) / `data` (out, replies + broadcasts mixed) → `control/command` (in, read-only from the board's perspective) / `control/ack` (out, **strictly** replies + bus-wide broadcasts — nothing purpose-specific is ever published here) - `status/alerts` → `system/alerts` (unchanged shape, now retained until cleared — previously published with `retain=false`, which was a latent bug against its own stated "state-change events" intent) - `status/info` → `system/info` (unchanged shape, now retained) - New: `status/playback` — playback transitions only, split out of the old `data` topic. Published by `CommunicationRouter::publishPlayback()`, called from `Player::setStatus()` alongside the existing WebSocket `broadcastStatus()` call (WS shape/behaviour unchanged). - New: `control/reports` — critical, unsolicited, board-initiated events that need to be read *now* (currently: `bell_overload`, moved off the old `data` topic). Not retained — an event stream, not a status snapshot. The naming mirrors `control/command`: where `command` is inbound-only from the board's perspective, `reports` is outbound-only, unsolicited. - New: `system/logs` — the log-publish topic, unchanged in shape/mechanism from the pre-existing `Logging` MQTT channel, just renamed and moved under `system/`. - New: `system/metrics` — the existing 5-minute diagnostics report (CPU temp, WiFi reconnects, OTA state, stack high-water marks) moved here from `system/info`, since it's exactly the "structured telemetry for fleet-health graphing" the spec describes for this topic. Also gained per-bell strike/heat-load data (`Telemetry::getStrikeCount()`/`getBellLoad()`/`isCoolingActive()` for all 16 channels) — the spec explicitly calls out "bell heat ratings" for this topic and there was previously no MQTT-side exposure of it at all. - Reserved, not yet built: `system/ota` (OTA-over-MQTT status streaming — no OTA-over-MQTT capability exists yet). **LWT (Last Will and Testament) — new.** `MQTTDriver::begin()` registers a Will via `AsyncMqttClient::setWill()` targeting `status/heartbeat` with `{"device_id","state":"offline","ok":false}` (QoS 1, retained). The broker publishes this automatically on an *unclean* disconnect (crash/power-loss/network-loss) — there was no LWT at all before this change, so an unclean disconnect previously left a stale "last known good" heartbeat retained indefinitely with no way to distinguish "device is fine, just hasn't sent one in a while" from "device dropped off the network an hour ago." `AsyncMqttClient` resends the Will on every reconnect automatically — no manual re-registration needed. For *intentional* disconnects (which don't trigger LWT), `MQTTDriver::disconnect(true)` explicitly publishes the same offline payload first — wired into `mqtt.disable`. **Heartbeat payload reshaped.** Flattened (no more `status`/`type`/`payload` envelope wrapper — the topic itself is the discriminator now, matching every other v2 topic). New fields: `state` (`idle`/`playing`/`paused`/`error`/`booting`) and `ok` (bool), both independently derived via a new `MQTTDriver::setStateProvider()` callback — wired by `CommunicationRouter` from `Player::isCurrentlyPlaying()`/`isCurrentlyPaused()` and `HealthMonitor::isFirmwareStable()`, per the spec's explicit requirement that these NOT be mirrored from `status/playback` or `system/alerts`. `timestamp`/`firmware_version` renamed to `uptime_human`/`fw_version` for consistency with the rest of the v2 field naming. **`req_id` correlation — new, bus-wide.** `CommandEnvelope` and `CommandResult` both gained an optional `reqId` field (`CommandBus::dispatch()` copies it from envelope to result before calling `reply()`, so individual handlers never need to know about it). Always optional — a request without `req_id` gets a reply without one, so v1 clients and any existing caller are unaffected. Implemented bus-wide rather than MQTT-only because the same correlation problem (multiple logical senders sharing one channel) applies to any future multiplexed transport, not just MQTT's shared broker topics. MQTT is the first (and currently only) transport that actually parses/echoes it, in `MQTTTransport::onMessage()`. **Per-topic ON/OFF switches — new.** `ConfigManager::MqttTopicConfig` (8 bools: `command`, `heartbeat`, `playback`, `reports`, `alerts`, `info`, `logs`, `metrics`) persisted alongside the existing `GeneralConfig` (SD: nested `mqttTopics` object in `generalConfig.json`; NVS on no-SD boards: packed into a single `u8` bitfield at key `gc_mtop`). All default to `true` (no behaviour change on upgrade). These are **sub-switches under the existing `mqtt.enable`/`mqtt.disable` master switch** — turning the master off still disconnects the broker entirely regardless of these flags; while connected, each flag independently gates whether its topic publishes. `command` is the one switch that covers both directions — turning it off unsubscribes `control/command` live (`MQTTDriver::applyCommandTopicSwitch()`, no reconnect needed) and blocks `control/ack` replies. Read via `mqtt.get_topics`, changed via `mqtt.set_topics` (partial update — only send the fields you want to change). **Why this shape (design decisions made with the user):** `control/ack` is strictly reply-only — no unsolicited event is ever published there, full stop; anything unsolicited-but-important got its own topic (`control/reports`) instead of being folded into the reply channel. Diagnostics moved to `system/metrics` rather than staying on `system/info` because it's quantitative telemetry, not a discrete one-off event like `boot_report`. `req_id` went in bus-wide (not MQTT-scoped) on the reasoning that multiple devices/senders sharing one transport is a general problem, not MQTT-specific — with no access control for now (anyone can set any `req_id`), left as a deliberate future extension point. Verified: `pio run -e vesper-std-v1` and `pio run -e agnus-v1` both build clean (SD and no-SD NVS config paths both touched). Subsystem: `src/Communication/Drivers/MQTTDriver/MQTTDriver.hpp`, `src/Communication/Drivers/MQTTDriver/MQTTDriver.cpp`, `src/Communication/Transport/MQTTTransport/MQTTTransport.hpp`, `src/Communication/Transport/MQTTTransport/MQTTTransport.cpp`, `src/Communication/Handlers/MQTTHandler/MQTTHandler.hpp`, `src/Communication/Handlers/MQTTHandler/MQTTHandler.cpp`, `src/Communication/CommandBus/CommandEnvelope.hpp`, `src/Communication/CommandBus/CommandResult.hpp`, `src/Communication/CommandBus/CommandBus.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.hpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, `src/ConfigManager/ConfigManager.hpp`, `src/ConfigManager/ConfigManager.cpp`, `src/Player/Player.cpp` --- ### F-063 — Fix: malformed `control/command` input silently dropped Found during manual QA of F-062: sending invalid JSON (e.g. a missing comma or bracket) to `control/command` logged `[WARN][MQTTTransport] JSON parse error: IncompleteInput — dropping message` on serial, but published nothing to `control/ack`. A caller had no way to distinguish "malformed request" from "message never arrived" or "device offline" — all three looked identical from the client's side: silence until its own timeout fired. **Fix.** Both silent-drop paths in `MQTTTransport::onMessage()` now reply with an `ERROR` on `control/ack` before returning, instead of just logging and returning: - Unparseable JSON → `{ "status": "ERROR", "type": "parse_error", "message": "Invalid JSON: " }`. No `req_id` on this reply — one can't be read out of input that failed to parse. - Valid JSON but missing `cmd` → same shape, `"message": "Missing required field: cmd"`. Echoes `req_id` if the JSON was otherwise valid and included one. The pre-existing heap-guard drop (`MQTTDriver::hasHeapForPublish()` check, top of `onMessage()`) is deliberately **not** changed — that guard exists specifically to avoid allocating under critical heap pressure (see F-055), and a parse-error reply is cheap enough not to need the same protection, but the guard itself must stay silent by design. Verified: `pio run -e vesper-std-v1` builds clean. Subsystem: `src/Communication/Transport/MQTTTransport/MQTTTransport.cpp` --- ### F-064 — Richer `status/playback` payload Built for the remote (MQTT) phone app, which treats `status/playback` as the source of truth for what the board is doing (a `control/ack` SUCCESS only means "accepted"). The old payload (`action`, `time_elapsed`, `projected_run_time`) couldn't say *what* was playing, and — because the topic is retained — a client receiving an old message had no way to work out real elapsed time. **New fields** (old ones kept unchanged for backward compatibility): - `pid` — melody being played (`""` when idle) - `speed` — ms per beat (0 when idle) - `duration` — requested run-time cap in ms. This is `Player::total_duration` *after* `mode`/legacy resolution (`timed` → `duration`, `interval` → `total_duration`, legacy → `segment_duration` or `total_duration`), i.e. the value the stop timer actually uses. `0` = no cap. - `started_at` — Unix epoch s (UTC) when playback started, derived at publish time as `ts − elapsed` so it is right even for a snapshot built mid-playback. `0` when idle or no valid clock. - `source` — `app` | `rf` | `button` | `schedule` | `unknown` (`""` when idle). - `ts` — Unix epoch s (UTC) when the message was built, `0` if no valid clock. **Clock.** `Player::currentEpoch()`: the system clock if it is past 2024-01-01 (it is UTC once NTP has synced via `configTime(0, 0, …)`), else `Timekeeper::getUtcEpoch()` (new) on RTC builds, else `0`. The RTC holds *local* time (NTP results and `clock.set_time` are written with GMT+DST applied), so `getUtcEpoch()` subtracts the configured offsets back out; it returns 0 when the RTC isn't running and never logs. RTC-less builds (agnus) report `0` until NTP syncs. **Source is carried, not guessed.** `CommandEnvelope` gained an `origin` field (`UNKNOWN`/`APP`/`BUTTON`/`SCHEDULE`) set by each transport when it builds the envelope: MQTT, WebSocket, HTTP and the settings web server → `APP`; UART → `BUTTON` (its peer is the LCD/button slave board). `PlaybackHandler` maps it to `PlaybackSource` and passes it to `Player::command()`; `RFRemote::triggerPlay()` passes `PlaybackSource::RF` directly. `SCHEDULE` is reserved — `Timekeeper::triggerEvent()` is still a TODO and never starts playback. **One writer for both transports.** New `src/Player/PlaybackState.hpp` defines `PlaybackSnapshot` with a single `writeTo(JsonObject)`. `Player::setStatus()` builds one snapshot (`Player::getPlaybackSnapshot()`, public so the MQTT connect path can reuse it) and writes it both into the WebSocket INFO broadcast (under `payload`, legacy shape) and to `CommunicationRouter::publishPlayback(snapshot)` (flat), so local and remote clients see identical fields. `publishPlayback()` now checks `MQTTDriver::hasHeapForPublish()` before building the document, same as the heartbeat. Payload is ~170 bytes. Verified: `pio run -e vesper-std-v1` and `pio run -e agnus-v1` both build clean. Subsystem: `src/Player/PlaybackState.hpp` (new), `src/Player/Player.hpp`, `src/Player/Player.cpp`, `src/TimeKeeper/TimeKeeper.hpp`, `src/TimeKeeper/TimeKeeper.cpp`, `src/Communication/CommandBus/CommandEnvelope.hpp`, `src/Communication/Handlers/PlaybackHandler/PlaybackHandler.cpp`, `src/Communication/CommunicationRouter/CommunicationRouter.hpp`, `src/Communication/CommunicationRouter/CommunicationRouter.cpp`, all five transports (origin), `src/RFRemote/RFRemote.cpp`, `src/Version.hpp` (→ 2.3.0)