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); } //