Inject commit hash to FW, show on frontend

This commit is contained in:
2026-03-01 21:38:51 +01:00
parent a3b5425d0f
commit 8cb92f9914
8 changed files with 110 additions and 2 deletions

View File

@@ -7,10 +7,15 @@ using namespace Adafruit_LittleFS_Namespace;
extern File cfgFile;
// ─── BLE Config Service objects ───────────────────────────────────────────────
#ifndef GIT_HASH
#define GIT_HASH "unknown"
#endif
#ifdef FEATURE_CONFIG_SERVICE
BLEService cfgService (0x1234);
BLECharacteristic cfgBlob (0x1235); // ConfigBlob R/W 20 bytes
BLECharacteristic cfgCommand (0x1236); // Command W 1 byte
BLECharacteristic cfgGitHash (0x1239); // GitHash R 8 bytes (7-char hash + NUL)
#ifdef FEATURE_TELEMETRY
BLECharacteristic cfgTelemetry(0x1237); // Telemetry R/N 24 bytes
#endif
@@ -148,6 +153,14 @@ void setupConfigService() {
cfgCommand.setWriteCallback(onCommandWrite);
cfgCommand.begin();
// Git hash — 8-byte fixed field (7 hex chars + NUL), read-only
cfgGitHash.setProperties(CHR_PROPS_READ);
cfgGitHash.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
cfgGitHash.setFixedLen(8);
cfgGitHash.begin();
{ uint8_t buf[8] = {}; strncpy((char*)buf, GIT_HASH, 7); cfgGitHash.write(buf, 8); }
Serial.print("[BUILD] git="); Serial.println(GIT_HASH);
#ifdef FEATURE_TELEMETRY
cfgTelemetry.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY);
cfgTelemetry.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);