diff --git a/.github/workflows/compile_esp8266.yml b/.github/workflows/compile_esp8266.yml index 701015a5..18021623 100644 --- a/.github/workflows/compile_esp8266.yml +++ b/.github/workflows/compile_esp8266.yml @@ -37,7 +37,7 @@ jobs: - name: Run PlatformIO run: pio run -d tools/esp8266 - name: rename - working-directory: tools/esp8266/helpers + working-directory: tools/esp8266/scripts run: python getVersion.py - uses: actions/upload-artifact@v3 with: diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 31750269..913b8a1c 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -510,6 +510,7 @@ void app::showIndex(void) { html.replace(F("{VERSION}"), mVersion); html.replace(F("{TS}"), String(mSendInterval) + " "); html.replace(F("{JS_TS}"), String(mSendInterval * 1000)); + html.replace(F("{BUILD}"), String(AUTO_GIT_HASH)); mWeb->send(200, "text/html", html); } @@ -1113,4 +1114,4 @@ const char* app::getFieldStateClass(uint8_t fieldId) { break; } return (pos >= DEVICE_CLS_ASSIGN_LIST_LEN) ? NULL : stateClasses[deviceFieldAssignment[pos].stateClsId]; -} \ No newline at end of file +} diff --git a/tools/esp8266/defines.h b/tools/esp8266/defines.h index 2bb5294c..33d76132 100644 --- a/tools/esp8266/defines.h +++ b/tools/esp8266/defines.h @@ -21,7 +21,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 5 -#define VERSION_PATCH 3 +#define VERSION_PATCH 4 //------------------------------------- diff --git a/tools/esp8266/html/h/index_html.h b/tools/esp8266/html/h/index_html.h index 542d39dd..6c4255bf 100644 --- a/tools/esp8266/html/h/index_html.h +++ b/tools/esp8266/html/h/index_html.h @@ -1,4 +1,4 @@ #ifndef __INDEX_HTML_H__ #define __INDEX_HTML_H__ -const char index_html[] PROGMEM = "Index - {DEVICE}

AHOY - {DEVICE}

Visualization

Setup

Uptime:

Time:

Statistics:

Every {TS}seconds the values are updated

This project was started from this discussion. (Mikrocontroller.net)
New updates can be found on Github: https://github.com/grindylow/ahoy

Please report issues using the feature provided by Github.

Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/
Check the licenses which are published on https://github.com/grindylow/ahoyas well

© 2022

Update Firmware

AHOY :: {VERSION}

Reboot

"; +const char index_html[] PROGMEM = "Index - {DEVICE}

AHOY - {DEVICE}

Visualization

Setup

Uptime:

Time:

Statistics:

Every {TS}seconds the values are updated

This project was started from this discussion. (Mikrocontroller.net)
New updates can be found on Github: https://github.com/grindylow/ahoy

Please report issues using the feature provided by Github

Discuss with us on Discord

Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/
Check the licenses which are published on https://github.com/grindylow/ahoyas well

© 2022

Update Firmware

AHOY :: {VERSION}

Reboot

Git SHA: {BUILD}

"; #endif /*__INDEX_HTML_H__*/ diff --git a/tools/esp8266/html/index.html b/tools/esp8266/html/index.html index 07638851..f0d2ffa8 100644 --- a/tools/esp8266/html/index.html +++ b/tools/esp8266/html/index.html @@ -46,7 +46,9 @@ This project was started from this discussion. (Mikrocontroller.net)
New updates can be found on Github: https://github.com/grindylow/ahoy

- Please report issues using the feature provided by Github.
+ Please report issues using the feature provided by Github
+
+ Discuss with us on Discord

Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/
Check the licenses which are published on https://github.com/grindylow/ahoy as well

@@ -57,6 +59,7 @@

Update Firmware

AHOY :: {VERSION}

Reboot

+

Git SHA: {BUILD}

diff --git a/tools/esp8266/platformio.ini b/tools/esp8266/platformio.ini index b9def408..ecfe4748 100644 --- a/tools/esp8266/platformio.ini +++ b/tools/esp8266/platformio.ini @@ -32,8 +32,11 @@ monitor_filters = time ; Add timestamp with milliseconds for each new line ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory +extra_scripts = + pre:scripts/auto_firmware_version.py + lib_deps = - nrf24/RF24@1.4.2 + nrf24/RF24@1.4.5 paulstoffregen/Time@^1.6.1 knolleary/PubSubClient@^2.8 bblanchon/ArduinoJson@^6.19.4 @@ -67,8 +70,11 @@ monitor_filters = ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory upload_port = /dev/ttyUSB0 +extra_scripts = + pre:scripts/auto_firmware_version.py + lib_deps = - nrf24/RF24@1.4.2 + nrf24/RF24@1.4.5 paulstoffregen/Time@^1.6.1 knolleary/PubSubClient@^2.8 bblanchon/ArduinoJson@^6.19.4 @@ -78,4 +84,4 @@ lib_deps = ;esp8266/ESP8266WebServer@^1.0 ;esp8266/ESP8266WiFi@^1.0 ;esp8266/SPI@1.0 - ;esp8266/Ticker@^1.0 + ;esp8266/Ticker@^1.0 \ No newline at end of file diff --git a/tools/esp8266/scripts/auto_firmware_version.py b/tools/esp8266/scripts/auto_firmware_version.py new file mode 100644 index 00000000..7992f9df --- /dev/null +++ b/tools/esp8266/scripts/auto_firmware_version.py @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022 Thomas Basler and others +# +import pkg_resources + +Import("env") + +required_pkgs = {'dulwich'} +installed_pkgs = {pkg.key for pkg in pkg_resources.working_set} +missing_pkgs = required_pkgs - installed_pkgs + +if missing_pkgs: + env.Execute('"$PYTHONEXE" -m pip install dulwich --global-option="--pure"') + +from dulwich import porcelain + +def get_firmware_specifier_build_flag(): + build_version = porcelain.describe('../../') # refers to the repository root dir + build_flag = "-D AUTO_GIT_HASH=\\\"" + build_version + "\\\"" + print ("Firmware Revision: " + build_version) + return (build_flag) + +env.Append( + BUILD_FLAGS=[get_firmware_specifier_build_flag()] +) diff --git a/tools/esp8266/helpers/getVersion.py b/tools/esp8266/scripts/getVersion.py similarity index 100% rename from tools/esp8266/helpers/getVersion.py rename to tools/esp8266/scripts/getVersion.py