diff --git a/bin/build-all.sh b/bin/build-all.sh index ab779e187..5021680c3 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -2,7 +2,7 @@ set -e -source bin/version.sh +VERSION=`bin/buildinfo.py` COUNTRIES="US EU433 EU865 CN JP ANZ KR" #COUNTRIES=US diff --git a/bin/buildinfo.py b/bin/buildinfo.py new file mode 100755 index 000000000..803b5bc7e --- /dev/null +++ b/bin/buildinfo.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +import configparser + +config = configparser.RawConfigParser() +config.read('version.properties') + +version = dict(config.items('VERSION')) + +verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"]) + +print(f"{verStr}") diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py new file mode 100644 index 000000000..607906972 --- /dev/null +++ b/bin/platformio-custom.py @@ -0,0 +1,17 @@ +import configparser + +config = configparser.RawConfigParser() +config.read('version.properties') + +version = dict(config.items('VERSION')) + +verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"]) + +print(f"Using meshtastic platform-custom.py, firmare version {verStr}") + +Import("env", "projenv") + +# General options that are passed to the C and C++ compilers +projenv.Append(CCFLAGS=[ + f"-DAPP_VERSION={verStr}" + ]) \ No newline at end of file diff --git a/bin/version.sh b/bin/version.sh deleted file mode 100644 index 2e7677737..000000000 --- a/bin/version.sh +++ /dev/null @@ -1,3 +0,0 @@ - - -export VERSION=1.1.9 \ No newline at end of file diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 822fbd4a4..6398e11fb 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,11 +4,13 @@ You probably don't care about this section - skip to the next one. For app cleanup: -* do fixed position bug https://github.com/meshtastic/Meshtastic-device/issues/536 +* make device build always have a valid version +* DONE do fixed position bug https://github.com/meshtastic/Meshtastic-device/issues/536 * check build guide * generate autodocs * write user guide * DONE update android code: https://developer.android.com/topic/libraries/view-binding/migration +* only do wantReplies once per packet type, if we change network settings force it again * make gpio watch work, use thread and setup * make hello world example service * make python ping command diff --git a/platformio.ini b/platformio.ini index 4f73d1955..015aa105b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,16 +19,17 @@ default_envs = tbeam # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you ; The following environment variables must be set in the shell if you'd like to override them. ; They are used in this ini file as systenv.VARNAME, so in your shell do export "VARNAME=fish" ; COUNTRY (default US), i.e. "export COUNTRY=EU865" -; APP_VERSION (default emptystring) ; HW_VERSION (default emptystring) [env] +; note: APP_VERSION now comes from bin/version.json +extra_scripts = bin/platformio-custom.py + ; note: we add src to our include search path so that lmic_project_config can override ; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/nanopb/include -Wl,-Map,.pio/build/output.map -DHW_VERSION_${sysenv.COUNTRY} - -DAPP_VERSION=${sysenv.APP_VERSION} -DHW_VERSION=${sysenv.HW_VERSION} -DUSE_THREAD_NAMES -DTINYGPSPLUS_OPTION_NO_CUSTOM_FIELDS diff --git a/src/configuration.h b/src/configuration.h index ed851ed8f..28eea052b 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -31,9 +31,12 @@ along with this program. If not, see . // If app version is not specified we assume we are not being invoked by the build script #ifndef APP_VERSION -#error APP_VERSION, HW_VERSION, and HW_VERSION_countryname must be set by the build environment -//#define APP_VERSION 0.0.0 // this def normally comes from build-all.sh -//#define HW_VERSION 1.0 - US // normally comes from build-all.sh and contains the region code +#error APP_VERSION must be set by the build environment +#endif + +// If app version is not specified we assume we are not being invoked by the build script +#ifndef HW_VERSION +#error HW_VERSION, and HW_VERSION_countryname must be set by the build environment #endif // -----------------------------------------------------------------------------