Browse Source

Merge branch 'main' of https://github.com/grindylow/ahoy

pull/134/head
Andreas Schiffler 2 years ago
parent
commit
4be61785d0
  1. 2
      .github/workflows/compile_esp8266.yml
  2. 3
      tools/esp8266/app.cpp
  3. 2
      tools/esp8266/defines.h
  4. 2
      tools/esp8266/html/h/index_html.h
  5. 5
      tools/esp8266/html/index.html
  6. 12
      tools/esp8266/platformio.ini
  7. 26
      tools/esp8266/scripts/auto_firmware_version.py
  8. 0
      tools/esp8266/scripts/getVersion.py

2
.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:

3
tools/esp8266/app.cpp

@ -548,6 +548,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);
}
@ -1163,4 +1164,4 @@ const char* app::getFieldStateClass(uint8_t fieldId) {
break;
}
return (pos >= DEVICE_CLS_ASSIGN_LIST_LEN) ? NULL : stateClasses[deviceFieldAssignment[pos].stateClsId];
}
}

2
tools/esp8266/defines.h

@ -21,7 +21,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 3
#define VERSION_PATCH 4
//-------------------------------------

2
tools/esp8266/html/h/index_html.h

@ -1,4 +1,4 @@
#ifndef __INDEX_HTML_H__
#define __INDEX_HTML_H__
const char index_html[] PROGMEM = "<!doctype html><html><head><title>Index - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script type=\"text/javascript\">getAjax('/uptime', 'uptime');getAjax('/time', 'time');getAjax('/cmdstat', 'cmds');window.setInterval(\"getAjax('/uptime', 'uptime')\", {JS_TS});window.setInterval(\"getAjax('/time', 'time')\", {JS_TS});window.setInterval(\"getAjax('/cmdstat', 'cmds')\", {JS_TS});function getAjax(url, resid) {var http = null;http = new XMLHttpRequest();if(http != null) {http.open(\"GET\", url, true);http.onreadystatechange = print;http.send(null);}function print() {if(http.readyState == 4) {document.getElementById(resid).innerHTML = http.responseText;}}}</script></head><body><h1>AHOY - {DEVICE}</h1><div id=\"content\" class=\"content\"><p><a href=\"/hoymiles\">Visualization</a><br/><br/><a href=\"/setup\">Setup</a><br/></p><p><span class=\"des\">Uptime: </span><span id=\"uptime\"></span></p><p><span class=\"des\">Time: </span><span id=\"time\"></span></p><p><span class=\"des\">Statistics: </span><pre id=\"cmds\"></pre></p><p>Every {TS}seconds the values are updated</p><div id=\"note\">This project was started from <a href=\"https://www.mikrocontroller.net/topic/525778\" target=\"_blank\">this discussion. (Mikrocontroller.net)</a><br/>New updates can be found on Github: <a href=\"https://github.com/grindylow/ahoy\" target=\"_blank\">https://github.com/grindylow/ahoy</a><br/><br/>Please report issues using the feature provided by Github.<br/><br/><p class=\"lic\"><a href=\"https://creativecommons.org/licenses/by-nc-sa/3.0/de\">Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/</a><br/>Check the licenses which are published on <a href=\"https://github.com/grindylow/ahoy\">https://github.com/grindylow/ahoy</a>as well</p></div></div><div id=\"footer\"><p class=\"left\">&copy 2022</p><p class=\"left\"><a href=\"/update\">Update Firmware</a></p><p class=\"right\">AHOY :: {VERSION}</p><p class=\"right\"><a href=\"/reboot\">Reboot</a></p></div></body></html>";
const char index_html[] PROGMEM = "<!doctype html><html><head><title>Index - {DEVICE}</title><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><script type=\"text/javascript\">getAjax('/uptime', 'uptime');getAjax('/time', 'time');getAjax('/cmdstat', 'cmds');window.setInterval(\"getAjax('/uptime', 'uptime')\", {JS_TS});window.setInterval(\"getAjax('/time', 'time')\", {JS_TS});window.setInterval(\"getAjax('/cmdstat', 'cmds')\", {JS_TS});function getAjax(url, resid) {var http = null;http = new XMLHttpRequest();if(http != null) {http.open(\"GET\", url, true);http.onreadystatechange = print;http.send(null);}function print() {if(http.readyState == 4) {document.getElementById(resid).innerHTML = http.responseText;}}}</script></head><body><h1>AHOY - {DEVICE}</h1><div id=\"content\" class=\"content\"><p><a href=\"/hoymiles\">Visualization</a><br/><br/><a href=\"/setup\">Setup</a><br/></p><p><span class=\"des\">Uptime: </span><span id=\"uptime\"></span></p><p><span class=\"des\">Time: </span><span id=\"time\"></span></p><p><span class=\"des\">Statistics: </span><pre id=\"cmds\"></pre></p><p>Every {TS}seconds the values are updated</p><div id=\"note\">This project was started from <a href=\"https://www.mikrocontroller.net/topic/525778\" target=\"_blank\">this discussion. (Mikrocontroller.net)</a><br/>New updates can be found on Github: <a href=\"https://github.com/grindylow/ahoy\" target=\"_blank\">https://github.com/grindylow/ahoy</a><br/><br/>Please report issues using the feature provided by <a href=\"https://github.com/grindylow/ahoy/issues\">Github</a><br/><br/>Discuss with us on <a href=\"https://discord.gg/WzhxEY62mB\">Discord</a><br/><p class=\"lic\"><a href=\"https://creativecommons.org/licenses/by-nc-sa/3.0/de\">Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/</a><br/>Check the licenses which are published on <a href=\"https://github.com/grindylow/ahoy\">https://github.com/grindylow/ahoy</a>as well</p></div></div><div id=\"footer\"><p class=\"left\">&copy 2022</p><p class=\"left\"><a href=\"/update\">Update Firmware</a></p><p class=\"right\">AHOY :: {VERSION}</p><p class=\"right\"><a href=\"/reboot\">Reboot</a></p><p class=\"right\">Git SHA: {BUILD}</p></div></body></html>";
#endif /*__INDEX_HTML_H__*/

5
tools/esp8266/html/index.html

@ -46,7 +46,9 @@
This project was started from <a href="https://www.mikrocontroller.net/topic/525778" target="_blank">this discussion. (Mikrocontroller.net)</a><br/>
New updates can be found on Github: <a href="https://github.com/grindylow/ahoy" target="_blank">https://github.com/grindylow/ahoy</a><br/>
<br/>
Please report issues using the feature provided by Github.<br/>
Please report issues using the feature provided by <a href="https://github.com/grindylow/ahoy/issues">Github</a><br/>
<br/>
Discuss with us on <a href="https://discord.gg/WzhxEY62mB">Discord</a>
<br/>
<p class="lic"><a href="https://creativecommons.org/licenses/by-nc-sa/3.0/de">Creative Commons - https://creativecommons.org/licenses/by-nc-sa/3.0/de/</a><br/>
Check the licenses which are published on <a href="https://github.com/grindylow/ahoy">https://github.com/grindylow/ahoy</a> as well</p>
@ -57,6 +59,7 @@
<p class="left"><a href="/update">Update Firmware</a></p>
<p class="right">AHOY :: {VERSION}</p>
<p class="right"><a href="/reboot">Reboot</a></p>
<p class="right">Git SHA: {BUILD}</p>
</div>
</body>
</html>

12
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

26
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()]
)

0
tools/esp8266/helpers/getVersion.py → tools/esp8266/scripts/getVersion.py

Loading…
Cancel
Save