diff --git a/platformio.ini b/platformio.ini index 0c8aa18..a3943c9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,6 +13,7 @@ extra_configs = secrets.default.ini [env] +version = 1.4.1 framework = arduino lib_deps = bblanchon/ArduinoJson@^7.0.4 @@ -33,6 +34,8 @@ build_flags = -mtext-section-literals -D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1 ;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial + -D BUILD_VERSION='"${this.version}"' + -D BUILD_ENV='"$PIOENV"' -D USE_SERIAL=${secrets.use_serial} -D USE_TELNET=${secrets.use_telnet} -D DEBUG_BY_DEFAULT=${secrets.debug} @@ -53,7 +56,6 @@ monitor_speed = 115200 monitor_filters = direct board_build.flash_mode = dio board_build.filesystem = littlefs -version = 1.4.1 ; Defaults [esp8266_defaults] diff --git a/src/MqttTask.h b/src/MqttTask.h index e01c229..a274abb 100644 --- a/src/MqttTask.h +++ b/src/MqttTask.h @@ -163,7 +163,7 @@ protected: // ha helper settings this->haHelper->setDevicePrefix(settings.mqtt.prefix); - this->haHelper->setDeviceVersion(PROJECT_VERSION); + this->haHelper->setDeviceVersion(BUILD_VERSION); this->haHelper->setDeviceModel(PROJECT_NAME); this->haHelper->setDeviceName(PROJECT_NAME); this->haHelper->setWriter(this->writer); diff --git a/src/PortalTask.h b/src/PortalTask.h index 0d30543..05b3115 100644 --- a/src/PortalTask.h +++ b/src/PortalTask.h @@ -82,7 +82,7 @@ protected: String result; if (strcmp(var, "ver") == 0) { - result = PROJECT_VERSION; + result = BUILD_VERSION; } return result; @@ -513,8 +513,9 @@ protected: doc["network"]["gateway"] = isConnected ? network->getStaGateway().toString() : ""; doc["network"]["dns"] = isConnected ? network->getStaDns().toString() : ""; - doc["system"]["version"] = PROJECT_VERSION; + doc["system"]["buildVersion"] = BUILD_VERSION; doc["system"]["buildDate"] = __DATE__ " " __TIME__; + doc["system"]["buildEnv"] = BUILD_ENV; doc["system"]["uptime"] = millis() / 1000ul; doc["system"]["totalHeap"] = getTotalHeap(); doc["system"]["freeHeap"] = getFreeHeap(); diff --git a/src/defines.h b/src/defines.h index ecc7f5b..0c8d158 100644 --- a/src/defines.h +++ b/src/defines.h @@ -1,5 +1,4 @@ #define PROJECT_NAME "OpenTherm Gateway" -#define PROJECT_VERSION "1.4.1" #define PROJECT_REPO "https://github.com/Laxilef/OTGateway" #define MQTT_RECONNECT_INTERVAL 15000 @@ -23,6 +22,14 @@ #define THERMOSTAT_INDOOR_MIN_TEMP 5 #define THERMOSTAT_INDOOR_MAX_TEMP 30 +#ifndef BUILD_VERSION + #define BUILD_VERSION "0.0.0" +#endif + +#ifndef BUILD_ENV + #define BUILD_ENV "undefined" +#endif + #ifndef USE_SERIAL #define USE_SERIAL true #endif diff --git a/src_data/index.html b/src_data/index.html index 6a9597c..565b8ed 100644 --- a/src_data/index.html +++ b/src_data/index.html @@ -87,11 +87,11 @@ Version: - , core/sdk: + - Build date: - + Build: + Env:
Date:
Core/SDK: Uptime: @@ -155,8 +155,9 @@ setValue('#network-dns', result.network.dns); setBusy('#main-busy', '#main-table', false); - setValue('#version', result.system.version); + setValue('#build-version', result.system.buildVersion); setValue('#build-date', result.system.buildDate); + setValue('#build-env', result.system.buildEnv); setValue('#uptime', result.system.uptime); setValue('#uptime-days', Math.floor(result.system.uptime / 86400)); setValue('#uptime-hours', Math.floor(result.system.uptime % 86400 / 3600));