show branch in system info

This commit is contained in:
helgeerbe 2023-08-09 15:32:08 +02:00
parent 21bbed9b8e
commit 401a3b86a8
6 changed files with 16 additions and 1 deletions

View File

@ -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(

View File

@ -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;

View File

@ -22,6 +22,10 @@
{{ systemStatus.git_hash }}
</a></td>
</tr>
<tr>
<th>{{ $t('firmwareinfo.FirmwareBranch') }}</th>
<td>{{ systemStatus.git_branch }}</td>
</tr>
<tr>
<th>{{ $t('firmwareinfo.PioEnv') }}</th>
<td>{{ systemStatus.pioenv }}</td>

View File

@ -186,6 +186,7 @@
"DetectedMaxPower": "Detected max. Power",
"BootloaderVersion": "Bootloader Version",
"FirmwareVersion": "Firmware Version",
"FirmwareBranch": "Firmware Branch",
"FirmwareBuildDate": "Firmware Build Date",
"HardwarePartNumber": "Hardware Part Number",
"HardwareVersion": "Hardware Version"

View File

@ -10,6 +10,7 @@ export interface SystemStatus {
config_version: string;
git_hash: string;
git_is_hash: boolean;
git_branch: string;
pioenv: string;
resetreason_0: string;
resetreason_1: string;

Binary file not shown.