feat: multi-board HAL guards, RFRemote subsystem, Player/OTA improvements

Multi-board variant support:
- variants/vesper.hpp: enable HAS_RF=1, define RF_RX_PIN=22
- variants/agnus.hpp: enable HAS_RF=1, RF_RX_PIN=22, correct HAS_RTC=0
- main.cpp, Player, HealthMonitor, OTAManager, ConfigManager: wrap all
  RTC/SD/RF-dependent code in #if HAS_RTC / HAS_SD_CARD / HAS_RF guards
  so Agnus builds cleanly without those peripherals

RFRemote subsystem (new):
- src/RFRemote/: RF receiver driver (GPIO RF_RX_PIN) + command handler
- Registered with HealthMonitor and CommunicationRouter when HAS_RF=1

Player improvements:
- uid -> pid rename throughout (Player, BuiltInMelodies, api-reference)
- loadMelodyInRAM() now returns bool
- playerControlTaskFn task added — defers stop/pause/resume out of
  timer callback (Tmr Svc) to avoid stack overflows
- setDependencies() accepts nullptr FileManager for SD-less boards

OTAManager:
- Consume download_url from server metadata response instead of
  constructing firmware path locally
- HTTP redirect following enabled (setFollowRedirects)
- HAS_RTC guards on TimeKeeper references

platformio.ini:
- Add rc-switch library for RF remote support
- Remove BOARD_TYPE/BOARD_NAME/BOARD_VERSION flags (moved to variant headers)
- MQTT_SECRET placeholders only — no secrets in source

Docs:
- docs/architecture/codebase-refactor-plan.md: new migration strategy doc
- docs/reference/api-reference.md: updated for pid, note_assignments, download_url
- Remove stale docs: ota-telemetry-api.md, platformio-commands.md, firmware-variants.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 17:02:01 +02:00
co-authored by Claude Sonnet 4.6
parent 37b65cc15a
commit a4d071d5d5
31 changed files with 2431 additions and 891 deletions
+28 -2
View File
@@ -11,12 +11,17 @@
#include "../OutputManager/OutputManager.hpp"
#include "../Communication/CommunicationRouter/CommunicationRouter.hpp"
#include "../Player/Player.hpp"
#if HAS_RTC
#include "../TimeKeeper/TimeKeeper.hpp"
#endif
#include "../Telemetry/Telemetry.hpp"
#include "../OTAManager/OTAManager.hpp"
#include "../Networking/Networking.hpp"
#include "../ConfigManager/ConfigManager.hpp"
#include "../FileManager/FileManager.hpp"
#if HAS_RF
#include "../RFRemote/RFRemote.hpp"
#endif
#include <ArduinoJson.h>
HealthMonitor::HealthMonitor() {
@@ -68,7 +73,9 @@ void HealthMonitor::initializeSubsystemHealth() {
_subsystemHealth["FileManager"] = SubsystemHealth("FileManager", true);
_subsystemHealth["Communication"] = SubsystemHealth("Communication", false); // Non-critical
_subsystemHealth["Player"] = SubsystemHealth("Player", true);
#if HAS_RTC
_subsystemHealth["TimeKeeper"] = SubsystemHealth("TimeKeeper", false); // Non-critical
#endif
_subsystemHealth["Telemetry"] = SubsystemHealth("Telemetry", false); // Non-critical
_subsystemHealth["OTAManager"] = SubsystemHealth("OTAManager", false); // Non-critical
_subsystemHealth["Networking"] = SubsystemHealth("Networking", false); // Non-critical
@@ -173,14 +180,16 @@ HealthStatus HealthMonitor::performFullHealthCheck() {
checkedSystems++;
}
#if HAS_RTC
// Check TimeKeeper
if (_timeKeeper) {
bool healthy = _timeKeeper->isHealthy();
updateSubsystemHealth("TimeKeeper",
updateSubsystemHealth("TimeKeeper",
healthy ? HealthStatus::HEALTHY : HealthStatus::WARNING,
healthy ? "" : "TimeKeeper health check failed");
checkedSystems++;
}
#endif
// Check Telemetry
if (_telemetry) {
@@ -226,7 +235,18 @@ HealthStatus HealthMonitor::performFullHealthCheck() {
healthy ? "" : "FileManager health check failed");
checkedSystems++;
}
#if HAS_RF
// Check RFRemote — non-critical (system functions without RF)
if (_rfRemote) {
bool healthy = _rfRemote->isHealthy();
updateSubsystemHealth("RFRemote",
healthy ? HealthStatus::HEALTHY : HealthStatus::WARNING,
healthy ? "" : "RFRemote not initialized");
checkedSystems++;
}
#endif
unsigned long elapsed = millis() - startTime;
LOG_VERBOSE(TAG, "🔍 Health check completed: %d systems in %lums", checkedSystems, elapsed);
@@ -252,8 +272,10 @@ HealthStatus HealthMonitor::checkSubsystemHealth(const String& subsystemName) {
healthy = _communication->isHealthy();
} else if (subsystemName == "Player" && _player) {
healthy = _player->isHealthy();
#if HAS_RTC
} else if (subsystemName == "TimeKeeper" && _timeKeeper) {
healthy = _timeKeeper->isHealthy();
#endif
} else if (subsystemName == "Telemetry" && _telemetry) {
healthy = _telemetry->isHealthy();
} else if (subsystemName == "OTAManager" && _otaManager) {
@@ -264,6 +286,10 @@ HealthStatus HealthMonitor::checkSubsystemHealth(const String& subsystemName) {
healthy = _configManager->isHealthy();
} else if (subsystemName == "FileManager" && _fileManager) {
healthy = _fileManager->isHealthy();
#if HAS_RF
} else if (subsystemName == "RFRemote" && _rfRemote) {
healthy = _rfRemote->isHealthy();
#endif
} else {
LOG_WARNING(TAG, "🔌 Subsystem %s not connected to health monitor", subsystemName.c_str());
return HealthStatus::FAILED;