Fix version math

This commit is contained in:
iranl
2024-12-05 22:08:49 +01:00
parent c4f9644c97
commit 3b3eb2902c
3 changed files with 4 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ parser.add_argument('ota_type', type=str)
args = parser.parse_args() args = parser.parse_args()
regex = r"\#define NUKI_HUB_VERSION \"(.*)\"" regex = r"\#define NUKI_HUB_VERSION \"(.*)\""
regex2 = r"\#define NUKI_HUB_VERSION_INT \(uint32_t\)\"(.*)\"" regex2 = r"\#define NUKI_HUB_VERSION_INT \(uint32_t\)(.*)"
version = "unknown" version = "unknown"
with open('src/Config.h', 'r') as file: with open('src/Config.h', 'r') as file:
@@ -37,7 +37,7 @@ content_new = ""
with open ('src/Config.h', 'r' ) as readfile: with open ('src/Config.h', 'r' ) as readfile:
file_content = readfile.read() file_content = readfile.read()
content_new = re.sub(regex, "#define NUKI_HUB_VERSION \"" + str(version) + "-" + args.ota_type + str(number) + "\"", file_content, flags = re.M) content_new = re.sub(regex, "#define NUKI_HUB_VERSION \"" + str(version) + "-" + args.ota_type + str(number) + "\"", file_content, flags = re.M)
content_new = re.sub(regex2, "#define NUKI_HUB_VERSION_INT (uint32_t)\"" + str(version_int) + "\"", content_new, flags = re.M) content_new = re.sub(regex2, "#define NUKI_HUB_VERSION_INT (uint32_t)" + str(version_int), content_new, flags = re.M)
with open('src/Config.h', 'w') as writefile: with open('src/Config.h', 'w') as writefile:
writefile.write(content_new) writefile.write(content_new)

View File

@@ -3,7 +3,7 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#define NUKI_HUB_VERSION "9.03" #define NUKI_HUB_VERSION "9.03"
#define NUKI_HUB_VERSION_INT (uint32_t)"903" #define NUKI_HUB_VERSION_INT (uint32_t)903
#define NUKI_HUB_BUILD "unknownbuildnr" #define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2024-12-03" #define NUKI_HUB_DATE "2024-12-03"

View File

@@ -217,7 +217,7 @@ inline void initPreferences(Preferences* preferences)
Log->println(lastConfigVer); Log->println(lastConfigVer);
Log->print("Current config version: "); Log->print("Current config version: ");
if(lastConfigVer >= NUKI_HUB_VERSION_INT) return; if(lastConfigVer >= NUKI_HUB_VERSION_INT && lastConfigVer < 20000) return;
if (lastConfigVer < 834) if (lastConfigVer < 834)
{ {