feat(Player,MQTT): add pid/speed/duration/started_at/source/ts to status/playback (F-064)

The remote phone app treats status/playback as the source of truth for what
the board is doing, but the payload couldn't say what was playing, and a
client receiving a stale retained message couldn't work out real elapsed
time. Adds (old fields kept):

- pid, speed, duration (effective stop timer after mode/legacy resolution)
- started_at / ts — Unix epoch s (UTC); system clock once NTP-synced, else
  new Timekeeper::getUtcEpoch() (RTC local time minus configured offsets),
  else 0
- source — app | rf | button | schedule | unknown. Carried, not guessed:
  new CommandEnvelope::origin set by each transport (MQTT/WS/HTTP → APP,
  UART slave board → BUTTON), mapped by PlaybackHandler; RFRemote passes RF

New PlaybackState.hpp has one PlaybackSnapshot::writeTo() used for both the
WebSocket INFO broadcast (under "payload") and MQTT status/playback (flat),
so local and remote clients match. publishPlayback() now honours the
hasHeapForPublish() guard before building the document.

Bumps FW_VERSION to 2.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 20:09:16 +03:00
co-authored by Claude Opus 5.5
parent b80dbc9b89
commit 204b54fce1
19 changed files with 280 additions and 62 deletions
@@ -649,19 +649,18 @@ void CommunicationRouter::publishInfo(const String& type, const JsonDocument& pa
LOG_DEBUG(TAG, "Info published: %s", type.c_str());
}
void CommunicationRouter::publishPlayback(const String& action, uint32_t timeElapsedSec, uint64_t projectedRunTimeMs) {
void CommunicationRouter::publishPlayback(const PlaybackSnapshot& snapshot) {
if (!_mqttClient.isConnected()) return;
if (!_configManager.getMqttTopicConfig().playback) return;
if (!_mqttClient.hasHeapForPublish()) return; // skip building the JsonDocument too, not just the publish
JsonDocument doc;
doc["action"] = action;
doc["time_elapsed"] = timeElapsedSec;
doc["projected_run_time"] = projectedRunTimeMs;
snapshot.writeTo(doc.to<JsonObject>());
String out;
serializeJson(doc, out);
_mqttClient.publishDirect(_mqttClient.getPlaybackTopic(), out, 1, true);
LOG_DEBUG(TAG, "Playback published: %s", action.c_str());
LOG_DEBUG(TAG, "Playback published: %s", snapshot.action);
}
void CommunicationRouter::publishReport(const String& type, const JsonDocument& payload) {