From 218d84151153c8fe035b5c95222f4af54009b077 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Mon, 3 May 2021 09:50:06 +0800 Subject: [PATCH] use short version string on bootscreen --- bin/buildinfo.py | 4 ++-- bin/platformio-custom.py | 7 ++++--- bin/readprops.py | 9 +++++---- src/graphics/Screen.cpp | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/buildinfo.py b/bin/buildinfo.py index 36f88f43e..1dc5d98ef 100755 --- a/bin/buildinfo.py +++ b/bin/buildinfo.py @@ -3,5 +3,5 @@ import configparser from readprops import readProps -verStr = readProps('version.properties') -print(f"{verStr}") +verObj = readProps('version.properties') +print(f"{verObj['long']}") diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index ce811c9cb..d299f954f 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -9,11 +9,12 @@ from readprops import readProps Import("projenv") prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" -verStr = readProps(prefsLoc) -print("Using meshtastic platform-custom.py, firmare version " + verStr) +verObj = readProps(prefsLoc) +print("Using meshtastic platform-custom.py, firmare version " + verObj['long']) # print("path is" + ','.join(sys.path)) # General options that are passed to the C and C++ compilers projenv.Append(CCFLAGS=[ - "-DAPP_VERSION=" + verStr + "-DAPP_VERSION=" + verObj['long'], + "-DAPP_VERSION_SHORT=" + verObj['short'] ]) diff --git a/bin/readprops.py b/bin/readprops.py index 7fc471774..25eba4852 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -12,6 +12,8 @@ def readProps(prefsLoc): config = configparser.RawConfigParser() config.read(prefsLoc) version = dict(config.items('VERSION')) + verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]), + long = "unset") # Try to find current build SHA if if the workspace is clean. This could fail if git is not installed try: @@ -23,14 +25,13 @@ def readProps(prefsLoc): if isDirty: # short for 'dirty', we want to keep our verstrings source for protobuf reasons suffix = sha + "-d" - verStr = "{}.{}.{}.{}".format( + verObj['long'] = "{}.{}.{}.{}".format( version["major"], version["minor"], version["build"], suffix) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() - verStr = "{}.{}.{}".format( - version["major"], version["minor"], version["build"]) + verObj['long'] = verObj['short'] # print("firmare version " + verStr) - return verStr + return verObj # print("path is" + ','.join(sys.path)) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index c7580f02d..332b9d6d7 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -130,7 +130,7 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl // Draw version in upper right char buf[16]; snprintf(buf, sizeof(buf), "%s", - xstr(APP_VERSION)); // Note: we don't bother printing region or now, it makes the string too long + xstr(APP_VERSION_SHORT)); // Note: we don't bother printing region or now, it makes the string too long display->drawString(x + SCREEN_WIDTH - display->getStringWidth(buf), y + 0, buf); screen->forceDisplay();