diff --git a/pio-scripts/auto_firmware_version.py b/pio-scripts/auto_firmware_version.py index 2f15cc95..281899c7 100644 --- a/pio-scripts/auto_firmware_version.py +++ b/pio-scripts/auto_firmware_version.py @@ -18,10 +18,14 @@ from dulwich import porcelain def get_firmware_specifier_build_flag(): try: build_version = porcelain.describe('.') # '.' refers to the repository root dir + branch_name = porcelain.active_branch('.').decode('utf-8') except: build_version = "g0000000" - build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version + "\\\"" + branch_name = "" + build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version + "\\\" " + build_flag += "-D AUTO_GIT_BRANCH=\\\"" + branch_name + "\\\"" print ("Firmware Revision: " + build_version) + print ("Firmware build on branch: " + branch_name) return (build_flag) env.Append( diff --git a/src/WebApi_sysstatus.cpp b/src/WebApi_sysstatus.cpp index fbb392d9..f98b6147 100644 --- a/src/WebApi_sysstatus.cpp +++ b/src/WebApi_sysstatus.cpp @@ -16,6 +16,10 @@ #define AUTO_GIT_HASH "" #endif +#ifndef AUTO_GIT_BRANCH +#define AUTO_GIT_BRANCH "" +#endif + void WebApiSysstatusClass::init(AsyncWebServer* server) { using std::placeholders::_1; @@ -67,6 +71,7 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request) snprintf(version, sizeof(version), "%d.%d.%d", CONFIG_VERSION >> 24 & 0xff, CONFIG_VERSION >> 16 & 0xff, CONFIG_VERSION >> 8 & 0xff); root["config_version"] = version; root["git_hash"] = AUTO_GIT_HASH; + root["git_branch"] = AUTO_GIT_BRANCH; root["pioenv"] = PIOENV; root["uptime"] = esp_timer_get_time() / 1000000; diff --git a/webapp/src/components/FirmwareInfo.vue b/webapp/src/components/FirmwareInfo.vue index 0ff75140..abf65d85 100644 --- a/webapp/src/components/FirmwareInfo.vue +++ b/webapp/src/components/FirmwareInfo.vue @@ -22,6 +22,10 @@ {{ systemStatus.git_hash }} +