feat(MQTT): confirmed delivery for playback/reports; vendor AsyncMqttClient; pin all deps (F-073)

- MQTTDriver::publishConfirmed(): QoS 1 + PUBACK tracking (8 s; heartbeat
  20 s). A missed PUBACK forces a reconnect. status/playback relies on the
  existing republish-current-state-on-connect; control/reports are resent
  after the next CONNACK (newest 4). Publish + registration under one
  recursive mutex since the PUBACK can arrive before publish() returns.
- AsyncMqttClient vendored into lib/ (upstream 3d93fc7) with one patch:
  _onPubAck()/_onPubComp() call _handleQueue(), so a QoS 1 message delays
  the next packet by one RTT instead of RTT + up to ~500 ms.
- platformio.ini: platform and every library pinned to the exact versions
  already being built (git deps by commit). Clean-libdeps rebuild verified
  to resolve the same AsyncTCP and the vendored AsyncMqttClient.
- Removed board_build.cmake_extra_args (timer stack): no effect on Arduino
  builds, the SDK is precompiled with 2048. Replaced by a warning comment.
- mqtt.status gains resent_messages and the new forced-reset reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 21:50:54 +03:00
co-authored by Claude Opus 5.5
parent cec4db4894
commit c43d9ae11c
59 changed files with 2674 additions and 69 deletions
+4 -4
View File
@@ -15,9 +15,9 @@ Vesper publishes on eight MQTT topics (a ninth, `system/ota`, is reserved but no
|-------|-----------|-----|----------|--------|---------|
| `vesper/{id}/control/command` | Inbound | 1 | no | `command` | Commands from server/app — board only ever receives here |
| `vesper/{id}/control/ack` | Outbound | 0 | no | `command` | Replies to commands **only** — strictly request/response |
| `vesper/{id}/control/reports` | Outbound | 0 | no | `reports` | Critical, unsolicited, time-sensitive board-initiated events (`bell_overload`, `playback_failed`) |
| `vesper/{id}/control/reports` | Outbound | 1 | no | `reports` | Critical, unsolicited, time-sensitive board-initiated events (`bell_overload`, `playback_failed`) |
| `vesper/{id}/status/heartbeat` | Outbound | 1 | yes | `heartbeat` | Periodic liveness + state signal. Also carries LWT. |
| `vesper/{id}/status/playback` | Outbound | 0 | yes | `playback` | Playback transitions only |
| `vesper/{id}/status/playback` | Outbound | 1 | yes | `playback` | Playback transitions only |
| `vesper/{id}/system/alerts` | Outbound | 0 | yes, until cleared | `alerts` | Subsystem state-change events |
| `vesper/{id}/system/info` | Outbound | 0 | yes | `info` | Discrete device state events (boot report, etc.) |
| `vesper/{id}/system/logs` | Outbound | 0 | no | `logs` | Full log stream, mirrors serial log output |
@@ -85,7 +85,7 @@ to `status/heartbeat` (QoS 1, retained), overwriting the last "online" heartbeat
## `vesper/{id}/status/playback`
**QoS:** 0 — **Retained:** yes — **Switch:** `playback` — **Trigger:** playback state transition only
**QoS:** 1 (PUBACK tracked; current state republished on every reconnect) — **Retained:** yes — **Switch:** `playback` — **Trigger:** playback state transition only
Published by `Player::setStatus()` on every transition (not polled), **and on every MQTT connect/reconnect** with the Player's current real state — so a retained `playing` left behind by a power loss mid-melody is overwritten (normally with `idle`) as soon as the board is back. This topic — not the `control/ack` reply — is the source of truth for what the board is actually doing. Skipped (not queued) while free heap is below the publish guard.
@@ -151,7 +151,7 @@ On a SUCCESS play ACK the board publishes `status/playback` **before** the ACK:
## `vesper/{id}/control/reports`
**QoS:** 0 — **Retained:** no — **Switch:** `reports` — **Trigger:** critical, time-sensitive, board-initiated event
**QoS:** 1 (PUBACK tracked; resent after a reconnect if unconfirmed) — **Retained:** no — **Switch:** `reports` — **Trigger:** critical, time-sensitive, board-initiated event
The opposite of `control/command`: unsolicited data the board sends because it needs to be read *now*. Not a reply to anything — never carries `req_id`. Not retained, since it's an event stream, not a status snapshot.