From 90cfe350876e9c257a344af876577543ca25711c Mon Sep 17 00:00:00 2001 From: Leon Oostrum Date: Mon, 10 Jul 2023 15:26:42 +0200 Subject: [PATCH] Add version number to host library --- .bumpversion.cfg | 4 ++++ host/include/PowerSensor.hpp | 1 + host/src/psconfig.cc | 1 + host/src/psrun.cc | 1 + host/src/pstest.cc | 1 + 5 files changed, 8 insertions(+) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index df56fa7a..a56abfac 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -9,6 +9,10 @@ replace = version: {new_version} search = PowerSensor3 VERSION {current_version} replace = PowerSensor3 VERSION {new_version} +[bumpversion:file:host/include/PowerSensor.hpp] +search = POWERSENSOR_VERSION = "{current_version}"; +search = POWERSENSOR_VERSION = "{new_version}"; + [bumpversion:file(F401):device/PowerSensor/PowerSensor.ino] search = VERSION "F401-{current_version}" replace = VERSION "F401-{new_version}" diff --git a/host/include/PowerSensor.hpp b/host/include/PowerSensor.hpp index d7307cc8..fe5ec5e3 100644 --- a/host/include/PowerSensor.hpp +++ b/host/include/PowerSensor.hpp @@ -17,6 +17,7 @@ static const unsigned MAX_SENSORS = 8; static const unsigned MAX_PAIRS = MAX_SENSORS / 2; static const float VOLTAGE = 3.3; static const unsigned MAX_LEVEL = 1023; +static const std::string POWERSENSOR_VERSION = "1.1.0"; /** * @brief Struct containing values of all active sensors at a single point in time diff --git a/host/src/psconfig.cc b/host/src/psconfig.cc index f1a3eef7..e36ed9b7 100644 --- a/host/src/psconfig.cc +++ b/host/src/psconfig.cc @@ -191,6 +191,7 @@ int main(int argc, char *argv[]) { bool doWriteConfig = false; bool doPrint = false; + std::cout << "psconfig version " << PowerSensor3::POWERSENSOR_VERSION << std::endl << std::endl; for (int opt; (opt = getopt(argc, argv, "d:s:i:t:av:n:o:lph")) >= 0;) { switch (opt) { // device select diff --git a/host/src/psrun.cc b/host/src/psrun.cc index f47a405a..5c62c0b3 100644 --- a/host/src/psrun.cc +++ b/host/src/psrun.cc @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) { std::string dumpFileName; int sensorPair = -1; + std::cout << "psrun version " << PowerSensor3::POWERSENSOR_VERSION << std::endl << std::endl; for (int opt; (opt = getopt(argc, argv, "d:f:s:")) >= 0;) { switch (opt) { case 'd': diff --git a/host/src/pstest.cc b/host/src/pstest.cc index 909c3b8e..ab9128a4 100644 --- a/host/src/pstest.cc +++ b/host/src/pstest.cc @@ -21,6 +21,7 @@ int main(int argc, char *argv[]) { std::string dumpFileName; int sensorPair = -1; + std::cout << "pstest version " << PowerSensor3::POWERSENSOR_VERSION << std::endl << std::endl; for (int opt; (opt = getopt(argc, argv, "d:f:s:")) >= 0;) { switch (opt) { case 'd':