diff --git a/.pio/build/esp12e/firmware.bin b/.pio/build/esp12e/firmware.bin index af81808..e740f93 100644 Binary files a/.pio/build/esp12e/firmware.bin and b/.pio/build/esp12e/firmware.bin differ diff --git a/include/version.h b/include/version.h new file mode 100644 index 0000000..9af9982 --- /dev/null +++ b/include/version.h @@ -0,0 +1,9 @@ +#ifndef BUILD_NUMBER + #define BUILD_NUMBER 1 +#endif +#ifndef VERSION + #define VERSION "v0.1.1 - 2023-11-28 09:09:49.089072" +#endif +#ifndef VERSION_SHORT + #define VERSION_SHORT "v0.1.1" +#endif diff --git a/platformio.ini b/platformio.ini index c702f31..f00a9dd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,3 +19,5 @@ lib_deps = monitor_speed = 115200 upload_protocol = espota upload_port = 192.168.29.35 +extra_scripts = + pre:scripts/buildscript_versioning.py diff --git a/scripts/buildscript_versioning.py b/scripts/buildscript_versioning.py new file mode 100644 index 0000000..33b09b9 --- /dev/null +++ b/scripts/buildscript_versioning.py @@ -0,0 +1,30 @@ +FILENAME_BUILDNO = 'versioning' +FILENAME_VERSION_H = 'include/version.h' +version = 'v0.1.' + +import datetime + +build_no = 0 +try: + with open(FILENAME_BUILDNO) as f: + build_no = int(f.readline()) + 1 +except: + print('Starting build number from 1..') + build_no = 1 +with open(FILENAME_BUILDNO, 'w+') as f: + f.write(str(build_no)) + print('Build number: {}'.format(build_no)) + +hf = """\ +#ifndef BUILD_NUMBER + #define BUILD_NUMBER {} +#endif +#ifndef VERSION + #define VERSION "{} - {}" +#endif +#ifndef VERSION_SHORT + #define VERSION_SHORT "{}" +#endif +""".format(build_no, version+str(build_no), datetime.datetime.now(), version+str(build_no)) +with open(FILENAME_VERSION_H, 'w+') as f: + f.write(hf) \ No newline at end of file diff --git a/versioning b/versioning new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/versioning @@ -0,0 +1 @@ +1 \ No newline at end of file