From 070a2d7c5795d95658db54170bfa1dcfd9df4fd1 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Tue, 30 Jun 2020 14:01:17 +0200 Subject: [PATCH] Version information --- script/autoversioning.py | 6 ++++++ src/main.cpp | 8 ++++++++ src/network/XD0OTA.h | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/script/autoversioning.py b/script/autoversioning.py index b52238e..164ed34 100755 --- a/script/autoversioning.py +++ b/script/autoversioning.py @@ -11,3 +11,9 @@ f.close() env.Append(CPPDEFINES=[ ("FW_VERSION", ver) ]) + +drone_semver = env["ENV"].get("DRONE_SEMVER") +if drone_semver: + env.Append(CPPDEFINES=[ + ("DRONE_SEMVER", "\"" + drone_semver.replace("\"", "\\\"") + "\"") + ]) diff --git a/src/main.cpp b/src/main.cpp index 545f787..c868054 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -256,7 +256,15 @@ void helloWorld() display.setCursor(5, display.height()-5); display.setFont(&Org_01); + #if defined DRONE_SEMVER + display.print("Version "); + #define xstr(s) str(s) + #define str(s) #s + display.print(xstr(DRONE_SEMVER)); + #elif defined FW_VERSION + display.print("Build "); display.print(FW_VERSION); + #endif } while (display.nextPage()); //Serial.println("helloWorld done"); diff --git a/src/network/XD0OTA.h b/src/network/XD0OTA.h index 36763e5..20242a6 100644 --- a/src/network/XD0OTA.h +++ b/src/network/XD0OTA.h @@ -13,6 +13,10 @@ #include +#ifndef FW_VERSION +#define FW_VERSION 0 +#endif + class XD0OTA { public: XD0OTA(String deviceName);