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
+26 -5
View File
@@ -134,8 +134,8 @@ public:
*/
struct UpdateConfig {
String fallbackServerUrls[2] = {
"http://firmware.bellsystems.net", // 🥇 Primary fallback
"http://firmware.bonamin.space" // 🥈 Secondary fallback
"https://firmware.bellsystems.net", // 🥇 Primary fallback
"https://firmware.bonamin.space" // 🥈 Secondary fallback
};
int timeout = 10000; // ⏱️ Universal timeout - OK as is
int retries = 3; // 🔄 Universal retries - OK as is
@@ -272,11 +272,20 @@ private:
bool ensureSDCard();
void createDefaultBellConfig();
// NVS management (READ-ONLY for factory-set device identity)
// NVS management
bool initializeNVS();
bool loadDeviceIdentityFromNVS();
String readNVSString(const char* key, const String& defaultValue);
// REMOVED: saveDeviceIdentityToNVS() and writeNVSString() - Production firmware is READ-ONLY
uint8_t readNVSU8(const char* key, uint8_t defaultValue);
uint16_t readNVSU16(const char* key, uint16_t defaultValue);
bool readNVSBool(const char* key, bool defaultValue);
// NVS write helpers — used by Agnus (no SD card) to persist user config
bool writeNVSString(const char* key, const String& value);
bool writeNVSU8(const char* key, uint8_t value);
bool writeNVSU16(const char* key, uint16_t value);
bool writeNVSBool(const char* key, bool value);
bool commitNVS();
String computeMqttPassword(const String& uid);
@@ -339,16 +348,24 @@ public:
// Network configuration persistence
bool loadNetworkConfig();
bool saveNetworkConfig();
#if !HAS_SD_CARD
bool loadNetworkConfigFromNVS();
bool saveNetworkConfigToNVS();
#endif
// Time configuration persistence
bool loadTimeConfig();
bool saveTimeConfig();
// Bell and clock configuration methods (unchanged)
// Bell and clock configuration methods
bool loadBellDurations();
bool saveBellDurations();
bool loadBellOutputs();
bool saveBellOutputs();
#if !HAS_SD_CARD
bool loadBellConfigFromNVS();
bool saveBellConfigToNVS();
#endif
void updateBellDurations(JsonVariant doc);
void updateBellOutputs(JsonVariant doc);
uint16_t getBellDuration(uint8_t bellIndex) const;
@@ -428,6 +445,10 @@ public:
void setOtaChannel(const String& channel) { generalConfig.otaChannel = channel; }
bool loadGeneralConfig();
bool saveGeneralConfig();
#if !HAS_SD_CARD
bool loadGeneralConfigFromNVS();
bool saveGeneralConfigToNVS();
#endif
// Other methods (unchanged)
void updateClockAlerts(JsonVariant doc);