playbackLoop() slept 500 ms after every loop whenever the run had no end time (infinite, interval with total_duration 0, v1 continuous_loop with no total), so those modes paused between loops while timed / interval with a total did not. The delay was meant to give Player time to pause/stop, but play-once already stops synchronously in onMelodyLoopCompleted(), stop is checked before every pass and pause after every loop. Every looping mode now plays loop-to-loop with no gap; single is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Project Vesper — Documentation
Bell automation firmware for ESP32 (Kincony KC868-A6).
Reference
| File | Description |
|---|---|
| reference/api-reference.md | Firmware API v2 — all commands, transports, envelope format |
| reference/firmware-variants.md | PlatformIO environments, partition tables, build flags, OTA URLs |
| reference/api-reference-v1-legacy.md | Old v1 API (pre-refactor) — kept for historical reference |
Architecture
| File | Description |
|---|---|
| architecture/communication-refactor-plan.md | Full design doc for the v2 Communication subsystem (CommandBus, Handlers, Transports) |
| architecture/legacy-response-adapter.md | LegacyResponseAdapter — v2→v1 reply translation for the v1→v2 migration window (temporary, with removal steps) |
Features
| File | Description |
|---|---|
| features/feature-catalog.md | Feature catalog — index + details for every feature on the device |
| features/heartbeat.md | MQTT heartbeat — retained 30s status publish (detail doc, also in catalog as F-008) |
Development
| File | Description |
|---|---|
| dev/platformio-commands.md | PlatformIO CLI reference |
| dev/common-commands.md | Common v1 command snippets (scratch/lab use) |
| dev/features-scratch.md | Feature notes and todo scratch pad |
Other
| File | Description |
|---|---|
| roadmap.md | Product roadmap |
| SentDevices/ | Records of deployed devices |
Working Rules (enforced in every session)
Context
This is ESP32 firmware (C++/Arduino/PlatformIO) for a bell automation controller.
It is maintained by a single developer over a long time, with AI assistance.
That means both of us can forget what was built weeks ago — so we need hard process rules to compensate.
Rules — non-negotiable
1. Feature catalog is mandatory.
Every feature added or changed must be logged in docs/features/feature-catalog.md.
Format: a short one-line entry in the index at the top, plus a detailed section below.
This is the single source of truth for "what does this device actually do?"
2. Commit every meaningful step.
Nothing stays uncommitted for long. Each logical unit of work (a fix, a feature, a refactor) gets its own commit with a clear message. Stacked uncommitted changes are a liability — they blur what changed and why.
3. Commit messages are descriptive.
fix(InputManager): add medium-press tier at 5s for WiFi-only reset
is better than fix button. The message must make sense to a reader in 6 months who has never seen this codebase.
4. Feature catalog entry before (or with) the commit.
When committing a feature or significant fix, the catalog entry is part of the same commit or committed immediately after. Never leave a feature undocumented.
5. At the start of every session, check what is uncommitted.
Before writing any new code, surface any dirty working tree and deal with it first — commit, discard, or document why it stays pending.
Feature catalog location
docs/features/feature-catalog.md
What counts as a "feature" for the catalog
- Any new user-facing behaviour (commands, button gestures, network modes, playback options)
- Any significant internal mechanism a future developer would need to know (e.g. two-tier factory reset, NTP UTC correction, builtin melody aliases)
- Bug fixes that change observable behaviour (e.g. default version fallback changed from 2→1)
What does NOT need a catalog entry
- Pure refactors with no behaviour change
- Log message tweaks
- Doc-only commits
6. Every change bumps the firmware version.
FW_VERSION in src/Version.hpp is MAJOR.MINOR.PATCH and is what devices report and what OTA compares, so two different builds must never share a number.
- PATCH (
2.4.0 → 2.4.1) — bug fixes, internal changes, log/latency tweaks with no new API or behaviour contract. - MINOR (
2.4.x → 2.5.0) — new commands, fields, topics or features, or a change to observable behaviour (timings, QoS, defaults). - MAJOR (
2.x → 3.0.0) — breaking changes for apps/backend. Discuss with the owner before bumping major.
The bump goes in the same commit as the change (or one commit covering a batch that ships together): update FW_VERSION, add a line to the VERSION HISTORY comment above it, and set the feature catalog's "Since" column to the new version. Doc-only commits don't bump.
7. Console API Reference is mandatory.
Any new command/API endpoint, or a change to an existing one's contents/response/errors, must be reflected in the console's live API Reference page — not just in docs/reference/api-reference.md. The two are separate files in separate repos and neither auto-syncs from the other; both must be updated by hand in the same change.
Console API Reference location
C:\development\bellsystems-cp\frontend\src\pages\engineering\developer\ApiReferencePage.jsx
This is a different repo (bellsystems-cp, the backend/console repo) from this firmware repo (project-vesper) — open it directly by path, it will not show up in a search scoped to this repo.
How to update it
Commands are grouped into a NAMESPACES array. Each entry is { id, label, description, commands: [...] } — one entry per namespace (e.g. system, clock, relay, ota, firmware, network, or root for commands with no prefix). Find the matching namespace (or add a new one) and add/edit a command object in its commands array with these fields:
| Field | Required | Meaning |
|---|---|---|
cmd |
yes | Full command name, e.g. "clock.set_time" |
handler |
yes | The C++ handler class that services it, e.g. "ClockHandler" |
transports |
yes | Array/label of which transports accept it — usually ['All']; narrow it if the command is transport-restricted (e.g. identify is WebSocket-only, ping is unavailable on RTC-less variants) |
description |
yes | What the command does, plus any caveats (rejection conditions, variant restrictions, blocking behaviour) |
contents |
yes (null if none) |
Array of request fields, or null if the command takes no contents body |
contents[].field |
yes | Field name as it appears in the JSON contents object |
contents[].type |
yes | Wire type: string, int, bool, int[], object, etc. |
contents[].required |
yes | true/false — whether the field is mandatory. If a command requires "at least one of" a set of optional fields, say so in notes on each and add an error entry for the all-missing case |
contents[].notes |
yes | What the field means, valid ranges/values, 0-based vs 1-based indexing (call this out explicitly — this API mixes both), defaults, and interactions with other fields |
response |
yes | Exact success wire-format JSON as a string, matching the real { "status": "SUCCESS", "type": "<cmd>", "message"/"data": ... } envelope the firmware actually sends |
errors |
yes ([] if none) |
Array of { message, condition } — message is the exact error string the firmware emits, condition is when it fires. Should cover every CommandResult::err() path in the handler |
example |
yes | One or more realistic full request JSON payloads ({ "v": 2, "cmd": "...", "contents": {...} }), as a string |
warning |
yes (null if none) |
Set for anything destructive or irreversible (reboot, factory reset, rollback) — short caller-facing warning string |
When adding a new namespace, also check UART_WHITELIST near the top of the file — if the command should be reachable over UART, add its name there too (UART only accepts whitelisted commands).
Keep docs/reference/api-reference.md (this repo) and the console page in sync — update both in the same change whenever a command is added or changed.