Skip to content

Commit

Permalink
show branch in system info
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Aug 9, 2023
1 parent 21bbed9 commit 401a3b8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pio-scripts/auto_firmware_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
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(
Expand Down
5 changes: 5 additions & 0 deletions src/WebApi_sysstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions webapp/src/components/FirmwareInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions webapp/src/types/SystemStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file modified webapp_dist/js/app.js.gz
Binary file not shown.

0 comments on commit 401a3b8

Please sign in to comment.