feat: boot-phase OTA, RS485 variant, async melody download, HAL guards

- 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>
This commit is contained in:
2026-04-18 20:48:26 +03:00
co-authored by Claude Sonnet 4.6
parent a4d071d5d5
commit ed1123283b
19 changed files with 871 additions and 72 deletions
@@ -60,13 +60,17 @@ CommunicationRouter::CommunicationRouter(ConfigManager& configManager,
, _mqttClient(configManager, networking)
, _clientManager()
, _wsServer(webSocket, _clientManager)
#if HAS_UART
, _uartHandler()
#endif
// New architecture — transports reference the bus
, _bus()
, _mqttTransport(_mqttClient, _bus)
, _wsTransport(_wsServer, _bus)
, _httpTransport(server, _bus, configManager)
#if HAS_UART
, _uartTransport(_uartHandler, _bus)
#endif
, _webServerTransport(server, _bus, configManager, networking)
{}
@@ -122,15 +126,19 @@ void CommunicationRouter::begin() {
LOG_INFO(TAG, "WebServer transport initialised (/settings)");
// ── UART ─────────────────────────────────────────────────────────────────
#if HAS_UART
LOG_INFO(TAG, "Setting up UART transport...");
_uartTransport.begin();
LOG_INFO(TAG, "UART transport initialised");
#endif
// ── Register transports with the bus ─────────────────────────────────────
_bus.addTransport(&_mqttTransport);
_bus.addTransport(&_wsTransport);
_bus.addTransport(&_httpTransport);
#if HAS_UART
_bus.addTransport(&_uartTransport);
#endif
_bus.addTransport(&_webServerTransport);
// ── Register all domain handlers ─────────────────────────────────────────
@@ -154,7 +162,9 @@ void CommunicationRouter::begin() {
// ─────────────────────────────────────────────────────────────────────────────
void CommunicationRouter::loop() {
#if HAS_UART
_uartTransport.loop();
#endif
}
// ─────────────────────────────────────────────────────────────────────────────
@@ -21,7 +21,9 @@
// Underlying protocol drivers (still owned here)
#include "../Drivers/MQTTDriver/MQTTDriver.hpp"
#include "../Drivers/WebSocketDriver/WebSocketDriver.hpp"
#if HAS_UART
#include "../Drivers/UARTDriver/UARTDriver.hpp"
#endif
#include "../../ClientManager/ClientManager.hpp"
// New architecture
@@ -29,7 +31,9 @@
#include "../Transport/MQTTTransport/MQTTTransport.hpp"
#include "../Transport/WebSocketTransport/WebSocketTransport.hpp"
#include "../Transport/HTTPTransport/HTTPTransport.hpp"
#if HAS_UART
#include "../Transport/UARTTransport/UARTTransport.hpp"
#endif
#include "../Transport/WebServerTransport/WebServerTransport.hpp"
// Forward declarations — resolved in .cpp
@@ -91,7 +95,9 @@ public:
// Legacy accessors used by other subsystems
MQTTDriver& getMQTTClient() { return _mqttClient; }
#if HAS_UART
UARTDriver& getUARTHandler() { return _uartHandler; }
#endif
// Broadcast helpers — called by BellEngine, Player, Telemetry, etc.
void broadcastStatus(const String& statusMessage);
@@ -158,14 +164,18 @@ private:
MQTTDriver _mqttClient;
ClientManager _clientManager;
WebSocketDriver _wsServer;
#if HAS_UART
UARTDriver _uartHandler;
#endif
// ── New architecture (owned) ────────────────────────────────────────────
CommandBus _bus;
MQTTTransport _mqttTransport;
WebSocketTransport _wsTransport;
HTTPTransport _httpTransport;
#if HAS_UART
UARTTransport _uartTransport;
#endif
WebServerTransport _webServerTransport;
// Register all domain handlers onto the bus.