Console requested four more Health-tab metrics beyond F-054's free_heap/ping
work. None needed 30s heartbeat freshness, so this adds a separate low-frequency
report instead of growing the heartbeat further: published every 5 min to
status/info (diagnostics_report) and queryable on-demand via a new
telemetry.get_diagnostics command.
Only CPU temperature needs local sampling (15s, via a min/max/avg RunningStats
accumulator on Telemetry) — a thermal spike could occur and subside entirely
within a 5-minute gap. The other three fields are monotonic/self-tracking
(WiFi reconnect counter, FreeRTOS's own stack high-water mark, rarely-changing
OTA state) so a single read at report time loses no information.
Verified: pio run on all four board variants.
Decoded a new crash via addr2line against the exact flashed ELF:
console reported faulting task "async_tcp", cause 29, vaddr 0. Full
backtrace traced through AsyncTCP's _async_service_task ->
AsyncMqttClient::_onData -> MQTTTransport::onMessage ->
CommandBus::dispatch -> the reply path -> MQTTDriver::publish ->
AsyncMqttClient::publish -> PublishOutPacket's vector::reserve ->
operator new failing -> unhandled C++ exception -> abort().
Root cause is heap fragmentation, not a single bad allocation: rapid
relay.test_bell commands with Verbose/Debug logging meant every
command triggered ~4-5 JsonDocument/String allocations (RX log,
dispatch log, handler log, MQTT log-channel copies, reply publish),
all on AsyncTCP's own task, faster than the allocator could coalesce
freed blocks between cycles. Two "JSON parse error: NoMemory"
warnings preceded the abort by seconds - an early symptom of the same
fragmentation.
Checked why this can't be a catchable exception: this SDK build has
CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0, so when the heap is
too fragmented to even allocate the object needed to throw
std::bad_alloc, it aborts instead of throwing. That's baked into the
precompiled Arduino-ESP32 core; fixing it means rebuilding the whole
ESP-IDF core from source, judged out of scope. Chose prevention over
a catchable-exception fix.
Adds MQTTDriver::hasHeapForPublish() (20KB threshold, chosen with
margin above the ~62KB-free-but-already-fragmented state seen at
crash time) and applies it before every allocation-heavy publish path
(publish, publishDirect, publishHeartbeat) and before MQTTTransport::
onMessage() does its own incoming-command deserialization. Skip
warnings use Serial.printf directly, not LOG_*, to avoid recursing
into the same low-heap condition via MQTT-channel logging.
Also corrects how coredump crash detail should be read for abort()-
reached crashes (vs. true hardware exceptions like the F-051 stack
canary trip): pc/exc_cause/exc_vaddr describe abort() internals in
this case, not the original fault site - only the task name is
reliably the "real" crash location. Documented for console/dashboard
consumers in feature-catalog.md F-055.
A full fix (queueing incoming commands off AsyncTCP's task, mirroring
the F-051 logging-queue redesign) is scoped out as a documented
future improvement, not rushed into this change.
Verified: pio run on vesper-std-v1 and agnus-v1.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Requested by the console-side agent building a device Health tab
(RSSI, ping latency, free heap, restart timeline graphs). Both changes
are additive and backward-compatible.
publishHeartbeat() now includes free_heap (ESP.getFreeHeap()) on the
existing 30s heartbeat, alongside rssi — previously free heap was only
visible once per boot via boot_report, a single point rather than a
trend.
handlePing() previously built a JsonDocument and never used it —
ping was a pure ack. It now echoes back an optional caller-supplied
"ts" (epoch-millis) unchanged, plus device_uptime_ms, so the caller
can compute round-trip latency as (time of receipt) - ts without
needing synchronized clocks. ts is optional on both request and
response, so existing callers doing a plain liveness check are
unaffected. Left the existing #if HAS_RTC scoping on SystemHandler.cpp
untouched, per the request — ping remains RTC-variant-only.
Verified: pio run on vesper-std-v1 and agnus-v1 (confirms the HAS_RTC
scoping around SystemHandler.cpp wasn't disturbed).
Documented in feature-catalog.md F-054, MQTTDriver/README.md, and
Communication/Handlers/README.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The SD-based boot history (logBootEvent() -> /telemetry_boot_log.json)
was write-only: nothing in the firmware ever read it back, and its
"boot" field was a locally-tallied counter (only advanced on the
NTP-gated write path) that could silently drift from the new
lifetime_boot_count added in the previous commit.
- logBootEvent() now stamps each entry with getLifetimeBootCount()
directly instead of its own total_boots tally, so the SD history's
"boot" numbers always agree with what MQTT boot_report and
telemetry.get_metrics/system.get_telemetry report. The old
total_boots JSON key is no longer written (old files may still have
it; current firmware ignores it).
- Each entry now also carries crash detail (task/pc/exc_cause/
exc_vaddr) when a coredump was captured for that boot, same shape
as the MQTT boot_report's crash object.
- New Telemetry::getBootHistory() + telemetry.get_boot_history command
actually exposes the file: optional {"limit": N} (clamped 1-200),
returns {"count", "boots": [...]}. Returns an error response (not a
crash or empty success) when there's no SD/FileManager or the file
doesn't exist yet — expected on agnus (no-SD) variants or before a
device's first NTP sync.
Full request/response contract documented in Telemetry's README and
feature-catalog.md F-053, written for direct consumption by whoever
builds the console-side retrieval UI.
Verified: pio run on vesper-std-v1 and agnus-v1 (no-SD variant).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Investigating the F-051 TelemetryTask crash surfaced two gaps: the
console only ever saw a coarse "Device reset due to fault: PANIC"
alert, none of the serial monitor's task-name/register detail; and
there was no automatic per-boot report a console could use to count
reboots without polling.
Adds Telemetry::getLifetimeBootCount() — a new NVS-backed counter
(namespace "vesper_boot") that increments once per boot, works on
every board variant (SD or not), and is reliable regardless of NTP
sync status. Deliberately kept separate from FirmwareValidator's
existing NVS boot_count (scoped to boots-since-this-OTA-slot-was-
flashed, feeds rollback-safety retry logic — left untouched) and
Telemetry's existing SD-based total_boots (repositioned as history-
only; unreliable as a counter since it's SD/NTP-dependent).
Adds Telemetry::captureCrashReport(), which reads the ESP-IDF
coredump summary (esp_core_dump_get_summary) once at begin(). The
coredump partition and CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH were
already present/enabled in this project's stock min_spiffs.csv and
precompiled Arduino-ESP32 core — no partition table or SDK config
change needed. This is the official "user mode" retrieval API, safe
to call from ordinary application code after boot; no custom panic
hook, nothing runs inside the panic handler itself. Extracts the
faulting task name, PC, and exception cause/vaddr, then erases the
dump so it's reported exactly once.
CommunicationRouter::reportBootReasonOnce() (renamed reportBootOnce())
now always publishes a consolidated "boot_report" event to
status/info on first MQTT connect — boot count, reset reason, free
heap, and crash detail when available — alongside the existing
fault-triggered status/alerts WARNING (unchanged).
lifetime_boot_count also added to telemetry.get_metrics,
system.get_telemetry, and system.get_all for on-demand polling.
Verified: pio run on both vesper-std-v1 and agnus-v1 (no-SD variant).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Logging::log() previously ran AsyncMqttClient::publish() and SD file
writes synchronously on whatever task called LOG_*. Both are
variable-depth, stack-hungry operations, and this is what let
TelemetryTask's 4096B stack silently absorb enough nested cost to
overflow its canary (see feature-catalog.md F-051).
Serial output stays synchronous (cheap, and must reflect true event
order for crash debugging). MQTT/SD-bound messages are now copied
into a fixed-size LogQueueItem (256-byte message cap, audited against
real LOG_* call sites — worst case ~150-180 chars, comfortable
margin) and handed via non-blocking xQueueSend to a lazily-created
LoggingTask, which performs the actual publish/write on its own
4096B stack. A full queue drops the line rather than blocking the
caller. Queue+task creation is spinlock-guarded against concurrent
first-callers.
This removes the stack-nesting risk for every current and future
task that logs, not just Telemetry/HealthMonitor — closing the
broader risk flagged in F-051 for OutputManager, TimeKeeper,
MQTTDriver's own tasks, and Networking's netRecon.
Verified via pio run: RAM impact negligible (62980 vs 62956 bytes).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
TelemetryTask (4096B) overflowed its stack canary because
flushRuntimeToSD() nests ArduinoJson serialization + SD write + a
LOG_DEBUG call that fans out to Logging::log()'s 512B format buffer
and publishToMqtt()'s String + AsyncMqttClient::publish() — all on
the same small stack. Bumped to 8192B.
HealthMonitor's monitoring task shares the same nested-logging
pattern (11 LOG_* calls per health check pass) and was judged next
most likely to trip, so bumped 4096B -> 6144B pre-emptively.
RAM headroom confirmed fine post-bump (19.2%, 63KB/320KB used).
Root cause, other at-risk tasks, and the planned logging-queue
redesign are documented in feature-catalog.md F-051.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
SD lines previously carried only millis(), which is meaningless when reading
a log file after the fact without knowing when boot happened. New format:
2026-07-15 | 12:28:04 | 13460843 -> 🔵 [DEBG][OutputManager] message
Date/time from time(nullptr), set by NTP (Timekeeper::syncTimeWithNTP) —
works regardless of HAS_RTC. Falls back to "unset-date | unset-time" if NTP
hasn't synced yet, rather than printing a bogus 1970 epoch date. Also added
the level icon to SD lines (previously Serial-only) for faster visual
scanning when reading a raw log file.
F-050 in the feature catalog.
Confirmed on hardware: enabling SD logging at INFO level caused a boot loop
within seconds — "Guru Meditation Error... Stack canary watchpoint triggered
(mqttConnect)". appendLogLine() was running pruneLogDirectory() (a full
SD.open() directory scan + std::vector<pair<String,size_t>> build) on every
single log write, and the first write happened to land on MQTTDriver's
3KB-stack connect task.
Fixes:
- Prune check now throttled to once per 50 writes instead of every write —
removes the expensive directory scan from the hot logging path entirely.
- Bumped mqttConnect/mqttRecon/mqttHB task stacks from 3072 to 4096 bytes
as defense-in-depth, since these tasks can still trigger SD log writes.
- Removed a LOG_INFO call inside pruneLogDirectory that could have re-entered
Logging::writeToSd() from within the SD write path itself.
Startup retry count, runtime failure count, and backup partition info were
tracked internally (NVS-persisted) but only visible via LOG_* output — not
queryable remotely. Added getStartupRetryCount()/getRuntimeFailureCount()
getters and extended firmware.status with startup_retry_count,
max_startup_retries, runtime_failure_count, max_runtime_failures,
backup_version, backup_is_valid.
F-049 in the feature catalog. Also finalizes the feature-catalog.md and
api-reference.md updates for F-045/F-046/F-047/F-048 from the two prior
commits (doc content is consolidated into this final commit rather than
split across the changeset).
Protects the broker/airtime from a chatty or misconfigured subsystem (e.g. a
per-subsystem override left at VERBOSE via log.set_mqtt). Each tag gets a
burst of 10 messages, refilling 1/second; once exhausted, further messages
from that tag are dropped until it refills.
Drops are counted, not silently discarded: the next time a rate-limited tag
publishes again, a WARNING summary line reports how many were suppressed.
Serial and SD channels are unaffected.
F-047 in the feature catalog.
SD logging was a silent no-op on fresh cards: appendLine() opened /logs/vesper.log
in FILE_APPEND without ever creating the /logs directory first. FileManager now
exposes appendLogLine(), which creates the directory, rotates to YYYY-MM-DD.log
files, and prunes oldest files once a 512KB total budget is exceeded.
LoggingHandler gains logs.list / logs.download commands (chunked, paginated) so
SD logs can be pulled off a device remotely for offline-device troubleshooting.
Telemetry now captures esp_reset_reason() at boot and classifies it as a fault
(panic/watchdog/brownout) or an expected reset (power-on/software/deep sleep).
CommunicationRouter reports it once MQTT connects: faults go to status/alerts,
expected resets go to status/info (type: boot_reason). MQTTDriver gained a
setOnConnectCallback hook to support this.
F-045, F-046, F-048 in the feature catalog.
WiFi signal strength (dBm) now included in every heartbeat message.
Docs updated: MQTTDriver README, api-reference, heartbeat feature doc.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
network.info now returns all addressing/identity fields needed by the console
network panel: ip, subnet, gateway, dns, mac, hostname, ssid, connection_type.
Previously only returned ip, gateway, dns.
network.status slimmed to pure runtime/health data: connected, ap_mode, rssi,
uptime_ms, state. Removed ip, mac, hostname, ssid, type — static facts now
belong in network.info.
Feature catalog updated with F-043 and F-044 detail sections.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- updateClockBacklight: fix key names to match wire format
(backlight/backlight_output/backlight_on/backlight_off instead of enabled/output/onTime/offTime)
- handleGetConfig: convert stored 0-based bell indices back to 1-based for hour_bell/half_bell/quarter_bell
(255 disabled sentinel passed through unchanged)
- handleGetConfig: include gmt_offset_sec, dst_offset_sec, ntp_server from TimeConfig
so clock.get_config supersedes clock.get_timezone
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Enforce 1-based output numbering throughout the entire stack. Stored values,
MQTT wire format, and console UI are all 1-based; the single 0-based conversion
happens only in OutputManager::getPhysicalOutput(). Fixed createDefaultBellConfig
(was setting identity 0-based map instead of 0=disabled), updateBellDurations and
updateBellOutputs (support both v2 0/1 and v1 b1/b2 keys), all call
sites that bypassed getPhysicalOutput, and fireClockOutput conversion.
New commands:
- relay.set_config: combined durations + outputs in one round trip (F-040)
- clock.set_config: enabled/c1/c2/pulse_duration/pause_duration in one call (F-042)
- clock.set_alerts_config: alert type, bells, and silence windows in one call (F-042)
Feature catalog updated with F-040, F-041, F-042 detail sections.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
StaticJsonDocument<8192> in logBootEvent() was allocating 8KB on the stack of
ntpSyncTask, which only had 3072 bytes. Stack overflow silently corrupted the
heap, triggering assert in multi_heap_free immediately after the boot log write.
Fix: switch logBootEvent to heap-allocated JsonDocument (ArduinoJson v7 default).
Also bumped ntpSyncTask stack from 3072 → 5120 bytes for NTP + SD write headroom.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
relay.test_bell — fire bell N using configured output + duration, non-blocking
relay.test_batch — fire a list of bells simultaneously (single melody step)
clock.test_c1 — fire C1 (ODD) clock output using pulse_duration
clock.test_c2 — fire C2 (EVEN) clock output using pulse_duration
All four bypass bellsEnabled guard intentionally — test commands always fire.
ClockHandler now accepts an optional OutputManager* for the test commands.
CommunicationRouter passes _outputManager to ClockHandler.
Feature catalog updated: F-038 and F-039 added.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds full bidirectional remote control across all major subsystems,
establishing the device as the single source of truth for all settings.
New firmware features (F-029 to F-037):
- bells.enable / bells.disable: master ON/OFF for all playback and clock
alerts (relay.test_output intentionally unaffected)
- telemetry.set_guard_enabled: enable/disable thermal protection at runtime
without touching thresholds
- telemetry.set_max_loads: set bellMaxLoad per-bell or globally via command
- Device runtime tracking: lifetime seconds flushed to SD every 10 min,
boot log (up to 200 entries, rotating) written after first NTP sync
- Total playback counter persisted to SD, increments on every play()
- telemetry.get_metrics / telemetry.reset_metrics: new aggregate read + reset
- system.get_config (replaces system.get_settings, old name still accepted),
system.get_all (everything in one call), system.get_telemetry
- log.get_config, mqtt.get_config, bells.get_config: new getters for
previously write-only subsystems
- network.status now includes ssid, mac, hostname
- BellsHandler: new handler registered on CommandBus
- LegacyAdapter updated with all new command mappings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Serial default VERBOSE→INFO, MQTT default NONE→WARNING, SD NONE→WARNING.
Per-subsystem MQTT caps added in CommunicationRouter: BellEngine/
OutputManager/HealthMonitor/ConfigManager at WARNING to silence per-note
and per-poll spam; Player/Telemetry/OTAManager at INFO to keep state
transitions visible.
Remove early Logging::setLevel() call in main.cpp — CommunicationRouter
applies all three channels once the MQTT callback is wired. Loop heartbeat
downgraded DEBUG→VERBOSE. HealthMonitor polling noise (skipping/performing
lines) removed; subsystem status and completion lines VERBOSE→DEBUG.
FirmwareValidator boot-path checks VERBOSE→INFO (one-shot, worth seeing).
ConfigManager isHealthy() false-branches and NVS read trace VERBOSE→DEBUG.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nvsReadString previously ignored the error code from nvs_get_str and passed
an uninitialised or garbage buffer to String() on failure. Now returns an
empty string if the read fails.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ESP32 mbedTLS TLS handshake requires ~40KB of contiguous heap, which is
not reliably available after runtime heap fragmentation. Melody .bsm files
carry no credentials so plain HTTP is acceptable.
Removed: WiFiClientSecure, esp_task_wdt WDT disable/re-enable around the GET,
SSL heap guard, and all secureClient cleanup paths. HTTPS URLs are now rejected
immediately with a clear error log (F-027).
Also fixed: ensureDirectoryExists now strips trailing slashes instead of
appending one — SD.exists() returns false for directories when a trailing
slash is present.
Docs: feature-catalog.md F-027 added, FileManager README updated.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
F-024 — V1 single-segment fix: when continuous_loop=false, total_duration is
now always overwritten with segment_duration regardless of what the client
sent. Sending total_duration:0 explicitly no longer bypasses the stop timer.
The play-once fallback in onMelodyLoopCompleted is tightened to only fire when
both segment_duration and total_duration are zero.
F-025 — V2 command namespace: PlaybackHandler now registers playback.play and
playback.stop instead of the old root-level playback command. LegacyAdapter
maps V1 { cmd:playback, action:play/stop } to the new V2 names so all deployed
clients keep working without changes.
F-026 — V2 mode field: setMelodyAttributes accepts a mode string (single /
timed / interval / infinite) with a duration field, replacing the ambiguous
continuous_loop + segment_duration + total_duration triplet. V1 timing fields
are still parsed when mode is absent.
Docs: feature-catalog.md entries F-024, F-025, F-026 added.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Establishes the production workflow:
- docs/features/feature-catalog.md: index + detail entries for all 23
known features (F-001 through F-023), seeded from git history and
current uncommitted changes
- docs/README.md: replaced loose notes with enforced Working Rules
section (feature catalog mandate, commit discipline, session startup)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- bootOtaCheck() runs at top of setup() before any task/timer; streams
firmware to flash on update, reboots, otherwise returns immediately
- New bespoke-rs485-v1 build env + Rs485OutputManager for Waveshare 16CH
Modbus RTU relay; vesper.hpp renamed vesper-std.hpp, env renamed accordingly
- Player: permanent melodyDownloadTaskFn task; fast path (built-in/SD) before
async download; uid accepted as alias for pid
- CommunicationRouter: HAS_UART guards throughout so UART transport compiles
out when Serial2 is claimed by Modbus
- OTAManager: stack 8KB→16KB, pinned to Core 1, HTTPClient recreated per
retry, download timeout 30s→60s
- FileManager: heap guard before SSL alloc; watchdog log cleanup
- ConfigManager: OTA fallback URLs http (no TLS for firmware servers)
- agnus.hpp: HAS_UART 1 added
- provisioning/nvs_agnus_lab_device.csv added
- Version bumped to v2.0.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add inline documentation for all src/ subsystems covering purpose,
responsibilities, public API, and usage notes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Version.hpp: extract FW_VERSION from main.cpp into shared header
- OTAManager: replace uint16_t version with SemVer struct; update API URLs
to new FastAPI backend (/api/firmware/{hw_type}/{channel}/latest);
add postDownloadTelemetry() and postFlashTelemetry() for fleet visibility
- ConfigManager: remove fwVersion from DeviceConfig (always read from
FW_VERSION constant); saveDeviceConfig/loadDeviceConfig are now no-ops;
fallbackServerUrl replaced with fallbackServerUrls[2] array
- HealthMonitor: add AlertCallback + setAlertCallback() firing on state
transitions (including CLEARED on recovery)
- CommunicationRouter: wire HealthMonitor alert callback on begin();
add publishAlert() and publishInfo() for MQTT status topics
- MQTTDriver: add _alertsTopic + _infoTopic; add publishDirect() for
absolute topic publishing; migrate heartbeat to JsonDocument
- ResponseBuilder, ClientManager, BellEngine: StaticJsonDocument /
DynamicJsonDocument → JsonDocument; remove dead notifyBellsFired()
- docs: reorganise into architecture/, dev/, features/, reference/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Delete dead code: CommandHandler (700-line God Class) and
HTTPRequestHandler — both replaced by new architecture in Stage 4
- Create Drivers/ group for the three low-level protocol drivers,
mirroring the Transport/ pattern:
MQTTAsyncClient → Drivers/MQTTDriver (class: MQTTDriver)
WebSocketServer → Drivers/WebSocketDriver (class: WebSocketDriver)
UARTCommandHandler → Drivers/UARTDriver (class: UARTDriver)
- Update all includes and type references across CommunicationRouter,
all three Transport wrappers, and MQTTHandler
- Add -std=gnu++14 + build_unflags to platformio.ini so std::make_unique
compiles on ESP32 (required by CommunicationRouter::registerHandlers)
Build: passing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds the complete set of v2 command handlers. Old CommandHandler is
untouched — handlers are standalone and not yet wired to anything.
Handlers added:
PlaybackHandler — playback (1 dependency)
LoggingHandler — log.set_serial/sd/mqtt
FileHandler — files.list/list_builtin/download/delete
TelemetryHandler — telemetry.get_strikes/reset_strikes/get_loads
RelayHandler — relay.set_durations/set_outputs/get_config/test_output
FirmwareHandler — firmware.status/commit/rollback + ota.update/custom
NetworkHandler — network.info/status/set_config
MQTTHandler — mqtt.enable/disable
SystemHandler — ping/identify + system.* commands (8 total)
ClockHandler — 16 clock.* commands
Notable fixes vs. original CommandHandler:
- clock.set_timings now sets pulseDuration/pauseDuration correctly
(original called updateClockOutputs — was a bug)
- system.restart uses a deferred FreeRTOS task (no blocking delay)
- relay.test_output safety-gated: player must be fully stopped
- Timekeeper class name (lowercase k) corrected throughout
Two compile-time fixes applied during build:
- JsonVariantConst → const_cast<JsonDocument&>().as<JsonVariant>()
(ConfigManager methods take non-const JsonVariant)
- class TimeKeeper → class Timekeeper (actual class name in header)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds the core data structures and interfaces for the comms refactor.
No behaviour change — old CommandHandler is completely untouched.
New files:
CommandEnvelope.hpp — universal message wrapper (transport + command + reply lambda)
CommandResult.hpp — standardised return type with ok/err/info factories
ICommandHandler.hpp — interface every domain handler will implement
ITransport.hpp — interface every transport layer will implement
CommandBus.hpp/.cpp — registry + dispatcher (std::map, O(log n) lookup)
Two minor corrections vs. plan:
std::unordered_map → std::map (Arduino String has no std::hash)
LOG_WARN → LOG_WARNING (codebase macro name)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces Arduino IDE with PlatformIO as the build system. Entry point
moved from vesper.ino to src/main.cpp. All library dependencies are now
declared in platformio.ini and downloaded automatically via lib_deps.
Board: Kincony KC868-A6 (ESP32-S3, 4MB flash) → env:vesper-v1
Future variants Vesper+ and Vesper Pro are pre-configured but commented out.
Compatibility fixes applied for this framework version:
- Removed ETH.h dependency (Ethernet was disabled in v138)
- Watchdog init updated to IDF v4 API (esp_task_wdt_init signature)
- ETH.linkUp() check removed from OTAManager
Also adds .pio/ to .gitignore and commits the manufacturing plan docs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Refactored logging system to require a TAG as first argument on all
LOG_* macros, enabling per-subsystem log filtering and cleaner output.
Each subsystem now defines its own TAG (e.g. "BellEngine", "Player").
Also overhauled Logging.hpp/cpp with improved level control and output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added Websocket Support
Added Universal Message Handling for both MQTT and WS
Added Timekeeper Class, that handles Physical Clock and Scheduling
Added Bell Assignment Settings, Note to Bell mapping
A JSON message can now be received on:
'vesper/DEV_ID/control/addSchedule"
Each message, must hold a "file" and "data".
The file is the month's name in 3 letter mode (eg jan, feb, mar)
The data is an entry for each day of the month.
Each day can be an array containing multiple items.
The setting is saved on a file in:
/settings/relayTimings.json
Then during bootup, it's read and restored.
Settings can be set via MQTT command on Topic:
vesoer/*dev-id*/control/settings/relayTimers
using a json format.
{ "b1":50, b2...}
where b1 is Bell 1, b2 Bell 2, etc..
A new Melody Struct was added containing the melody's main attributes.
The MQTT Topic Subscriptions were updated to a more proper format.
Also added DEV_ID that corresponds to the device's ID or Serial Number.
Chnaged the Deserialization function to actually adjust the MelodyStruct's attributes.
Added basic play/stop functionality.