feat: semver versioning, FastAPI OTA integration, health alerts via MQTT

- 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>
This commit is contained in:
2026-03-14 22:15:27 +02:00
co-authored by Claude Sonnet 4.6
parent c3dc0a79bc
commit d4bd990e53
33 changed files with 1874 additions and 301 deletions
+2 -39
View File
@@ -56,33 +56,7 @@
/*
* ═══════════════════════════════════════════════════════════════════════════════
* 📋 VERSION CONFIGURATION
* ═══════════════════════════════════════════════════════════════════════════════
* 📅 DATE: 2025-10-10
* 👨‍💻 AUTHOR: BellSystems bonamin
*/
#define FW_VERSION "154"
/*
* ═══════════════════════════════════════════════════════════════════════════════
* 📅 VERSION HISTORY:
* NOTE: Versions are now stored as integers (v1.3 = 130)
* ═══════════════════════════════════════════════════════════════════════════════
* v0.1 (100) - Vesper Launch Beta
* v1.2 (120) - Added Log Level Configuration via App/MQTT
* v1.3 (130) - Added Telemetry Reports to App, Various Playback Fixes
* v137 - Made OTA and MQTT delays Async
* v138 - Removed Ethernet, added default WiFi creds (Mikrotik AP) and fixed various Clock issues
* v140 - Changed FW Updates to Direct-to-Flash and added manual update functionality with version check
* v151 - Fixed Clock Alerts not running properly
* v152 - Fix RTC Time Reports, added sync_time_to_LCD functionality
* v153 - Fix Infinite Loop Bug and Melody Download crashes.
* ═══════════════════════════════════════════════════════════════════════════════
*/
// Firmware version is defined in Version.hpp (FW_VERSION)
@@ -143,6 +117,7 @@
#include "HealthMonitor/HealthMonitor.hpp"
#include "FirmwareValidator/FirmwareValidator.hpp"
#include "InputManager/InputManager.hpp"
#include "Version.hpp"
#define TAG "Main"
@@ -257,18 +232,6 @@ void setup()
// Update firmware version (this is the ONLY identity field that can be set)
// 🔥 MIGRATION: Convert old float-style version to integer format
String currentVersion = configManager.getFwVersion();
if (currentVersion.indexOf('.') != -1) {
// Old format detected (e.g., "1.3"), convert to integer ("130")
float versionFloat = currentVersion.toFloat();
uint16_t versionInt = (uint16_t)(versionFloat * 100.0f);
configManager.setFwVersion(String(versionInt));
configManager.saveDeviceConfig();
LOG_INFO(TAG, "⚠️ Migrated version format: %s -> %u", currentVersion.c_str(), versionInt);
}
configManager.setFwVersion(FW_VERSION);
LOG_INFO(TAG, "Firmware version: %s", FW_VERSION);