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:
@@ -139,6 +139,15 @@ void Timekeeper::setTimeWithLocalTimestamp(unsigned long localTimestamp) {
|
||||
loadTodaysEvents();
|
||||
}
|
||||
|
||||
uint32_t Timekeeper::getUtcEpoch() {
|
||||
static constexpr int64_t MIN_VALID_EPOCH = 1704067200; // 2024-01-01T00:00:00Z
|
||||
if (!_configManager || !rtc.isrunning()) return 0;
|
||||
|
||||
const auto& tc = _configManager->getTimeConfig();
|
||||
int64_t utc = (int64_t)rtc.now().unixtime() - (tc.gmtOffsetSec + tc.daylightOffsetSec);
|
||||
return (utc >= MIN_VALID_EPOCH) ? (uint32_t)utc : 0;
|
||||
}
|
||||
|
||||
unsigned long Timekeeper::getTime() {
|
||||
if (!rtc.isrunning()) {
|
||||
LOG_ERROR(TAG, "RTC not running - cannot get time");
|
||||
|
||||
Reference in New Issue
Block a user