feat: HAL variant system, OTA improvements, NVS migration scaffold

- Add variants/vesper.hpp and variants/agnus.hpp with HAS_SD_CARD, HAS_RTC,
  HAS_PCF8574, OUTPUT_COUNT_MAX, HW_FAMILY capability flags
- Add agnus-v1 and agnus-mini-v1 PlatformIO environments with -include injection
- Add src/NvsMigration/ scaffold for future NVS schema versioning
- FirmwareHandler: OTA flow improvements and header updates
- OTAManager: FastAPI integration, semver handling improvements
- ConfigManager: refactoring groundwork for NVS-only variant support
- CommunicationRouter: minor fix
- provisioning/nvs_lab_device.csv: fix hw_type to VS, update device id fields
- docs/dev/ota-telemetry-api.md: update API spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 11:39:11 +02:00
co-authored by Claude Sonnet 4.6
parent d4d8b1c380
commit 37b65cc15a
14 changed files with 561 additions and 96 deletions
+16 -8
View File
@@ -44,9 +44,9 @@ public:
* fwVersion is NOT stored — it is always read from the compiled FW_VERSION constant.
*/
struct DeviceConfig {
String deviceUID = ""; // 🏷️ Factory-set UID (NVS) - NO DEFAULT
String hwType = ""; // 🔧 Factory-set hardware type (NVS) - NO DEFAULT
String hwVersion = ""; // 📐 Factory-set hardware revision (NVS) - NO DEFAULT
String serial = ""; // 🏷️ Factory-set serial number (NVS key: "serial") - NO DEFAULT
String hwFamily = ""; // 🔧 Factory-set hardware family (NVS key: "hw_family") - NO DEFAULT e.g. "vesper-standard"
String hwRevision = ""; // 📐 Factory-set hw revision (NVS key: "hw_revision") - NO DEFAULT e.g. "1.0"
};
/**
@@ -220,7 +220,8 @@ public:
uint8_t serialLogLevel = 5;
uint8_t sdLogLevel = 0;
uint8_t mqttLogLevel = 0;
bool mqttEnabled = true; // MQTT enabled by default
bool mqttEnabled = true; // MQTT enabled by default
String otaChannel = "stable"; // OTA release channel: "stable" | "beta" | "development"
};
private:
@@ -313,9 +314,14 @@ public:
// Device identity methods (READ-ONLY - factory set via separate factory firmware)
// These values are loaded ONCE at boot from NVS and kept in RAM
// Production firmware CANNOT modify device identity
String getDeviceUID() const { return deviceConfig.deviceUID; }
String getHwType() const { return deviceConfig.hwType; }
String getHwVersion() const { return deviceConfig.hwVersion; }
String getSerial() const { return deviceConfig.serial; }
String getHwFamily() const { return deviceConfig.hwFamily; }
String getHwRevision() const { return deviceConfig.hwRevision; }
// Deprecated aliases — kept temporarily to avoid widespread call-site breakage
// TODO: remove these once all callers are updated
String getDeviceUID() const { return deviceConfig.serial; }
String getHwType() const { return deviceConfig.hwFamily; }
String getHwVersion() const { return deviceConfig.hwRevision; }
// Firmware version is owned by the binary — always returns the compiled-in constant.
String getFwVersion() const { return FW_VERSION; }
// No-op: version is compiled in, not stored. Kept for call-site compatibility.
@@ -418,6 +424,8 @@ public:
uint8_t getMqttLogLevel() const { return generalConfig.mqttLogLevel; }
void setMqttEnabled(bool enabled) { generalConfig.mqttEnabled = enabled; mqttConfig.enabled = enabled; }
bool getMqttEnabled() const { return generalConfig.mqttEnabled; }
String getOtaChannel() const { return generalConfig.otaChannel; }
void setOtaChannel(const String& channel) { generalConfig.otaChannel = channel; }
bool loadGeneralConfig();
bool saveGeneralConfig();
@@ -432,7 +440,7 @@ public:
void updateRealTimeFromCommand(JsonVariant doc);
void updatePhysicalClockTimeFromCommand(JsonVariant doc);
void saveFileToSD(const char* dirPath, const char* filename, const char* data);
String getHardwareVariant() const { return deviceConfig.hwType; }
String getHardwareVariant() const { return deviceConfig.hwFamily; }
bool loadDeviceConfig();
bool saveDeviceConfig();
bool loadUpdateServers();