diff --git a/lib/MycilaAppInfo/MycilaAppInfo.cpp b/lib/MycilaAppInfo/MycilaAppInfo.cpp index f45bed32..de2e03c6 100644 --- a/lib/MycilaAppInfo/MycilaAppInfo.cpp +++ b/lib/MycilaAppInfo/MycilaAppInfo.cpp @@ -34,6 +34,7 @@ extern const char* __COMPILED_BUILD_BRANCH__; extern const char* __COMPILED_BUILD_HASH__; extern const char* __COMPILED_BUILD_NAME__; extern const char* __COMPILED_BUILD_TIMESTAMP__; +extern const char* __COMPILED_BUILD_BOARD__; Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()), name(APP_NAME), @@ -46,6 +47,7 @@ Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()), buildBranch(__COMPILED_BUILD_BRANCH__), buildHash(__COMPILED_BUILD_HASH__), buildDate(__COMPILED_BUILD_TIMESTAMP__), + buildBoard(__COMPILED_BUILD_BOARD__), defaultHostname(Mycila::string::toLowerCase(name + "-" + id)), defaultMqttClientId(Mycila::string::toLowerCase(name + "_" + id)), defaultSSID(name + "-" + id), @@ -53,6 +55,7 @@ Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()), trial(firmware.find("trial") != std::string::npos) {} void Mycila::AppInfoClass::toJson(const JsonObject& root) const { + root["build_board"] = buildBoard; root["build_date"] = buildDate; root["build_hash"] = buildHash; root["debug"] = debug; diff --git a/lib/MycilaAppInfo/MycilaAppInfo.h b/lib/MycilaAppInfo/MycilaAppInfo.h index 05903fc9..680f50d4 100644 --- a/lib/MycilaAppInfo/MycilaAppInfo.h +++ b/lib/MycilaAppInfo/MycilaAppInfo.h @@ -27,6 +27,7 @@ namespace Mycila { const std::string buildBranch; const std::string buildHash; const std::string buildDate; + const std::string buildBoard; const std::string defaultHostname; const std::string defaultMqttClientId; const std::string defaultSSID; diff --git a/tools/version.py b/tools/version.py index 6eeb0a59..9666f7d2 100644 --- a/tools/version.py +++ b/tools/version.py @@ -9,9 +9,7 @@ def do_main(): # hash - ret = subprocess.run( - ["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, text=True, check=False - ) # Uses any tags + ret = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, text=True, check=False) # Uses any tags full_hash = ret.stdout.strip() short_hash = full_hash[:7] @@ -66,16 +64,14 @@ def do_main(): f'const char* __COMPILED_BUILD_HASH__ = "{short_hash}";\n' f'const char* __COMPILED_BUILD_NAME__ = "{env["PIOENV"]}";\n' f'const char* __COMPILED_BUILD_TIMESTAMP__ = "{datetime.now(timezone.utc).isoformat()}";\n' + f'const char* __COMPILED_BUILD_BOARD__ = "{env.get("BOARD")}";\n' ) - sys.stderr.write( - f"version.py: APP_VERSION: {version[1:] if tagPattern.match(version) else version}\n" - ) + sys.stderr.write(f"version.py: APP_VERSION: {version[1:] if tagPattern.match(version) else version}\n") sys.stderr.write(f"version.py: BUILD_BRANCH: {branch}\n") sys.stderr.write(f"version.py: BUILD_HASH: {short_hash}\n") sys.stderr.write(f"version.py: BUILD_NAME: {env['PIOENV']}\n") - sys.stderr.write( - f"version.py: BUILD_TIMESTAMP: {datetime.now(timezone.utc).isoformat()}\n" - ) + sys.stderr.write(f"version.py: BUILD_TIMESTAMP: {datetime.now(timezone.utc).isoformat()}\n") + sys.stderr.write(f"version.py: BUILD_BOARD: {env.get('BOARD')}\n") env.AppendUnique(PIOBUILDFILES=[constantFile])