From 07fefe41fbad40946fe13c4ad2bdcea3f7a41a95 Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Mon, 21 Mar 2022 21:42:44 +0100 Subject: [PATCH] Added git rev to build info --- platformio.ini | 1 + script/git_rev.py | 8 ++++++++ src/helper.cpp | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 script/git_rev.py diff --git a/platformio.ini b/platformio.ini index b6b6674..ab7e463 100644 --- a/platformio.ini +++ b/platformio.ini @@ -34,6 +34,7 @@ build_flags = -D USER_SSID=\""\"" # =\""myssid\"" -D USER_SSID_PWD=\""\"" # =\""mypwd\"" -D CFG_APPVER="\"0.9.0\"" + !python script/git_rev.py lib_deps = # Switched to forks for better version control. # Using local copy of these libraries #https://github.com/jrowberg/i2cdevlib.git# diff --git a/script/git_rev.py b/script/git_rev.py new file mode 100644 index 0000000..bdfb557 --- /dev/null +++ b/script/git_rev.py @@ -0,0 +1,8 @@ +import subprocess + +revision = ( + subprocess.check_output(["git", "rev-parse", "HEAD"]) + .strip() + .decode("utf-8") +) +print("-D CFG_GITREV='\"%s\"'" % revision) diff --git a/src/helper.cpp b/src/helper.cpp index 5f00eb6..68d0b36 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -191,7 +191,7 @@ void deepSleep(int t) { // Print the build options used // void printBuildOptions() { - Log.notice(F("Build options: %s LOGLEVEL %d " + Log.notice(F("Build options: %s (%s) LOGLEVEL %d " #ifdef SKIP_SLEEPMODE "SKIP_SLEEP " #endif @@ -205,7 +205,7 @@ void printBuildOptions() { "OTA " #endif CR), - CFG_APPVER, LOG_LEVEL); + CFG_APPVER, CFG_GITREV, LOG_LEVEL); } //